From a6f92ce4b04abd38bc56b4080b48879ae6022ab3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 13 Jul 2007 16:34:05 +0000 Subject: [PATCH] Avoid gratitious use of g_strdup_printf(). 2007-07-13 Matthias Clasen * gtk/gtkrecentmanager.c (get_uri_shortname_for_display): Avoid gratitious use of g_strdup_printf(). * gtk/gtkrecentchooserdefault.c: * gtk/gtkrecentchoosermenu.c: Mark some strings for translation. (#439480, Murray Cumming) svn path=/trunk/; revision=18465 --- ChangeLog | 9 +++++++++ gtk/gtkrecentchooserdefault.c | 2 +- gtk/gtkrecentchoosermenu.c | 16 ++++++++++++++-- gtk/gtkrecentmanager.c | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ddac1f156..3cbd19927a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-07-13 Matthias Clasen + + * gtk/gtkrecentmanager.c (get_uri_shortname_for_display): Avoid + gratitious use of g_strdup_printf(). + + * gtk/gtkrecentchooserdefault.c: + * gtk/gtkrecentchoosermenu.c: Mark some strings for + translation. (#439480, Murray Cumming) + 2007-07-13 Kristian Rietveld #408327, improve tooltip positioning. diff --git a/gtk/gtkrecentchooserdefault.c b/gtk/gtkrecentchooserdefault.c index c1a3ff7231..60d5566856 100644 --- a/gtk/gtkrecentchooserdefault.c +++ b/gtk/gtkrecentchooserdefault.c @@ -1272,7 +1272,7 @@ gtk_recent_chooser_default_add_filter (GtkRecentChooser *chooser, /* display new filter */ name = gtk_recent_filter_get_name (filter); if (!name) - name = "Untitled filter"; + name = _("Untitled filter"); gtk_combo_box_append_text (GTK_COMBO_BOX (impl->filter_combo), name); diff --git a/gtk/gtkrecentchoosermenu.c b/gtk/gtkrecentchoosermenu.c index 8720bcd82b..b7c479d5f6 100644 --- a/gtk/gtkrecentchoosermenu.c +++ b/gtk/gtkrecentchoosermenu.c @@ -795,9 +795,21 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu, /* avoid clashing mnemonics */ if (count <= 10) - text = g_strdup_printf ("_%d. %s", count, escaped); + /* This is the label format that is used for the first 10 items + * in a recent files menu. The %d is the number of the item, + * the %s is the name of the item. Please keep the _ in front + * of the number to give these menu items a mnemonic. + * + * Don't include the prefix "recent menu label|" in the translation. + */ + text = g_strdup_printf (Q_("recent menu label|_%d. %s"), count, escaped); else - text = g_strdup_printf ("%d. %s", count, escaped); + /* This is the format that is used for items in a recent files menu. + * The %d is the number of the item, the %s is the name of the item. + * + * Don't include the prefix "recent menu label|" in the translation. + */ + text = g_strdup_printf (Q_("recent menu label|%d. %s"), count, escaped); item = gtk_image_menu_item_new_with_mnemonic (text); diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c index aeb3055195..e9bfa2d469 100644 --- a/gtk/gtkrecentmanager.c +++ b/gtk/gtkrecentmanager.c @@ -2136,7 +2136,7 @@ get_uri_shortname_for_display (const gchar *uri) rest = get_method_string (uri, &method); local_file = g_filename_display_basename (rest); - name = g_strdup_printf ("%s: %s", method, local_file); + name = g_strconcat (method, ": ", local_file, NULL); g_free (local_file); g_free (method);