[gimp] plug-ins: use begin_export()/end_export() in file-csource



commit c25778c88219a644500fca48309d30e08e8fd963
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 22 12:48:19 2019 +0200

    plug-ins: use begin_export()/end_export() in file-csource
    
    and remove all manual "gimp-comment" parasite code.

 plug-ins/common/file-csource.c | 39 ++-------------------------------------
 1 file changed, 2 insertions(+), 37 deletions(-)
---
diff --git a/plug-ins/common/file-csource.c b/plug-ins/common/file-csource.c
index 36c9e44648..0b7d20d842 100644
--- a/plug-ins/common/file-csource.c
+++ b/plug-ins/common/file-csource.c
@@ -204,7 +204,6 @@ csource_save (GimpProcedure        *procedure,
   GimpProcedureConfig *config;
   GimpPDBStatusType    status = GIMP_PDB_SUCCESS;
   GimpExportReturn     export = GIMP_EXPORT_CANCEL;
-  GimpParasite        *parasite;
   gchar               *prefixed_name;
   gchar               *comment;
   GError              *error  = NULL;
@@ -218,25 +217,12 @@ csource_save (GimpProcedure        *procedure,
                                              NULL);
 
   config = gimp_procedure_create_config (procedure);
-  gimp_procedure_config_begin_run (config, image, run_mode, args);
+  gimp_procedure_config_begin_export (config, image, run_mode, args, NULL);
 
   g_object_set (config,
                 "save-alpha", gimp_drawable_has_alpha (drawable),
                 NULL);
 
-  parasite = gimp_image_get_parasite (image, "gimp-comment");
-  if (parasite)
-    {
-      gchar *comment = g_strndup (gimp_parasite_data (parasite),
-                                  gimp_parasite_data_size (parasite));
-      g_object_set (config,
-                    "comment", comment,
-                    NULL);
-      g_free (comment);
-
-      gimp_parasite_free (parasite);
-    }
-
   gimp_ui_init (PLUG_IN_BINARY);
 
   export = gimp_export_image (&image, &drawable, "C Source",
@@ -278,28 +264,7 @@ csource_save (GimpProcedure        *procedure,
         }
     }
 
-#if 0
-  /* FIXME generic comment handling */
-  if (x != config.comment &&
-      ! (x && config.comment && strcmp (x, config.comment) == 0))
-    {
-      if (! config.comment || ! config.comment[0])
-        {
-          gimp_image_detach_parasite (image, "gimp-comment");
-        }
-      else
-        {
-          parasite = gimp_parasite_new ("gimp-comment",
-                                        GIMP_PARASITE_PERSISTENT,
-                                        strlen (config.comment) + 1,
-                                        config.comment);
-          gimp_image_attach_parasite (image, parasite);
-          gimp_parasite_free (parasite);
-        }
-    }
-#endif
-
-  gimp_procedure_config_end_run (config, status);
+  gimp_procedure_config_end_export (config, image, file, status);
   g_object_unref (config);
 
   if (export == GIMP_EXPORT_EXPORT)


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