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



commit 3dbae5e4d97139b7917c229671fe90963ab7d0e6
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.

 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 d7aa79a..9d8a817 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -299,13 +299,14 @@ file_save_cmd_callback (GtkAction *action,
     case GIMP_SAVE_MODE_EXPORT:
     case GIMP_SAVE_MODE_OVERWRITE:
       {
-        const gchar         *uri = NULL;
-        GimpPlugInProcedure *export_proc;
-        gboolean             overwrite = FALSE;
+        const gchar         *uri         = NULL;
+        GimpPlugInProcedure *export_proc = NULL;
+        gboolean             overwrite   = FALSE;
 
         if (save_mode == GIMP_SAVE_MODE_EXPORT)
           {
-            uri = gimp_image_get_exported_uri (image);
+            uri         = gimp_image_get_exported_uri (image);
+            export_proc = gimp_image_get_export_proc (image);
 
             if (! uri)
               {
@@ -323,7 +324,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 a4ae2f1..215bb18 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 1057117..aa22707 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -2207,6 +2207,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 6a3cfeb..bc0900f 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -163,6 +163,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 19d02f9..6006ec2 100644
--- a/app/file/file-save.c
+++ b/app/file/file-save.c
@@ -198,6 +198,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]