]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-sidebar-thumbnails.c
Cr 31 13:27:50 2005 Jonathan Blandford <jrb@redhat.com>
[evince.git] / shell / ev-sidebar-thumbnails.c
index c548e297fbc6b77fe9631076562830246e7d375e..b439e4bf7f78337cb6bed7c5c27cd4f12c9c2eb3 100644 (file)
@@ -118,7 +118,7 @@ ev_sidebar_tree_selection_changed (GtkTreeSelection *selection,
 
        path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->list_store),
                                        &iter);
-       page = gtk_tree_path_get_indices (path)[0] + 1;
+       page = gtk_tree_path_get_indices (path)[0];
        gtk_tree_path_free (path);
 
        page_cache = ev_document_get_page_cache (priv->document);
@@ -189,7 +189,7 @@ page_changed_cb (EvPageCache         *page_cache,
        GtkTreePath *path;
        GtkTreeSelection *selection;
 
-       path = gtk_tree_path_new_from_indices (page - 1, -1);
+       path = gtk_tree_path_new_from_indices (page, -1);
        selection = gtk_tree_view_get_selection
                        (GTK_TREE_VIEW (sidebar->priv->tree_view));
 
@@ -222,7 +222,6 @@ ev_sidebar_thumbnails_set_document (EvSidebarThumbnails *sidebar_thumbnails,
        GdkPixbuf *loading_icon;
        gint i, n_pages;
        GtkTreeIter iter;
-       gchar *page;
        gint width = THUMBNAIL_WIDTH;
        gint height = THUMBNAIL_WIDTH;
        EvPageCache *page_cache;
@@ -247,20 +246,24 @@ ev_sidebar_thumbnails_set_document (EvSidebarThumbnails *sidebar_thumbnails,
        loading_icon = ev_document_misc_get_thumbnail_frame (width, height, NULL);
 
        gtk_list_store_clear (priv->list_store);
-       for (i = 1; i <= n_pages; i++) {
+       for (i = 0; i < n_pages; i++) {
                EvJob *job;
+               gchar *page_label;
+               gchar *page_string;
+
+               job = ev_job_thumbnail_new (priv->document, i, THUMBNAIL_WIDTH);
+               page_label = ev_page_cache_get_page_label (page_cache, i);
+               page_string = g_markup_printf_escaped ("<i>%s</i>", page_label);
 
-               /* FIXME: Bah.  This is still -1 for some reason.  Need to track it down.. */
-               job = ev_job_thumbnail_new (priv->document, i - 1, THUMBNAIL_WIDTH);
-               page = g_strdup_printf ("<i>%d</i>", i);
                gtk_list_store_append (priv->list_store, &iter);
                gtk_list_store_set (priv->list_store, &iter,
-                                   COLUMN_PAGE_STRING, page,
+                                   COLUMN_PAGE_STRING, page_string,
                                    COLUMN_PIXBUF, loading_icon,
                                    COLUMN_THUMBNAIL_SET, FALSE,
                                    COLUMN_JOB, job,
                                    -1);
-               g_free (page);
+               g_free (page_label);
+               g_free (page_string);
                ev_job_queue_add_job (job, EV_JOB_PRIORITY_LOW);
                g_object_set_data_full (G_OBJECT (job), "tree_iter",
                                        gtk_tree_iter_copy (&iter),