[gimp] app: do not request xcf compat mode when compat_toggle not sensitive.



commit 01bdb712f933df17d829789908b51fc5c114a503
Author: Jehan <jehan girinstud io>
Date:   Tue Dec 8 20:10:45 2015 +0100

    app: do not request xcf compat mode when compat_toggle not sensitive.
    
    In some cases, on could end up with photographs with metadata as XCF
    version 6, which is useless since this is not compatible with GIMP 2.8
    either.

 app/dialogs/file-save-dialog.c |  134 +++++++++++++++++++++------------------
 1 files changed, 72 insertions(+), 62 deletions(-)
---
diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index b4fd4f4..1716b59 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -178,68 +178,78 @@ file_save_dialog_response (GtkWidget *dialog,
       break;
 
     case CHECK_URI_OK:
-      gimp_file_dialog_set_sensitive (file_dialog, FALSE);
-
-      if (file_save_dialog_save_image (GIMP_PROGRESS (dialog),
-                                       gimp,
-                                       file_dialog->image,
-                                       file,
-                                       save_proc,
-                                       GIMP_RUN_INTERACTIVE,
-                                       GIMP_IS_SAVE_DIALOG (dialog) &&
-                                       ! GIMP_SAVE_DIALOG (dialog)->save_a_copy,
-                                       FALSE,
-                                       GIMP_IS_EXPORT_DIALOG (dialog),
-                                       GIMP_IS_SAVE_DIALOG (dialog) &&
-                                       GIMP_SAVE_DIALOG (dialog)->compat,
-                                       FALSE))
-        {
-          /* Save was successful, now store the URI in a couple of
-           * places that depend on it being the user that made a
-           * save. Lower-level URI management is handled in
-           * file_save()
-           */
-          if (GIMP_IS_SAVE_DIALOG (dialog))
-            {
-              if (GIMP_SAVE_DIALOG (dialog)->save_a_copy)
-                gimp_image_set_save_a_copy_file (file_dialog->image, file);
-
-              g_object_set_data_full (G_OBJECT (file_dialog->image->gimp),
-                                      GIMP_FILE_SAVE_LAST_FILE_KEY,
-                                      g_object_ref (file),
-                                      (GDestroyNotify) g_object_unref);
-            }
-          else
-            {
-              g_object_set_data_full (G_OBJECT (file_dialog->image->gimp),
-                                      GIMP_FILE_EXPORT_LAST_FILE_KEY,
-                                      g_object_ref (file),
-                                      (GDestroyNotify) g_object_unref);
-            }
-
-          /*  make sure the menus are updated with the keys we've just set  */
-          gimp_image_flush (file_dialog->image);
-
-          /* Handle close-after-saving */
-          if (GIMP_IS_SAVE_DIALOG (dialog)                  &&
-              GIMP_SAVE_DIALOG (dialog)->close_after_saving &&
-              GIMP_SAVE_DIALOG (dialog)->display_to_close)
-            {
-              GimpDisplay *display = GIMP_DISPLAY (GIMP_SAVE_DIALOG (dialog)->display_to_close);
-
-              if (! gimp_image_is_dirty (gimp_display_get_image (display)))
-                {
-                  gimp_display_close (display);
-                }
-            }
-
-          gtk_widget_destroy (dialog);
-        }
-
-      g_object_unref (file);
-      g_free (basename);
-
-      gimp_file_dialog_set_sensitive (file_dialog, TRUE);
+      {
+        gboolean xcf_compat = FALSE;
+
+        gimp_file_dialog_set_sensitive (file_dialog, FALSE);
+
+        if (GIMP_IS_SAVE_DIALOG (dialog))
+          {
+            GimpSaveDialog* save_dialog = GIMP_SAVE_DIALOG (dialog);
+
+            xcf_compat = save_dialog->compat &&
+              gtk_widget_get_sensitive (save_dialog->compat_toggle);
+          }
+        if (file_save_dialog_save_image (GIMP_PROGRESS (dialog),
+                                         gimp,
+                                         file_dialog->image,
+                                         file,
+                                         save_proc,
+                                         GIMP_RUN_INTERACTIVE,
+                                         GIMP_IS_SAVE_DIALOG (dialog) &&
+                                         ! GIMP_SAVE_DIALOG (dialog)->save_a_copy,
+                                         FALSE,
+                                         GIMP_IS_EXPORT_DIALOG (dialog),
+                                         xcf_compat,
+                                         FALSE))
+          {
+            /* Save was successful, now store the URI in a couple of
+             * places that depend on it being the user that made a
+             * save. Lower-level URI management is handled in
+             * file_save()
+             */
+            if (GIMP_IS_SAVE_DIALOG (dialog))
+              {
+                if (GIMP_SAVE_DIALOG (dialog)->save_a_copy)
+                  gimp_image_set_save_a_copy_file (file_dialog->image, file);
+
+                g_object_set_data_full (G_OBJECT (file_dialog->image->gimp),
+                                        GIMP_FILE_SAVE_LAST_FILE_KEY,
+                                        g_object_ref (file),
+                                        (GDestroyNotify) g_object_unref);
+              }
+            else
+              {
+                g_object_set_data_full (G_OBJECT (file_dialog->image->gimp),
+                                        GIMP_FILE_EXPORT_LAST_FILE_KEY,
+                                        g_object_ref (file),
+                                        (GDestroyNotify) g_object_unref);
+              }
+
+            /*  make sure the menus are updated with the keys we've just set  */
+            gimp_image_flush (file_dialog->image);
+
+            /* Handle close-after-saving */
+            if (GIMP_IS_SAVE_DIALOG (dialog)                  &&
+                GIMP_SAVE_DIALOG (dialog)->close_after_saving &&
+                GIMP_SAVE_DIALOG (dialog)->display_to_close)
+              {
+                GimpDisplay *display = GIMP_DISPLAY (GIMP_SAVE_DIALOG (dialog)->display_to_close);
+
+                if (! gimp_image_is_dirty (gimp_display_get_image (display)))
+                  {
+                    gimp_display_close (display);
+                  }
+              }
+
+            gtk_widget_destroy (dialog);
+          }
+
+        g_object_unref (file);
+        g_free (basename);
+
+        gimp_file_dialog_set_sensitive (file_dialog, TRUE);
+      }
       break;
 
     case CHECK_URI_SWITCH_DIALOGS:


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