[gimp] app: Make 'Export to' fall back to 'Export...'



commit c73bdc097188a926f01062a009f9f22ff32dad4e
Author: Martin Nordholts <martinn src gnome org>
Date:   Thu Jun 30 23:44:50 2011 +0200

    app: Make 'Export to' fall back to 'Export...'
    
    Make 'Export to' always sensitive (as long as there is an image at
    all). And make it fall back to 'Export...' if no export target has
    been set yet. Note that it is not necessarily visible at all times,
    sometimes 'Overwrite' shadows it. It shall still be invokable though.
    
    Reference:
    [Gimp-developer] Isn't this behaviour unintuative?
    http://lists.xcf.berkeley.edu/lists/gimp-developer/2011-June/026885.html

 app/actions/actions-types.h |    3 ++-
 app/actions/file-actions.c  |    6 +++---
 app/actions/file-commands.c |   20 ++++++++++++++++----
 3 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/app/actions/actions-types.h b/app/actions/actions-types.h
index cd86f96..0c30322 100644
--- a/app/actions/actions-types.h
+++ b/app/actions/actions-types.h
@@ -46,7 +46,8 @@ typedef enum
   GIMP_SAVE_MODE_SAVE_A_COPY,
   GIMP_SAVE_MODE_SAVE_AND_CLOSE,
   GIMP_SAVE_MODE_EXPORT,
-  GIMP_SAVE_MODE_EXPORT_TO /* Also used for 'Overwrite' */
+  GIMP_SAVE_MODE_EXPORT_TO,
+  GIMP_SAVE_MODE_OVERWRITE
 } GimpSaveMode;
 
 
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index bb41a45..751255a 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -151,7 +151,7 @@ static const GimpEnumActionEntry file_save_actions[] =
   { "file-overwrite", NULL,
     NC_("file-action", "Over_write"), "",
     NC_("file-action", "Export the image back to the imported file in the import format"),
-    GIMP_SAVE_MODE_EXPORT_TO, FALSE,
+    GIMP_SAVE_MODE_OVERWRITE, FALSE,
     GIMP_HELP_FILE_OVERWRITE },
 
   { "file-export", NULL,
@@ -280,8 +280,8 @@ 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",       export);
-  SET_VISIBLE   ("file-export-to",       export || ! show_overwrite);
+  SET_SENSITIVE ("file-export-to",       drawable);
+  SET_VISIBLE   ("file-export-to",       ! show_overwrite);
   SET_SENSITIVE ("file-overwrite",       show_overwrite);
   SET_VISIBLE   ("file-overwrite",       show_overwrite);
   SET_SENSITIVE ("file-export",          drawable);
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 581edf2..9e75c70 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -284,14 +284,26 @@ file_save_cmd_callback (GtkAction *action,
       break;
 
     case GIMP_SAVE_MODE_EXPORT_TO:
+    case GIMP_SAVE_MODE_OVERWRITE:
       {
         const gchar         *uri;
         GimpPlugInProcedure *export_proc;
 
-        uri = gimp_image_get_exported_uri (image);
-
-        if (!uri)
-          uri = gimp_image_get_imported_uri (image);
+        if (save_mode == GIMP_SAVE_MODE_EXPORT_TO) 
+          {
+            uri = gimp_image_get_exported_uri (image);
+
+            if (! uri)
+              {
+                /* Behave as if Export... was invoked */
+                file_export_dialog_show (gimp, image, widget);
+                break;
+              }
+          }
+        else if (save_mode == GIMP_SAVE_MODE_OVERWRITE)
+          {
+            uri = gimp_image_get_imported_uri (image);
+          }
 
         if (uri)
           {



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