- gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->list_store),
- &iter, path);
- gtk_tree_model_get (GTK_TREE_MODEL (priv->list_store), &iter,
- COLUMN_THUMBNAIL_SET, &thumbnail_set,
- -1);
- if (! thumbnail_set) {
- priv->current_page = page;
- priv->current_page_iter = iter;
-
+
+ if (priv->tree_view) {
+ if (! GTK_WIDGET_REALIZED (priv->tree_view))
+ return;
+
+ gtk_tree_view_tree_to_widget_coords (GTK_TREE_VIEW (priv->tree_view),
+ 0, (int) priv->vadjustment->value,
+ NULL, &wy1);
+ gtk_tree_view_tree_to_widget_coords (GTK_TREE_VIEW (priv->tree_view),
+ 0, (int) (priv->vadjustment->value + priv->vadjustment->page_size),
+ NULL, &wy2);
+ gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->tree_view),
+ 1, wy1 + 1, &path,
+ NULL, NULL, NULL);
+ gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->tree_view),
+ 1, wy2 -1, &path2,
+ NULL, NULL, NULL);
+ } else if (priv->icon_view) {
+ if (! GTK_WIDGET_REALIZED (priv->icon_view))
+ return;
+ if (! gtk_icon_view_get_visible_range (GTK_ICON_VIEW (priv->icon_view), &path, &path2))
+ return;
+ } else {
+ return;
+ }
+
+ if (path == NULL)
+ path = gtk_tree_path_new_first ();
+ if (path2 == NULL)
+ path2 = gtk_tree_path_new_from_indices (priv->n_pages,
+ -1);
+ update_visible_range (sidebar_thumbnails,
+ gtk_tree_path_get_indices (path)[0],
+ gtk_tree_path_get_indices (path2)[0]);
+
+ gtk_tree_path_free (path);
+ gtk_tree_path_free (path2);
+}
+
+static void
+ev_sidebar_thumbnails_fill_model (EvSidebarThumbnails *sidebar_thumbnails)
+{
+ EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv;
+ GtkTreeIter iter;
+ int i;
+
+ for (i = 0; i < sidebar_thumbnails->priv->n_pages; i++) {
+ gchar *page_label;
+ gchar *page_string;
+
+ page_label = ev_page_cache_get_page_label (priv->page_cache, i);
+ page_string = g_markup_printf_escaped ("<i>%s</i>", page_label);
+
+ gtk_list_store_append (priv->list_store, &iter);
+ gtk_list_store_set (priv->list_store, &iter,
+ COLUMN_PAGE_STRING, page_string,
+ COLUMN_PIXBUF, priv->loading_icon,
+ COLUMN_THUMBNAIL_SET, FALSE,
+ -1);
+ g_free (page_label);
+ g_free (page_string);