[gimp] plug-ins: attach the default comment to all screenshots



commit f67100f5549e000a4e4bf7a3b0a9a3c8e367dcdf
Author: Michael Natterer <mitch gimp org>
Date:   Tue May 31 22:29:49 2016 +0200

    plug-ins: attach the default comment to all screenshots
    
    not only to screenshots made with the X11 backend.

 plug-ins/screenshot/screenshot-x11.c |   15 ---------------
 plug-ins/screenshot/screenshot.c     |   18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/plug-ins/screenshot/screenshot-x11.c b/plug-ins/screenshot/screenshot-x11.c
index 95772dc..60ae44f 100644
--- a/plug-ins/screenshot/screenshot-x11.c
+++ b/plug-ins/screenshot/screenshot-x11.c
@@ -407,7 +407,6 @@ create_image (cairo_surface_t *surface,
   gint32     image;
   gint32     layer;
   gdouble    xres, yres;
-  gchar     *comment;
   gint       width, height;
 
   gimp_progress_init (_("Importing screenshot"));
@@ -421,20 +420,6 @@ create_image (cairo_surface_t *surface,
   gimp_get_monitor_resolution (&xres, &yres);
   gimp_image_set_resolution (image, xres, yres);
 
-  comment = gimp_get_default_comment ();
-  if (comment)
-    {
-      GimpParasite *parasite;
-
-      parasite = gimp_parasite_new ("gimp-comment", GIMP_PARASITE_PERSISTENT,
-                                    strlen (comment) + 1, comment);
-
-      gimp_image_attach_parasite (image, parasite);
-      gimp_parasite_free (parasite);
-
-      g_free (comment);
-    }
-
   layer = gimp_layer_new_from_surface (image,
                                        name ? name : _("Screenshot"),
                                        surface,
diff --git a/plug-ins/screenshot/screenshot.c b/plug-ins/screenshot/screenshot.c
index 6d35eed..e46063d 100644
--- a/plug-ins/screenshot/screenshot.c
+++ b/plug-ins/screenshot/screenshot.c
@@ -273,6 +273,24 @@ run (const gchar      *name,
 
   if (status == GIMP_PDB_SUCCESS)
     {
+      gchar *comment = gimp_get_default_comment ();
+
+      if (comment)
+        {
+          GimpParasite *parasite;
+
+          parasite = gimp_parasite_new ("gimp-comment",
+                                        GIMP_PARASITE_PERSISTENT,
+                                        strlen (comment) + 1, comment);
+
+          gimp_image_attach_parasite (image_ID, parasite);
+          gimp_parasite_free (parasite);
+
+          g_free (comment);
+        }
+
+      gimp_image_clean_all (image_ID);
+
       if (run_mode == GIMP_RUN_INTERACTIVE)
         {
           /* Store variable states for next run */


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