[gimp/wip/Jehan/classy-GIMP: 36/60] plug-in: port file-gbr to GimpImage/GimpDrawable.



commit 47b979088904b5c68e70bb4ade8819bcaefb998e
Author: Jehan <jehan girinstud io>
Date:   Wed Aug 14 16:00:14 2019 +0200

    plug-in: port file-gbr to GimpImage/GimpDrawable.

 plug-ins/common/Makefile.am    |  2 --
 plug-ins/common/file-gbr.c     | 26 +++++++++++++-------------
 plug-ins/common/plugin-defs.pl |  2 +-
 3 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 45b4a2a0f9..79feefc412 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -674,8 +674,6 @@ file_dicom_LDADD = \
        $(INTLLIBS)             \
        $(file_dicom_RC)
 
-file_gbr_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
 file_gbr_SOURCES = \
        file-gbr.c
 
diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c
index 03c5f9d84b..3d58c2f6f3 100644
--- a/plug-ins/common/file-gbr.c
+++ b/plug-ins/common/file-gbr.c
@@ -77,8 +77,8 @@ static GimpProcedure  * gbr_create_procedure (GimpPlugIn           *plug_in,
 
 static GimpValueArray * gbr_save             (GimpProcedure        *procedure,
                                               GimpRunMode           run_mode,
-                                              gint32                image_id,
-                                              gint32                drawable_id,
+                                              GimpImage            *image,
+                                              GimpDrawable         *drawable,
                                               GFile                *file,
                                               const GimpValueArray *args,
                                               gpointer              run_data);
@@ -174,8 +174,8 @@ gbr_create_procedure (GimpPlugIn  *plug_in,
 static GimpValueArray *
 gbr_save (GimpProcedure        *procedure,
           GimpRunMode           run_mode,
-          gint32                image_id,
-          gint32                drawable_id,
+          GimpImage            *image,
+          GimpDrawable         *drawable,
           GFile                *file,
           const GimpValueArray *args,
           gpointer              run_data)
@@ -183,12 +183,12 @@ gbr_save (GimpProcedure        *procedure,
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
   GimpExportReturn   export = GIMP_EXPORT_CANCEL;
   GimpParasite      *parasite;
-  gint32             orig_image_id;
+  GimpImage         *orig_image;
   GError            *error  = NULL;
 
   INIT_I18N ();
 
-  orig_image_id = image_id;
+  orig_image = image;
 
   switch (run_mode)
     {
@@ -196,7 +196,7 @@ gbr_save (GimpProcedure        *procedure,
     case GIMP_RUN_WITH_LAST_VALS:
       gimp_ui_init (PLUG_IN_BINARY, FALSE);
 
-      export = gimp_export_image (&image_id, &drawable_id, "GBR",
+      export = gimp_export_image (&image, &drawable, "GBR",
                                   GIMP_EXPORT_CAN_HANDLE_GRAY    |
                                   GIMP_EXPORT_CAN_HANDLE_RGB     |
                                   GIMP_EXPORT_CAN_HANDLE_INDEXED |
@@ -210,7 +210,7 @@ gbr_save (GimpProcedure        *procedure,
       /*  Possibly retrieve data  */
       gimp_get_data (SAVE_PROC, &info);
 
-      parasite = gimp_image_get_parasite (orig_image_id,
+      parasite = gimp_image_get_parasite (orig_image,
                                           "gimp-brush-name");
       if (parasite)
         {
@@ -269,8 +269,8 @@ gbr_save (GimpProcedure        *procedure,
         gimp_pdb_run_procedure (gimp_get_pdb (),
                                 "file-gbr-save-internal",
                                 GIMP_TYPE_RUN_MODE,    GIMP_RUN_NONINTERACTIVE,
-                                GIMP_TYPE_IMAGE_ID,    image_id,
-                                GIMP_TYPE_DRAWABLE_ID, drawable_id,
+                                GIMP_TYPE_IMAGE_ID,    gimp_image_get_id (image),
+                                GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
                                 G_TYPE_STRING,         uri,
                                 G_TYPE_STRING,         uri,
                                 G_TYPE_INT,            info.spacing,
@@ -305,17 +305,17 @@ gbr_save (GimpProcedure        *procedure,
                                     GIMP_PARASITE_PERSISTENT,
                                     strlen (info.description) + 1,
                                     info.description);
-      gimp_image_attach_parasite (orig_image_id, parasite);
+      gimp_image_attach_parasite (orig_image, parasite);
       gimp_parasite_free (parasite);
     }
   else
     {
-      gimp_image_detach_parasite (orig_image_id, "gimp-brush-name");
+      gimp_image_detach_parasite (orig_image, "gimp-brush-name");
     }
 
  out:
   if (export == GIMP_EXPORT_EXPORT)
-    gimp_image_delete (image_id);
+    gimp_image_delete (image);
 
   return gimp_procedure_new_return_values (procedure, status, error);
 }
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 3ea1f3abe2..4c0280420c 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -22,7 +22,7 @@
     'file-compressor' => { gio => 1, libdep => 'Z:BZIP2:LZMA', cflags => 'LZMA_CFLAGS', old_api => 1 },
     'file-desktop-link' => { gio => 1, old_api => 1 },
     'file-dicom' => { ui => 1, gegl => 1, cflags => '-fno-strict-aliasing', old_api => 1 },
-    'file-gbr' => { ui => 1, gegl => 1, old_api => 1 },
+    'file-gbr' => { ui => 1, gegl => 1 },
     'file-gegl' => { ui => 1, gegl => 1, old_api => 1 },
     'file-gif-load' => { gegl => 1, old_api => 1 },
     'file-gif-save' => { ui => 1, gegl => 1, old_api => 1 },


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