[gimp] app: Escape the file names in export menu items



commit 9359c5d44fa8e0af467501963b047c0fdbe1e2ef
Author: Martin Nordholts <martinn src gnome org>
Date:   Thu Sep 3 20:13:21 2009 +0200

    app: Escape the file names in export menu items
    
    We need to escape _ in the filenames we use for the 'Overwrite' and
    'Export to' menu items, otherwise they show up as mnemonics.

 app/actions/file-actions.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index 1abf802..53cc8e9 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -62,6 +62,8 @@ static void   file_actions_last_opened_reorder (GimpContainer   *container,
 static void   file_actions_close_all_update    (GimpContainer   *images,
                                                 GimpObject      *unused,
                                                 GimpActionGroup *group);
+static gchar *file_actions_create_label        (const gchar     *format,
+                                                const gchar     *uri);
 
 
 static const GimpActionEntry file_actions[] =
@@ -287,19 +289,16 @@ file_actions_update (GimpActionGroup *group,
 
   if (export_to)
     {
-      gchar *label;
-      label = g_strdup_printf (_("Export to %s"),
-                               file_utils_uri_display_basename (export_to));
+      gchar *label = file_actions_create_label(_("Export to %s"), export_to);
       gimp_action_group_set_action_label (group, "file-export-to", label);
       g_free (label);
     }
   else if (show_overwrite)
     {
-      gchar *label;
-      label = g_strdup_printf (_("Overwrite %s"),
-                               file_utils_uri_display_basename (source));
+      gchar *label = file_actions_create_label (_("Overwrite %s"), source);
       gimp_action_group_set_action_label (group, "file-overwrite", label);
       g_free (label);
+
     }
   else
     {
@@ -410,3 +409,17 @@ file_actions_close_all_update (GimpContainer   *images,
 
   gimp_action_group_set_action_sensitive (group, "file-close-all", sensitive);
 }
+
+static gchar *
+file_actions_create_label (const gchar     *format,
+                           const gchar     *uri)
+{
+  gchar *basename         = file_utils_uri_display_basename (uri);
+  gchar *escaped_basename = gimp_escape_uline (basename);
+  gchar *label            = g_strdup_printf (format, escaped_basename);
+
+  g_free (escaped_basename);
+  g_free (basename);
+
+  return label;
+}



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