[gimp/gimp-2-8] Bug 727854 - Export file type should not be based on filename extension



commit fd85286291cf9a39ccc7f9547092e3b488b68849
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jul 2 14:24:02 2014 +0200

    Bug 727854 - Export file type should not be based on filename extension
    
    Keep the export proc acound in the image (just as we keep around
    the save proc), and use it when exporting again.
    
    (cherry picked from commit 3dbae5e4d97139b7917c229671fe90963ab7d0e6)

 app/actions/file-commands.c  |   11 ++++++-----
 app/core/gimpimage-private.h |    1 +
 app/core/gimpimage.c         |   17 +++++++++++++++++
 app/core/gimpimage.h         |    3 +++
 app/file/file-save.c         |    1 +
 5 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 3b38ba3..7bb9c20 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -293,13 +293,14 @@ file_save_cmd_callback (GtkAction *action,
     case GIMP_SAVE_MODE_EXPORT_TO:
     case GIMP_SAVE_MODE_OVERWRITE:
       {
-        const gchar         *uri = NULL;
-        GimpPlugInProcedure *export_proc;
-        gboolean             overwrite;
+        const gchar         *uri         = NULL;
+        GimpPlugInProcedure *export_proc = NULL;
+        gboolean             overwrite   = FALSE;
 
         if (save_mode == GIMP_SAVE_MODE_EXPORT_TO)
           {
-            uri = gimp_image_get_exported_uri (image);
+            uri         = gimp_image_get_exported_uri (image);
+            export_proc = gimp_image_get_export_proc (image);
 
             if (! uri)
               {
@@ -317,7 +318,7 @@ file_save_cmd_callback (GtkAction *action,
             overwrite = TRUE;
           }
 
-        if (uri)
+        if (uri && ! export_proc)
           {
             export_proc =
               file_procedure_find (image->gimp->plug_in_manager->export_procs,
diff --git a/app/core/gimpimage-private.h b/app/core/gimpimage-private.h
index 3858a9c..ae9db16 100644
--- a/app/core/gimpimage-private.h
+++ b/app/core/gimpimage-private.h
@@ -38,6 +38,7 @@ struct _GimpImagePrivate
 
   GimpPlugInProcedure *load_proc;           /*  procedure used for loading   */
   GimpPlugInProcedure *save_proc;           /*  last save procedure used     */
+  GimpPlugInProcedure *export_proc;         /*  last export procedure used   */
 
   gchar             *display_name;          /*  display basename             */
   gchar             *display_path;          /*  display full path            */
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 2bb7b81..f67f3aa 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1900,6 +1900,23 @@ gimp_image_get_save_proc (const GimpImage *image)
 }
 
 void
+gimp_image_set_export_proc (GimpImage           *image,
+                            GimpPlugInProcedure *proc)
+{
+  g_return_if_fail (GIMP_IS_IMAGE (image));
+
+  GIMP_IMAGE_GET_PRIVATE (image)->export_proc = proc;
+}
+
+GimpPlugInProcedure *
+gimp_image_get_export_proc (const GimpImage *image)
+{
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+
+  return GIMP_IMAGE_GET_PRIVATE (image)->export_proc;
+}
+
+void
 gimp_image_set_resolution (GimpImage *image,
                            gdouble    xresolution,
                            gdouble    yresolution)
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index 6e3d3e6..8216ebb 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -201,6 +201,9 @@ void            gimp_image_set_save_proc         (GimpImage          *image,
 GimpPlugInProcedure * gimp_image_get_save_proc   (const GimpImage    *image);
 void            gimp_image_saved                 (GimpImage          *image,
                                                   const gchar        *uri);
+void            gimp_image_set_export_proc       (GimpImage          *image,
+                                                  GimpPlugInProcedure *proc);
+GimpPlugInProcedure * gimp_image_get_export_proc (const GimpImage    *image);
 void            gimp_image_exported              (GimpImage          *image,
                                                   const gchar        *uri);
 
diff --git a/app/file/file-save.c b/app/file/file-save.c
index d673718..9060a07 100644
--- a/app/file/file-save.c
+++ b/app/file/file-save.c
@@ -189,6 +189,7 @@ file_save (Gimp                *gimp,
            * of a GimpImage is the last-save URI
            */
           gimp_image_set_exported_uri (image, uri);
+          gimp_image_set_export_proc (image, file_proc);
 
           /* An image can not be considered both exported and imported
            * at the same time, so stop consider it as imported now


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