-static gboolean
-populate_thumbnails_idle (gpointer data)
-{
- GTimer *timer;
- int i;
- gdouble time_elapsed = 0;
-
- EvSidebarThumbnails *ev_sidebar_thumbnails = EV_SIDEBAR_THUMBNAILS (data);
- EvSidebarThumbnailsPrivate *priv = ev_sidebar_thumbnails->priv;
-
-#if PROFILE_THUMB == 1
- static GTimer *total_timer;
- static gboolean first_time = TRUE;
-
- if (first_time) {
- total_timer = g_timer_new ();
- first_time = FALSE;
- g_timer_start (total_timer);
- }
-#endif
-
- /* undo the thumbnailing idle and handler */
- if (priv->pages_done == priv->n_pages) {
- priv->idle_id = 0;
- g_signal_handlers_disconnect_by_func (priv->vadjustment,
- adjustment_changed_cb,
- ev_sidebar_thumbnails);
-#if PROFILE_THUMB == 1
- time_elapsed = g_timer_elapsed (total_timer, NULL);
- g_timer_destroy (total_timer);
- g_print ("%d rows done in %f seconds\n",
- gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->list_store), NULL),
- time_elapsed);
-#endif
- return FALSE;
- }
-
- timer = g_timer_new ();
- i = 0;
- g_timer_start (timer);
- while (do_one_iteration (ev_sidebar_thumbnails)) {
- i++;
- time_elapsed = g_timer_elapsed (timer, NULL);
- if (time_elapsed > IDLE_WORK_LENGTH/1000000)
- break;
- }
- g_timer_destroy (timer);
-#if PROFILE_THUMB == 2
- g_print ("%d rows done this idle in %f seconds\n", i, time_elapsed);
-#endif
-
- return TRUE;
-}
-
-void
-ev_sidebar_thumbnails_select_page (EvSidebarThumbnails *sidebar,
- int page)
-{
- GtkTreePath *path;
- GtkTreeSelection *selection;
-
- /* if the EvSidebar's document can't provide thumbnails */
- if (sidebar->priv->document == NULL)
- return;
-
- path = gtk_tree_path_new_from_indices (page - 1, -1);
- selection = gtk_tree_view_get_selection
- (GTK_TREE_VIEW (sidebar->priv->tree_view));
-
- if (path) {
- gtk_tree_selection_select_path (selection, path);
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (sidebar->priv->tree_view),
- path, NULL, FALSE, 0.0, 0.0);
- gtk_tree_path_free (path);
- }
-}
-
-
-void
-ev_sidebar_thumbnails_set_document (EvSidebarThumbnails *sidebar_thumbnails,