[gimp/wip/Jehan/classy-GIMP: 11/22] plug-ins: port mail to GimpImage/GimpDrawable.



commit 7bf35e44f64066eb288de28f23695087f2113e4c
Author: Jehan <jehan girinstud io>
Date:   Sat Aug 17 00:16:11 2019 +0200

    plug-ins: port mail to GimpImage/GimpDrawable.

 plug-ins/common/Makefile.am    |  2 --
 plug-ins/common/mail.c         | 32 ++++++++++++++++----------------
 plug-ins/common/plugin-defs.pl |  2 +-
 3 files changed, 17 insertions(+), 19 deletions(-)
---
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 7138eed969..bf7ff7abcd 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -1372,8 +1372,6 @@ jigsaw_LDADD = \
        $(INTLLIBS)             \
        $(jigsaw_RC)
 
-mail_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
 mail_SOURCES = \
        mail.c
 
diff --git a/plug-ins/common/mail.c b/plug-ins/common/mail.c
index 43441f3ed0..eba3aa1d03 100644
--- a/plug-ins/common/mail.c
+++ b/plug-ins/common/mail.c
@@ -87,14 +87,14 @@ static GimpProcedure  * mail_create_procedure (GimpPlugIn           *plug_in,
 
 static GimpValueArray * mail_run              (GimpProcedure        *procedure,
                                                GimpRunMode           run_mode,
-                                               gint32                image_id,
-                                               gint32                drawable_id,
+                                               GimpImage            *image,
+                                               GimpDrawable         *drawable,
                                                const GimpValueArray *args,
                                                gpointer              run_data);
 
 static GimpPDBStatusType  send_image              (const gchar      *filename,
-                                                   gint32            image_ID,
-                                                   gint32            drawable_ID,
+                                                   GimpImage        *image,
+                                                   GimpDrawable     *drawable,
                                                    gint32            run_mode);
 
 static gboolean           send_dialog             (void);
@@ -251,8 +251,8 @@ mail_create_procedure (GimpPlugIn  *plug_in,
 static GimpValueArray *
 mail_run (GimpProcedure        *procedure,
           GimpRunMode           run_mode,
-          gint32                image_id,
-          gint32                drawable_id,
+          GimpImage            *image,
+          GimpDrawable         *drawable,
           const GimpValueArray *args,
           gpointer              run_data)
 {
@@ -265,7 +265,7 @@ mail_run (GimpProcedure        *procedure,
     case GIMP_RUN_INTERACTIVE:
       gimp_get_data (PLUG_IN_PROC, &mail_info);
       {
-        gchar *filename = gimp_image_get_filename (image_id);
+        gchar *filename = gimp_image_get_filename (image);
 
         if (filename)
           {
@@ -309,8 +309,8 @@ mail_run (GimpProcedure        *procedure,
     }
 
   status = send_image (mail_info.filename,
-                       image_id,
-                       drawable_id,
+                       image,
+                       drawable,
                        run_mode);
 
   if (status == GIMP_PDB_SUCCESS)
@@ -325,10 +325,10 @@ mail_run (GimpProcedure        *procedure,
 }
 
 static GimpPDBStatusType
-send_image (const gchar *filename,
-            gint32       image_ID,
-            gint32       drawable_ID,
-            gint32       run_mode)
+send_image (const gchar  *filename,
+            GimpImage    *image,
+            GimpDrawable *drawable,
+            gint32        run_mode)
 {
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
   gchar             *ext;
@@ -355,8 +355,8 @@ send_image (const gchar *filename,
   tmpname = gimp_temp_name (ext + 1);
 
   if (! (gimp_file_save (run_mode,
-                         image_ID,
-                         drawable_ID,
+                         image,
+                         drawable,
                          tmpname,
                          tmpname) && valid_file (tmpname)))
     {
@@ -375,7 +375,7 @@ send_image (const gchar *filename,
    * So I use a known directory that we control under $GIMP_DIRECTORY/tmp/,
    * and clean it out each time the plugin runs. This means that *if* you
    * are in the above case (your email client requires the file to stay
-   * alive), * you cannot run twice the plugin at the same time.
+   * alive), you cannot run twice the plugin at the same time.
    */
   tmp_dir = gimp_directory_file ("tmp", PLUG_IN_PROC, NULL);
 
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 73e1bcd247..f90ba9b825 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -57,7 +57,7 @@
     'guillotine' => { old_api => 1 },
     'hot' => { ui => 1, gegl => 1, old_api => 1 },
     'jigsaw' => { ui => 1, gegl => 1 },
-    'mail' => { ui => 1, optional => 1, old_api => 1 },
+    'mail' => { ui => 1, optional => 1 },
     'nl-filter' => { ui => 1, gegl => 1 },
     'plugin-browser' => { ui => 1, old_api => 1 },
     'procedure-browser' => { ui => 1, old_api => 1 },


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