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=4aaeebab191409a8b5cc404b8527859b6fb64c9a;hb=df408ff0086984d7c067ea31f298c0aad002b2e6;hp=16fe37661510768acdefe8bc20fd348c8e14e728;hpb=f020f9ced6dfd3efadab6add9665066a4bd03a5f;p=evince.git diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 16fe3766..4aaeebab 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -91,14 +91,14 @@ enum { PROP_WIDGET, }; -static void ev_sidebar_thumbnails_clear_model (EvSidebarThumbnails *sidebar); -static gboolean ev_sidebar_thumbnails_support_document (EvSidebarPage *sidebar_page, - EvDocument *document); -static void ev_sidebar_thumbnails_page_iface_init (EvSidebarPageIface *iface); -static const gchar* ev_sidebar_thumbnails_get_label (EvSidebarPage *sidebar_page); -static void thumbnail_job_completed_callback (EvJobThumbnail *job, - EvSidebarThumbnails *sidebar_thumbnails); -static void adjustment_changed_cb (EvSidebarThumbnails *sidebar_thumbnails); +static void ev_sidebar_thumbnails_clear_model (EvSidebarThumbnails *sidebar); +static gboolean ev_sidebar_thumbnails_support_document (EvSidebarPage *sidebar_page, + EvDocument *document); +static void ev_sidebar_thumbnails_page_iface_init (EvSidebarPageInterface *iface); +static const gchar* ev_sidebar_thumbnails_get_label (EvSidebarPage *sidebar_page); +static void thumbnail_job_completed_callback (EvJobThumbnail *job, + EvSidebarThumbnails *sidebar_thumbnails); +static void adjustment_changed_cb (EvSidebarThumbnails *sidebar_thumbnails); G_DEFINE_TYPE_EXTENDED (EvSidebarThumbnails, ev_sidebar_thumbnails, @@ -332,15 +332,18 @@ ev_sidebar_thumbnails_get_loading_icon (EvSidebarThumbnails *sidebar_thumbnails, gint width, gint height) { + EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv; GdkPixbuf *icon; gchar *key; key = g_strdup_printf ("%dx%d", width, height); - icon = g_hash_table_lookup (sidebar_thumbnails->priv->loading_icons, key); + icon = g_hash_table_lookup (priv->loading_icons, key); if (!icon) { - icon = ev_document_misc_get_thumbnail_frame (width, height, NULL); - g_hash_table_insert (sidebar_thumbnails->priv->loading_icons, - key, icon); + gboolean inverted_colors; + + inverted_colors = ev_document_model_get_inverted_colors (priv->model); + icon = ev_document_misc_get_loading_thumbnail (width, height, inverted_colors); + g_hash_table_insert (priv->loading_icons, key, icon); } else { g_free (key); } @@ -499,25 +502,31 @@ adjustment_changed_cb (EvSidebarThumbnails *sidebar_thumbnails) EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv; GtkTreePath *path = NULL; GtkTreePath *path2 = NULL; + gdouble page_size; + gdouble value; gint wy1; gint wy2; /* Widget is not currently visible */ - if (!GTK_WIDGET_MAPPED (sidebar_thumbnails)) + if (!gtk_widget_get_mapped (GTK_WIDGET (sidebar_thumbnails))) return; - if (priv->vadjustment->page_size == 0) + page_size = gtk_adjustment_get_page_size (priv->vadjustment); + + if (page_size == 0) return; + + value = gtk_adjustment_get_value (priv->vadjustment); if (priv->tree_view) { if (! gtk_widget_get_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, + 0, (int) 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), + 0, (int) (value + page_size), NULL, &wy2); gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->tree_view), 1, wy1 + 1, &path, @@ -957,7 +966,7 @@ ev_sidebar_thumbnails_get_label (EvSidebarPage *sidebar_page) } static void -ev_sidebar_thumbnails_page_iface_init (EvSidebarPageIface *iface) +ev_sidebar_thumbnails_page_iface_init (EvSidebarPageInterface *iface) { iface->support_document = ev_sidebar_thumbnails_support_document; iface->set_model = ev_sidebar_thumbnails_set_model;