[evince] shell: Show as much text as possible for index tree



commit 5f028194ac45d626b8720a1d5d16c1f15ff89c9c
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Fri Feb 15 20:19:07 2013 -0800

    shell: Show as much text as possible for index tree
    
    Uses separated columns for index and page number in the
    sidebar for the table of contents (aka index).  This makes
    to use as much space as possible for the index column with
    a reasonable size for the page number for the most common
    cases (e.g. page number < 9999 or 'cover', 'front', 'back').
    For longer page numbers it uses ellipsis.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=676593
    
    Signed-off-by: Germán Poo-Caamaño <gpoo gnome org>

 shell/ev-sidebar-links.c |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index 050ff7d..737eb00 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -417,28 +417,29 @@ ev_sidebar_links_construct (EvSidebarLinks *ev_sidebar_links)
        gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
        gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view), column);
 
-       renderer = (GtkCellRenderer*)
-               g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
-                             "ellipsize", PANGO_ELLIPSIZE_END,
-                             NULL);
+       renderer = gtk_cell_renderer_text_new ();
+       g_object_set (G_OBJECT (renderer),
+                     "ellipsize", PANGO_ELLIPSIZE_END,
+                     NULL);
        gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), renderer, TRUE);
        gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,
                                             "markup", EV_DOCUMENT_LINKS_COLUMN_MARKUP,
                                             NULL);
 
-       renderer = (GtkCellRenderer*)
-               g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
-                             "ellipsize", PANGO_ELLIPSIZE_MIDDLE,
-                             "max-width-chars", 12,
-                             NULL);
-       gtk_tree_view_column_pack_end (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE);
+       column = gtk_tree_view_column_new ();
+       gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view), column);
+
+       renderer = gtk_cell_renderer_text_new ();
+       g_object_set (G_OBJECT (renderer),
+                     "ellipsize", PANGO_ELLIPSIZE_MIDDLE,
+                     "width-chars", 6,
+                     "style", PANGO_STYLE_ITALIC,
+                     "xalign", 1.0,
+                     NULL);
+       gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE);
        gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,
                                             "text", EV_DOCUMENT_LINKS_COLUMN_PAGE_LABEL,
                                             NULL);
-       g_object_set (G_OBJECT (renderer),
-                      "style", PANGO_STYLE_ITALIC,
-                      "xalign", 1.0,
-                      NULL);
 
        g_signal_connect (priv->tree_view,
                          "button_press_event",


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