- 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->vadjustment->page_size == 0)
+ return;
+
+ if (priv->tree_view) {
+ if (! GTK_WIDGET_REALIZED (priv->tree_view))
+ return;
+
+ gtk_tree_view_convert_tree_to_bin_window_coords (GTK_TREE_VIEW (priv->tree_view),
+ 0, (int) priv->vadjustment->value,
+ NULL, &wy1);
+ gtk_tree_view_convert_tree_to_bin_window_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 && path2) {
+ 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;
+ gint prev_width = -1;
+ gint prev_height = -1;
+
+ for (i = 0; i < sidebar_thumbnails->priv->n_pages; i++) {
+ gchar *page_label;
+ gchar *page_string;
+ GdkPixbuf *loading_icon = NULL;
+ gint width, height;
+
+ page_label = ev_page_cache_get_page_label (priv->page_cache, i);
+ page_string = g_markup_printf_escaped ("<i>%s</i>", page_label);
+ ev_page_cache_get_thumbnail_size (sidebar_thumbnails->priv->page_cache, i,
+ sidebar_thumbnails->priv->rotation,
+ &width, &height);
+ if (!loading_icon || (width != prev_width && height != prev_height)) {
+ loading_icon =
+ ev_sidebar_thumbnails_get_loading_icon (sidebar_thumbnails,
+ width, height);
+ }
+
+ prev_width = width;
+ prev_height = height;