#endif
#include <string.h>
-#include <gtk/gtk.h>
+
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#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
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);
}
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),
/* 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,
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);
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
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);
static gboolean
ev_sidebar_thumbnails_clear_job (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
gpointer data)
{
EvJob *job;
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);
}