[evince] sidebar: Use custom cell renderers for the thumbnails icon view



commit 1e88e7fd7630c28453475e48b98941ce11b130a6
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Sep 30 12:53:03 2012 +0200

    sidebar: Use custom cell renderers for the thumbnails icon view
    
    This is a workaround for the huge selection rectangle around thumbnails
    since GTK+ 3.0.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646055

 shell/ev-sidebar-thumbnails.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index 594ebce..9c2085b 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -643,12 +643,31 @@ static void
 ev_sidebar_init_icon_view (EvSidebarThumbnails *ev_sidebar_thumbnails)
 {
 	EvSidebarThumbnailsPrivate *priv;
+        GtkCellRenderer *renderer;
 
 	priv = ev_sidebar_thumbnails->priv;
 
 	priv->icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (priv->list_store));
-	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);
+
+        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);
 	g_signal_connect (priv->icon_view, "selection-changed",
 			  G_CALLBACK (ev_sidebar_icon_selection_changed), ev_sidebar_thumbnails);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]