static const gchar* ev_sidebar_thumbnails_get_label (EvSidebarPage *sidebar_page);
static void thumbnail_job_completed_callback (EvJobThumbnail *job,
EvSidebarThumbnails *sidebar_thumbnails);
static const gchar* ev_sidebar_thumbnails_get_label (EvSidebarPage *sidebar_page);
static void thumbnail_job_completed_callback (EvJobThumbnail *job,
EvSidebarThumbnails *sidebar_thumbnails);
case PROP_WIDGET:
if (sidebar->priv->tree_view)
g_value_set_object (value, sidebar->priv->tree_view);
case PROP_WIDGET:
if (sidebar->priv->tree_view)
g_value_set_object (value, sidebar->priv->tree_view);
+static void
+ev_sidebar_thumbnails_map (GtkWidget *widget)
+{
+ EvSidebarThumbnails *sidebar;
+
+ sidebar = EV_SIDEBAR_THUMBNAILS (widget);
+
+ GTK_WIDGET_CLASS (ev_sidebar_thumbnails_parent_class)->map (widget);
+
+ adjustment_changed_cb (sidebar);
+}
+
static void
ev_sidebar_thumbnails_class_init (EvSidebarThumbnailsClass *ev_sidebar_thumbnails_class)
{
GObjectClass *g_object_class;
GtkObjectClass *gtk_object_class;
static void
ev_sidebar_thumbnails_class_init (EvSidebarThumbnailsClass *ev_sidebar_thumbnails_class)
{
GObjectClass *g_object_class;
GtkObjectClass *gtk_object_class;
g_object_class = G_OBJECT_CLASS (ev_sidebar_thumbnails_class);
gtk_object_class = GTK_OBJECT_CLASS (ev_sidebar_thumbnails_class);
g_object_class = G_OBJECT_CLASS (ev_sidebar_thumbnails_class);
gtk_object_class = GTK_OBJECT_CLASS (ev_sidebar_thumbnails_class);
g_object_class->dispose = ev_sidebar_thumbnails_dispose;
g_object_class->get_property = ev_sidebar_thumbnails_get_property;
g_object_class->dispose = ev_sidebar_thumbnails_dispose;
g_object_class->get_property = ev_sidebar_thumbnails_get_property;
+static gdouble
+get_scale_for_page (EvSidebarThumbnails *sidebar_thumbnails,
+ gint page)
+{
+ EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv;
+ gint width, height;
+
+ ev_page_cache_get_size (priv->page_cache,
+ page, priv->rotation,
+ 1.0, &width, &height);
+
+ return (gdouble)THUMBNAIL_WIDTH / (gdouble)width;
+}
+
for (result = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->list_store), &iter, path);
result && page <= end_page;
result = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->list_store), &iter), page ++) {
for (result = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->list_store), &iter, path);
result && page <= end_page;
result = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->list_store), &iter), page ++) {
- /* FIXME: Need rotation */
- job = (EvJobThumbnail *)ev_job_thumbnail_new (priv->document, page, priv->rotation, THUMBNAIL_WIDTH);
+ EvRenderContext *rc;
+
+ rc = ev_render_context_new (priv->rotation, page,
+ get_scale_for_page (sidebar_thumbnails, page));
+ job = ev_job_thumbnail_new (priv->document, rc);
g_object_set_data_full (G_OBJECT (job), "tree_iter",
gtk_tree_iter_copy (&iter),
(GDestroyNotify) gtk_tree_iter_free);
g_object_set_data_full (G_OBJECT (job), "tree_iter",
gtk_tree_iter_copy (&iter),
(GDestroyNotify) gtk_tree_iter_free);
- 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]);
+ if (path && path2) {
+ update_visible_range (sidebar_thumbnails,
+ gtk_tree_path_get_indices (path)[0],
+ gtk_tree_path_get_indices (path2)[0]);
+ }
if (sidebar_thumbnails->priv->loading_icon)
g_object_unref (sidebar_thumbnails->priv->loading_icon);
if (sidebar_thumbnails->priv->document) {
if (sidebar_thumbnails->priv->loading_icon)
g_object_unref (sidebar_thumbnails->priv->loading_icon);
if (sidebar_thumbnails->priv->document) {
- /* We get the dimensions of the first doc so that we can make a blank
+ gint width = THUMBNAIL_WIDTH;
+ gint height;
+ gint page_width, page_height;
+
+ /* We get the dimensions of the first page so that we can make a blank
- ev_document_doc_mutex_lock ();
- ev_document_thumbnails_get_dimensions (EV_DOCUMENT_THUMBNAILS (sidebar_thumbnails->priv->document),
- 0, THUMBNAIL_WIDTH, &width, &height);
- ev_document_doc_mutex_unlock ();
+ ev_page_cache_get_size (sidebar_thumbnails->priv->page_cache, 0,
+ sidebar_thumbnails->priv->rotation,
+ 1.0, &page_width, &page_height);
+
+ height = (gint) (page_height * ((gdouble)width / page_width));
+
- ev_document_misc_get_thumbnail_frame (width, height, sidebar_thumbnails->priv->rotation, NULL);
+ ev_document_misc_get_thumbnail_frame (width, height, NULL);
gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE);
gtk_tree_view_scroll_to_cell (tree_view, path, NULL, FALSE, 0.0, 0.0);
} else if (sidebar->priv->icon_view) {
gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE);
gtk_tree_view_scroll_to_cell (tree_view, path, NULL, FALSE, 0.0, 0.0);
} else if (sidebar->priv->icon_view) {
gtk_icon_view_set_cursor (GTK_ICON_VIEW (sidebar->priv->icon_view), path, NULL, FALSE);
}
gtk_icon_view_set_cursor (GTK_ICON_VIEW (sidebar->priv->icon_view), path, NULL, FALSE);
}
g_signal_connect (priv->page_cache, "page-changed", G_CALLBACK (page_changed_cb), sidebar_thumbnails);
sidebar_thumbnails->priv->start_page = 0;
sidebar_thumbnails->priv->end_page = 0;
g_signal_connect (priv->page_cache, "page-changed", G_CALLBACK (page_changed_cb), sidebar_thumbnails);
sidebar_thumbnails->priv->start_page = 0;
sidebar_thumbnails->priv->end_page = 0;