X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-sidebar-thumbnails.c;h=2850514bc6345160c9d4764030c70b76864f730b;hb=94cb89c0c9cbefaadaa067062fe7ea461f9a8d64;hp=25b1b838e0820f49eae06733aba20264b9a9bd55;hpb=b8aebf2e1ba5b4f9ff1e1256b28acb3e23947c51;p=evince.git diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 25b1b838..2850514b 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -27,16 +27,17 @@ #endif #include -#include + #include +#include +#include "ev-document-misc.h" +#include "ev-document-thumbnails.h" +#include "ev-job-scheduler.h" #include "ev-sidebar-page.h" #include "ev-sidebar-thumbnails.h" -#include "ev-document-thumbnails.h" -#include "ev-document-misc.h" -#include "ev-job-queue.h" -#include "ev-window.h" #include "ev-utils.h" +#include "ev-window.h" #define THUMBNAIL_WIDTH 100 @@ -207,7 +208,7 @@ clear_range (EvSidebarThumbnails *sidebar_thumbnails, if (job) { g_signal_handlers_disconnect_by_func (job, thumbnail_job_completed_callback, sidebar_thumbnails); - ev_job_queue_remove_job (EV_JOB (job)); + ev_job_cancel (EV_JOB (job)); g_object_unref (job); } @@ -263,7 +264,7 @@ add_range (EvSidebarThumbnails *sidebar_thumbnails, job = ev_job_thumbnail_new (priv->document, page, priv->rotation, get_scale_for_page (sidebar_thumbnails, page)); - ev_job_queue_add_job (EV_JOB (job), EV_JOB_PRIORITY_HIGH); + ev_job_scheduler_push_job (EV_JOB (job), EV_JOB_PRIORITY_HIGH); g_object_set_data_full (G_OBJECT (job), "tree_iter", gtk_tree_iter_copy (&iter), @@ -325,18 +326,21 @@ adjustment_changed_cb (EvSidebarThumbnails *sidebar_thumbnails) /* Widget is not currently visible */ if (!GTK_WIDGET_MAPPED (sidebar_thumbnails)) return; + + if (priv->vadjustment->page_size == 0) + return; if (priv->tree_view) { if (! GTK_WIDGET_REALIZED (priv->tree_view)) return; #if GTK_CHECK_VERSION (2, 11, 3) - gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW (priv->tree_view), - 0, (int) priv->vadjustment->value, - NULL, &wy1); - gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW (priv->tree_view), - 0, (int) (priv->vadjustment->value + priv->vadjustment->page_size), - NULL, &wy2); + 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); #else gtk_tree_view_tree_to_widget_coords (GTK_TREE_VIEW (priv->tree_view), 0, (int) priv->vadjustment->value, @@ -345,7 +349,7 @@ adjustment_changed_cb (EvSidebarThumbnails *sidebar_thumbnails) 0, (int) (priv->vadjustment->value + priv->vadjustment->page_size), NULL, &wy2); #endif /* GTK_CHECK_VERSION (2, 11, 3) */ - + gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->tree_view), 1, wy1 + 1, &path, NULL, NULL, NULL); @@ -403,7 +407,8 @@ ev_sidebar_thumbnails_set_loading_icon (EvSidebarThumbnails *sidebar_thumbnails) if (sidebar_thumbnails->priv->loading_icon) g_object_unref (sidebar_thumbnails->priv->loading_icon); - if (sidebar_thumbnails->priv->document) { + if (sidebar_thumbnails->priv->document && + sidebar_thumbnails->priv->n_pages > 0) { gint width, height; /* We get the dimensions of the first page so that we can make a blank @@ -434,7 +439,8 @@ ev_sidebar_thumbnails_refresh (EvSidebarThumbnails *sidebar_thumbnails, sidebar_thumbnails->priv->rotation = rotation; ev_sidebar_thumbnails_set_loading_icon (sidebar_thumbnails); - if (sidebar_thumbnails->priv->document == NULL) + if (sidebar_thumbnails->priv->document == NULL || + sidebar_thumbnails->priv->n_pages <= 0) return; ev_sidebar_thumbnails_clear_model (sidebar_thumbnails); @@ -686,8 +692,8 @@ ev_sidebar_thumbnails_set_document (EvSidebarPage *sidebar_page, static gboolean ev_sidebar_thumbnails_clear_job (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, + GtkTreePath *path, + GtkTreeIter *iter, gpointer data) { EvJob *job; @@ -695,7 +701,7 @@ ev_sidebar_thumbnails_clear_job (GtkTreeModel *model, gtk_tree_model_get (model, iter, COLUMN_JOB, &job, -1); if (job != NULL) { - ev_job_queue_remove_job (job); + ev_job_cancel (job); g_signal_handlers_disconnect_by_func (job, thumbnail_job_completed_callback, data); g_object_unref (job); }