Skip to content

Commit

Permalink
Delay the "Image still loading" message for half a second
Browse files Browse the repository at this point in the history
This might mitigate #32.
  • Loading branch information
phillipberndt committed Apr 17, 2015
1 parent eecb253 commit 5b13d5b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pqiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,13 @@ void preload_adjacent_images() {/*{{{*/
D_UNLOCK(file_tree);
}
}/*}}}*/
gboolean absolute_image_movement_still_unloaded_timer_callback(gpointer user_data) {/*{{{*/
if(user_data == (void *)current_file_node && !CURRENT_FILE->is_loaded) {
update_info_text(NULL);
gtk_widget_queue_draw(GTK_WIDGET(main_window));
}
return FALSE;
}/*}}}*/
gboolean absolute_image_movement(BOSNode *ref) {/*{{{*/
D_LOCK(file_tree);
BOSNode *node = bostree_node_weak_unref(file_tree, ref);
Expand All @@ -1650,10 +1657,10 @@ gboolean absolute_image_movement(BOSNode *ref) {/*{{{*/
current_file_node = bostree_node_weak_ref(node);
D_UNLOCK(file_tree);

// If the new image has not been loaded yet, display an information message
// If the new image has not been loaded yet, prepare to display an information message
// after some grace period
if(!CURRENT_FILE->is_loaded) {
update_info_text(NULL);
gtk_widget_queue_draw(GTK_WIDGET(main_window));
gdk_threads_add_timeout(500, absolute_image_movement_still_unloaded_timer_callback, current_file_node);
}

// Load it
Expand Down

0 comments on commit 5b13d5b

Please sign in to comment.