[gimp] app: clean up XCF compat code in file_save_cmd_callback()



commit 2c196895189804cad2a02f874b028fe9925b1998
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 30 16:46:38 2015 +0100

    app: clean up XCF compat code in file_save_cmd_callback()
    
    Add local boolean "compat_possible" to make it more obvious what the
    compat logic does.

 app/actions/file-commands.c |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 33ae8ee..8a26a12 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -267,23 +267,34 @@ file_save_cmd_callback (GtkAction *action,
               const gchar *version_string;
               gint         rle_version;
               gint         zlib_version;
+              gboolean     compat_possible = FALSE;
+
+              gimp_image_get_xcf_version (image, FALSE,
+                                          &rle_version, &version_string);
+              gimp_image_get_xcf_version (image, TRUE,
+                                          &zlib_version, NULL);
+
+              if (rle_version != zlib_version)
+                compat_possible = TRUE;
+
+              if (gimp_image_get_xcf_compat_mode (image) &&
+                  ! compat_possible)
+                {
+                  gimp_message (image->gimp, G_OBJECT (display),
+                                GIMP_MESSAGE_WARNING,
+                                _("The image uses features from %s and "
+                                  "cannot be saved for older GIMP "
+                                  "versions."),
+                                version_string);
+                }
 
-              gimp_image_get_xcf_version (image, FALSE, &rle_version,  &version_string);
-              gimp_image_get_xcf_version (image, TRUE,  &zlib_version, NULL);
-
-              if (rle_version == zlib_version && gimp_image_get_xcf_compat_mode (image))
-                gimp_message (image->gimp, G_OBJECT (display), GIMP_MESSAGE_WARNING,
-                              _("The image uses features from %s and "
-                                "cannot be saved for older GIMP "
-                                "versions."),
-                              version_string);
               saved = file_save_dialog_save_image (GIMP_PROGRESS (display),
                                                    gimp, image, file,
                                                    save_proc,
                                                    GIMP_RUN_WITH_LAST_VALS,
                                                    TRUE, FALSE, FALSE,
                                                    gimp_image_get_xcf_compat_mode (image) &&
-                                                   rle_version != zlib_version,
+                                                   compat_possible,
                                                    TRUE);
               break;
             }


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