]> www.fi.muni.cz Git - evince.git/commitdiff
Use pango ellipsisation.
authorChristian Persch <chpe@cvs.gnome.org>
Sun, 19 Jun 2005 18:20:55 +0000 (18:20 +0000)
committerChristian Persch <chpe@src.gnome.org>
Sun, 19 Jun 2005 18:20:55 +0000 (18:20 +0000)
2005-06-19  Christian Persch  <chpe@cvs.gnome.org>

* cut-n-paste/recent-files/egg-recent-view-uimanager.c:
(connect_proxy_cb), (egg_recent_view_uimanager_set_list):

Use pango ellipsisation.

* pdf/ev-poppler.cc:

Fix refcount leak, from nsh.

ChangeLog
cut-n-paste/recent-files/egg-recent-view-uimanager.c
pdf/ev-poppler.cc

index fc26f9005f2b6ce864c4dde4652f06e3e452c3b3..dc0561126c606386561be3c0e65f8d528cce2527 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-06-19  Christian Persch  <chpe@cvs.gnome.org>
+
+       * cut-n-paste/recent-files/egg-recent-view-uimanager.c:
+       (connect_proxy_cb), (egg_recent_view_uimanager_set_list):
+
+       Use pango ellipsisation.
+
+       * pdf/ev-poppler.cc:
+
+       Fix refcount leak, from nsh.
+
 2005-06-19  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * cut-n-paste/recent-files/Makefile.am:
index 1ae6f3e485ae9534f81e09d63f58f668bf2a2113..ab03426a6a98309277d1f7b71b1a92b68b1692fd 100644 (file)
@@ -43,6 +43,8 @@
 #define EGG_RECENT_ACTION "EggRecentFile"
 #define EGG_RECENT_SEPARATOR (NULL)
 
+#define LABEL_WIDTH_CHARS 32
+
 struct _EggRecentViewUIManager {
        GObject         parent_instance;
 
@@ -114,6 +116,23 @@ egg_recent_view_uimanager_clear (EggRecentViewUIManager *view)
        gtk_ui_manager_ensure_update (view->uimanager);
 }
 
+static void
+connect_proxy_cb (GtkActionGroup *action_group,
+                  GtkAction *action,
+                  GtkWidget *proxy)
+{
+        if (GTK_IS_MENU_ITEM (proxy))
+        {
+                GtkLabel *label;
+
+                label = (GtkLabel *) ((GtkBin *) proxy)->child;
+
+                gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
+                gtk_label_set_max_width_chars (label, LABEL_WIDTH_CHARS);
+        }
+}
+               
+
 static void
 egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
 {
@@ -131,7 +150,9 @@ egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
                gchar *group = g_strdup_printf ("EggRecentActions%u", 
                                                view->merge_id);
                view->action_group = gtk_action_group_new (group);
-               gtk_ui_manager_insert_action_group (view->uimanager, view->action_group, 0);
+               g_signal_connect (view->action_group, "connect-proxy",
+                                 G_CALLBACK (connect_proxy_cb), view);
+               gtk_ui_manager_insert_action_group (view->uimanager, view->action_group, -1);
                g_free (group);
        }
 
@@ -155,7 +176,6 @@ egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
                gchar         *uri;
                gchar         *basename;
                gchar         *escaped;
-               gchar         *ellipsized;
                gchar         *label;
                gchar         *tooltip = NULL;
 
@@ -174,26 +194,19 @@ egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
                escaped = egg_recent_util_escape_underlines (basename);
                g_free (basename);
                g_free (uri);
-           
-               if (strlen (escaped) > 40) {
-                       ellipsized = g_strdup_printf ("%.40s...", escaped);
-                       g_free (escaped);
-               } else {        
-                       ellipsized = escaped;
-               }
 
                if (view->show_numbers) {
                        if (index >= 10)
                                label = g_strdup_printf ("%d.  %s", 
                                                         index, 
-                                                        ellipsized);
+                                                        escaped);
                        else
                                label = g_strdup_printf ("_%d.  %s", 
                                                         index, 
-                                                        ellipsized);
-                       g_free (ellipsized);
+                                                        escaped);
+                       g_free (escaped);
                } else 
-                       label = ellipsized;
+                       label = basename;
 
                action = g_object_new (GTK_TYPE_ACTION,
                                       "name", name,
index 90bae3ae3251643e8957636a7b28bc12e21c3e66..cfb745d0b51cfdd3d5df4e2eb5fbaea70cf26f1c 100644 (file)
@@ -732,6 +732,7 @@ build_tree (PdfDocument      *pdf_document,
                                            EV_DOCUMENT_LINKS_COLUMN_LINK, link,
                                            EV_DOCUMENT_LINKS_COLUMN_EXPAND, expand,
                                            -1);
+                       g_object_unref (link);
                        child = poppler_index_iter_get_child (iter);
                        if (child)
                                build_tree (pdf_document, model, &tree_iter, child);