summaryrefslogtreecommitdiff
path: root/shell/ev-sidebar-thumbnails.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-01-24 17:17:33 +0100
committerStefano Karapetsas <[email protected]>2014-01-24 17:17:33 +0100
commitf79ae5a34a725c8b5aa8266067d44a78397adc34 (patch)
tree5f1c8a325892d10bce1f8b2877f25f8422159962 /shell/ev-sidebar-thumbnails.c
parent8fff1e948b7d1862c2783cbe2603cb103a400133 (diff)
downloadatril-f79ae5a34a725c8b5aa8266067d44a78397adc34.tar.bz2
atril-f79ae5a34a725c8b5aa8266067d44a78397adc34.tar.xz
Fix thumbnails sidebar resizing issues with GTK3
Closes #58 https://github.com/mate-desktop/atril/issues/58 https://git.gnome.org/browse/evince/commit/shell/ev-sidebar-thumbnails.c?id=a621f05b42468606c8a04446d54b637ecdd05c9b https://git.gnome.org/browse/evince/commit/shell/ev-sidebar-thumbnails.c?id=1e88e7fd7630c28453475e48b98941ce11b130a6
Diffstat (limited to 'shell/ev-sidebar-thumbnails.c')
-rw-r--r--shell/ev-sidebar-thumbnails.c31
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));