Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Hasselmann <mathias.hasselmann@gmx.de>2006-09-24 13:35:38 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2006-09-24 13:35:38 (GMT)
commit86a8b847b01b06709b712bd0df70e9d9fad23754 (patch)
tree048a9d12e46a19aba8e8b0e7a9e70241959f982c
parentf4dc54e2c11c5e1b6c474bb4d51a3f3afe929dbf (diff)
Escape underscores in filenames of recent file items.
2006-09-24 Mathias Hasselmann <mathias.hasselmann@gmx.de> * shell/ev-window.c: (ev_window_setup_recent), (ev_window_get_recent_file_label): Escape underscores in filenames of recent file items.
-rw-r--r--ChangeLog9
-rw-r--r--shell/ev-window.c46
2 files changed, 51 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a77181..9204ff3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,16 @@
+2006-09-24 Mathias Hasselmann <mathias.hasselmann@gmx.de>
+
+ * shell/ev-window.c: (ev_window_setup_recent),
+ (ev_window_get_recent_file_label):
+
+ Escape underscores in filenames of recent file items.
+
2006-09-24 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* configure.ac:
Bumped poppler requirements, really 0.5.3 is very
- buggy, now we require 0.5.4
+ buggy, now we require 0.5.4.
2006-09-17 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
diff --git a/shell/ev-window.c b/shell/ev-window.c
index cbd504c..d10c175 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1192,6 +1192,47 @@ compare_recent_items (GtkRecentInfo *a, GtkRecentInfo *b)
}
#endif /* HAVE_GTK_RECENT */
+/*
+ * Doubles underscore to avoid spurious menu accels.
+ */
+static gchar *
+ev_window_get_recent_file_label (gint index, const gchar *filename)
+{
+ GString *str;
+ gint length;
+ const gchar *p;
+ const gchar *end;
+
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ length = strlen (filename);
+ str = g_string_sized_new (length + 10);
+ g_string_printf (str, "_%d. ", index);
+
+ p = filename;
+ end = filename + length;
+
+ while (p != end)
+ {
+ const gchar *next;
+ next = g_utf8_next_char (p);
+
+ switch (*p)
+ {
+ case '_':
+ g_string_append (str, "__");
+ break;
+ default:
+ g_string_append_len (str, p, next - p);
+ break;
+ }
+
+ p = next;
+ }
+
+ return g_string_free (str, FALSE);
+}
+
static void
ev_window_setup_recent (EvWindow *ev_window)
{
@@ -1232,9 +1273,8 @@ ev_window_setup_recent (EvWindow *ev_window)
continue;
action_name = g_strdup_printf ("RecentFile%u", i++);
- label = g_strdup_printf ("_%d. %s",
- n_items + 1,
- gtk_recent_info_get_display_name (info));
+ label = ev_window_get_recent_file_label (
+ n_items + 1, gtk_recent_info_get_display_name (info));
action = g_object_new (GTK_TYPE_ACTION,
"name", action_name,