diff options
-rw-r--r-- | shell/ev-sidebar-thumbnails.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 913d8504..ec03d998 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -669,12 +669,37 @@ static void ev_sidebar_init_icon_view (EvSidebarThumbnails *ev_sidebar_thumbnails) { EvSidebarThumbnailsPrivate *priv; +#if GTK_CHECK_VERSION (3, 0, 0) + GtkCellRenderer *renderer; +#endif priv = ev_sidebar_thumbnails->priv; priv->icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (priv->list_store)); +#if GTK_CHECK_VERSION (3, 0, 0) + renderer = g_object_new (GTK_TYPE_CELL_RENDERER_PIXBUF, + "xalign", 0.5, + "yalign", 1.0, + NULL); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->icon_view), renderer, FALSE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->icon_view), + renderer, "pixbuf", 1, NULL); + + renderer = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, + "alignment", PANGO_ALIGN_CENTER, + "wrap-mode", PANGO_WRAP_WORD_CHAR, + "xalign", 0.5, + "yalign", 0.0, + "width", THUMBNAIL_WIDTH, + "wrap-width", THUMBNAIL_WIDTH, + NULL); + gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (priv->icon_view), renderer, FALSE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->icon_view), + renderer, "markup", 0, NULL); +#else gtk_icon_view_set_markup_column (GTK_ICON_VIEW (priv->icon_view), 0); gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (priv->icon_view), 1); +#endif g_signal_connect (priv->icon_view, "selection-changed", G_CALLBACK (ev_sidebar_icon_selection_changed), ev_sidebar_thumbnails); @@ -706,10 +731,14 @@ ev_sidebar_thumbnails_init (EvSidebarThumbnails *ev_sidebar_thumbnails) priv->swindow = gtk_scrolled_window_new (NULL, NULL); /* We actually don't want GTK_POLICY_AUTOMATIC for horizontal scrollbar here - * it's just a workaround for bug #449462 + * it's just a workaround for bug #449462 (GTK2 only) */ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->swindow), +#if GTK_CHECK_VERSION (3, 0, 0) + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); +#else GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); +#endif gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->swindow), GTK_SHADOW_IN); priv->vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->swindow)); |