[gimp] file-export* labels and actions renamed.



commit 4b14ed2e5e0c5a83df361814c4c8286079f60989
Author: Jehan <jehan girinstud io>
Date:   Wed Nov 13 15:15:45 2013 +1300

    file-export* labels and actions renamed.
    
    Follows updated save+export specification.
    For renamed actions (file-export and file-export-to respectively to
    file-export-as and file-export to mimick file-save*), menurc from
    GIMP 2.8 will be correctly migrated.

 app/actions/actions-types.h    |    2 +-
 app/actions/file-actions.c     |   27 +++++++++++------------
 app/actions/file-commands.c    |   10 ++++----
 app/core/gimp-user-install.c   |   46 +++++++++++++++++++++++++++------------
 app/dialogs/file-save-dialog.c |    2 +-
 app/widgets/gimphelp-ids.h     |    2 +-
 menus/image-menu.xml.in        |    4 +-
 7 files changed, 55 insertions(+), 38 deletions(-)
---
diff --git a/app/actions/actions-types.h b/app/actions/actions-types.h
index 0c30322..3f6f96d 100644
--- a/app/actions/actions-types.h
+++ b/app/actions/actions-types.h
@@ -46,7 +46,7 @@ typedef enum
   GIMP_SAVE_MODE_SAVE_A_COPY,
   GIMP_SAVE_MODE_SAVE_AND_CLOSE,
   GIMP_SAVE_MODE_EXPORT,
-  GIMP_SAVE_MODE_EXPORT_TO,
+  GIMP_SAVE_MODE_EXPORT_AS,
   GIMP_SAVE_MODE_OVERWRITE
 } GimpSaveMode;
 
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index 45185a2..8271f19 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -142,11 +142,11 @@ static const GimpEnumActionEntry file_save_actions[] =
     GIMP_SAVE_MODE_SAVE_AND_CLOSE, FALSE,
     GIMP_HELP_FILE_SAVE },
 
-  { "file-export-to", NULL,
-    NC_("file-action", "Export to"), "<primary>E",
+  { "file-export", NULL,
+    NC_("file-action", "Export"), "<primary>E",
     NC_("file-action", "Export the image again"),
-    GIMP_SAVE_MODE_EXPORT_TO, FALSE,
-    GIMP_HELP_FILE_EXPORT_TO },
+    GIMP_SAVE_MODE_EXPORT, FALSE,
+    GIMP_HELP_FILE_EXPORT },
 
   { "file-overwrite", NULL,
     NC_("file-action", "Over_write"), "",
@@ -154,11 +154,11 @@ static const GimpEnumActionEntry file_save_actions[] =
     GIMP_SAVE_MODE_OVERWRITE, FALSE,
     GIMP_HELP_FILE_OVERWRITE },
 
-  { "file-export", NULL,
-    NC_("file-action", "Export..."), "<primary><shift>E",
+  { "file-export-as", NULL,
+    NC_("file-action", "Export As..."), "<primary><shift>E",
     NC_("file-action", "Export the image to various file formats such as PNG or JPEG"),
-    GIMP_SAVE_MODE_EXPORT, FALSE,
-    GIMP_HELP_FILE_EXPORT }
+    GIMP_SAVE_MODE_EXPORT_AS, FALSE,
+    GIMP_HELP_FILE_EXPORT_AS }
 };
 
 void
@@ -280,17 +280,17 @@ file_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("file-save-as",         drawable);
   SET_SENSITIVE ("file-save-a-copy",     drawable);
   SET_SENSITIVE ("file-revert",          image && (gimp_image_get_uri (image) || source));
-  SET_SENSITIVE ("file-export-to",       drawable);
-  SET_VISIBLE   ("file-export-to",       ! show_overwrite);
+  SET_SENSITIVE ("file-export",          drawable);
+  SET_VISIBLE   ("file-export",          ! show_overwrite);
   SET_SENSITIVE ("file-overwrite",       show_overwrite);
   SET_VISIBLE   ("file-overwrite",       show_overwrite);
-  SET_SENSITIVE ("file-export",          drawable);
+  SET_SENSITIVE ("file-export-as",       drawable);
   SET_SENSITIVE ("file-create-template", image);
 
   if (export)
     {
       gchar *label = file_actions_create_label (_("Export to %s"), export);
-      gimp_action_group_set_action_label (group, "file-export-to", label);
+      gimp_action_group_set_action_label (group, "file-export", label);
       g_free (label);
     }
   else if (show_overwrite)
@@ -298,12 +298,11 @@ file_actions_update (GimpActionGroup *group,
       gchar *label = file_actions_create_label (_("Over_write %s"), source);
       gimp_action_group_set_action_label (group, "file-overwrite", label);
       g_free (label);
-
     }
   else
     {
       gimp_action_group_set_action_label (group,
-                                          "file-export-to", _("Export to"));
+                                          "file-export", _("Export"));
     }
 
   /*  needed for the empty display  */
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 9ca2f62..47d983b 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -286,24 +286,24 @@ file_save_cmd_callback (GtkAction *action,
                              FALSE, display);
       break;
 
-    case GIMP_SAVE_MODE_EXPORT:
+    case GIMP_SAVE_MODE_EXPORT_AS:
       file_export_dialog_show (gimp, image, widget);
       break;
 
-    case GIMP_SAVE_MODE_EXPORT_TO:
+    case GIMP_SAVE_MODE_EXPORT:
     case GIMP_SAVE_MODE_OVERWRITE:
       {
         const gchar         *uri = NULL;
         GimpPlugInProcedure *export_proc;
-        gboolean             overwrite;
+        gboolean             overwrite = FALSE;
 
-        if (save_mode == GIMP_SAVE_MODE_EXPORT_TO)
+        if (save_mode == GIMP_SAVE_MODE_EXPORT)
           {
             uri = gimp_image_get_exported_uri (image);
 
             if (! uri)
               {
-                /* Behave as if Export... was invoked */
+                /* Behave as if Export As... was invoked */
                 file_export_dialog_show (gimp, image, widget);
                 break;
               }
diff --git a/app/core/gimp-user-install.c b/app/core/gimp-user-install.c
index 3b4280c..fc5cd7c 100644
--- a/app/core/gimp-user-install.c
+++ b/app/core/gimp-user-install.c
@@ -439,20 +439,21 @@ user_install_mkdir_with_parents (GimpUserInstall *install,
   return TRUE;
 }
 
-/* The regexp pattern of all options changed from previous menurc.
+/* The regexp pattern of all options changed from menurc of GIMP 2.8.
  * Add any pattern that we want to recognize for replacement in the menurc of
  * the next release*/
-#define MENURC_OVER20_UPDATE_PATTERN "NOMATCH^"
+#define MENURC_28_UPDATE_PATTERN "\"<Actions>/file/file-export-to\"|" \
+                                 "\"<Actions>/file/file-export\""
 
 /**
- * callback to use for updating any change value in the menurc.
+ * callback to use for updating a menurc from GIMP 2.8.
  * data is unused (always NULL).
  * The updated value will be matched line by line.
  */
 static gboolean
-user_update_menurc_over20 (const GMatchInfo *matched_value,
-                           GString          *new_value,
-                           gpointer          data)
+user_update_menurc_28 (const GMatchInfo *matched_value,
+                       GString          *new_value,
+                       gpointer          data)
 {
   gchar *match;
   match = g_match_info_fetch (matched_value, 0);
@@ -462,10 +463,21 @@ user_update_menurc_over20 (const GMatchInfo *matched_value,
 
   if (strcmp (match, "\"<Actions>/view/view-close\"") == 0)
     g_string_append (new_value, "\"<Actions>/file/file-close\"");
-  else
   */
-  /* Should not happen. Just in case we match something unexpected by mistake. */
-  g_string_append (new_value, match);
+
+  if (strcmp (match, "\"<Actions>/file/file-export\"") == 0)
+    {
+      g_string_append (new_value, "\"<Actions>/file/file-export-as\"");
+    }
+  else if (strcmp (match, "\"<Actions>/file/file-export-to\"") == 0)
+    {
+      g_string_append (new_value, "\"<Actions>/file/file-export\"");
+    }
+  else
+    {
+      /* Should not happen. Just in case we match something unexpected by mistake. */
+      g_string_append (new_value, match);
+    }
 
   g_free (match);
   return FALSE;
@@ -624,11 +636,17 @@ user_install_migrate_files (GimpUserInstall *install)
 
           if (strcmp (basename, "menurc") == 0)
             {
-              /*  skip menurc for gimp 2.0 as the format has changed  */
-              if (install->old_minor == 0)
-                goto next_file;
-              update_pattern = MENURC_OVER20_UPDATE_PATTERN;
-              update_callback = user_update_menurc_over20;
+              switch (install->old_minor)
+                {
+                case 0:
+                  /*  skip menurc for gimp 2.0 as the format has changed  */
+                  goto next_file;
+                  break;
+                case 8:
+                  update_pattern = MENURC_28_UPDATE_PATTERN;
+                  update_callback = user_update_menurc_28;
+                  break;
+                }
             }
 
           g_snprintf (dest, sizeof (dest), "%s%c%s",
diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index 8b0873f..8ed3cc3 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -112,7 +112,7 @@ file_save_dialog_new (Gimp     *gimp,
                                      GIMP_FILE_CHOOSER_ACTION_EXPORT,
                                      _("Export Image"), "gimp-file-export",
                                      _("_Export"),
-                                     GIMP_HELP_FILE_EXPORT);
+                                     GIMP_HELP_FILE_EXPORT_AS);
 
       state = g_object_get_data (G_OBJECT (gimp), "gimp-file-export-dialog-state");
     }
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 5ac07de..e3cd977 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -35,7 +35,7 @@
 #define GIMP_HELP_FILE_SAVE_A_COPY                "gimp-file-save-a-copy"
 #define GIMP_HELP_FILE_SAVE_BY_EXTENSION          "gimp-file-save-by-extension"
 #define GIMP_HELP_FILE_EXPORT                     "gimp-file-export"
-#define GIMP_HELP_FILE_EXPORT_TO                  "gimp-file-export-to"
+#define GIMP_HELP_FILE_EXPORT_AS                  "gimp-file-export-as"
 #define GIMP_HELP_FILE_OVERWRITE                  "gimp-file-overwrite"
 #define GIMP_HELP_FILE_SAVE_AS_TEMPLATE           "gimp-file-save-as-template"
 #define GIMP_HELP_FILE_REVERT                     "gimp-file-revert"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 33e2a48..61c059a 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -43,9 +43,9 @@
       <menuitem action="file-revert" />
       <separator />
       <placeholder name="Export">
-        <menuitem action="file-export-to" />
-        <menuitem action="file-overwrite" />
         <menuitem action="file-export" />
+        <menuitem action="file-export-as" />
+        <menuitem action="file-overwrite" />
       </placeholder>
       <menuitem action="file-create-template" />
       <separator />


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