[gimp] app: Move save-on-copy URI remembering to the appropriate place



commit edac194b23f84bdfb1ee01654b01479845707d65
Author: Martin Nordholts <martinn src gnome org>
Date:   Mon May 4 21:00:41 2009 +0200

    app: Move save-on-copy URI remembering to the appropriate place
    
    The Save a copy-URI shall only be remembered when the URI has been
    entered through the dialog, so move it from file_save() to
    file_save_dialog_response(). This is a preparation for the future
    where we need to pass TRUE to save_a_copy without the URI being
    remembered.
---
 app/dialogs/file-save-dialog.c |   21 ++++++++++++++++++++-
 app/file/file-save.c           |   14 +-------------
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index e2420c6..47cf84e 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -141,10 +141,29 @@ file_save_dialog_response (GtkWidget *save_dialog,
                                        dialog->save_a_copy,
                                        FALSE))
         {
+          /* Save was successful, now store the URI in a couple of
+           * places
+           */
+          if (dialog->save_a_copy)
+            {
+              g_object_set_data_full (G_OBJECT (dialog->image),
+                                      GIMP_FILE_SAVE_A_COPY_URI_KEY,
+                                      g_strdup (uri), (GDestroyNotify) g_free);
+            }
+          else if (! dialog->save_a_copy &&
+                   strcmp (uri, gimp_image_get_uri (dialog->image)) != 0)
+            {
+              /*  reset the "save-a-copy" filename on URI Change */
+              g_object_set_data (G_OBJECT (dialog->image),
+                                 GIMP_FILE_SAVE_A_COPY_URI_KEY,
+                                 NULL);
+            }
+
           g_object_set_data_full (G_OBJECT (dialog->image->gimp),
                                   GIMP_FILE_SAVE_LAST_URI_KEY,
                                   g_strdup (uri), (GDestroyNotify) g_free);
-
+          
+          /* Handle close-after-saing */
           if (dialog)
             {
               GtkWindow *parent;
diff --git a/app/file/file-save.c b/app/file/file-save.c
index 840ad46..05d1d75 100644
--- a/app/file/file-save.c
+++ b/app/file/file-save.c
@@ -154,20 +154,8 @@ file_save (Gimp                *gimp,
       GimpDocumentList *documents;
       GimpImagefile    *imagefile;
 
-      if (save_a_copy)
+      if (! save_a_copy)
         {
-          /*  remember the "save-a-copy" filename for the next invocation  */
-          g_object_set_data_full (G_OBJECT (image), GIMP_FILE_SAVE_A_COPY_URI_KEY,
-                                  g_strdup (uri),
-                                  (GDestroyNotify) g_free);
-        }
-      else
-        {
-          /*  reset the "save-a-copy" filename when the image URI changes  */
-          if (strcmp (uri, gimp_image_get_uri (image)))
-            g_object_set_data (G_OBJECT (image),
-                               GIMP_FILE_SAVE_A_COPY_URI_KEY, NULL);
-
           gimp_image_set_uri (image, uri);
           gimp_image_set_save_proc (image, file_proc);
 



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