[gimp/wip/Jehan/classy-GIMP: 28/30] plug-ins: port file-desktop-link to GimpImage/GimpDrawable.



commit 6879f08ac699f06953b60daf42f91e84e89e7fd5
Author: Jehan <jehan girinstud io>
Date:   Wed Aug 14 16:23:53 2019 +0200

    plug-ins: port file-desktop-link to GimpImage/GimpDrawable.

 plug-ins/common/Makefile.am         |  2 --
 plug-ins/common/file-desktop-link.c | 30 +++++++++++++++---------------
 plug-ins/common/plugin-defs.pl      |  2 +-
 3 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 1bb8906c7b..ef79d982c2 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -634,8 +634,6 @@ file_csource_LDADD = \
        $(INTLLIBS)             \
        $(file_csource_RC)
 
-file_desktop_link_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
 file_desktop_link_SOURCES = \
        file-desktop-link.c
 
diff --git a/plug-ins/common/file-desktop-link.c b/plug-ins/common/file-desktop-link.c
index dcf2d588b2..faa627d877 100644
--- a/plug-ins/common/file-desktop-link.c
+++ b/plug-ins/common/file-desktop-link.c
@@ -65,7 +65,7 @@ static GimpValueArray * desktop_load             (GimpProcedure        *procedur
                                                   const GimpValueArray *args,
                                                   gpointer              run_data);
 
-static gint32           load_image               (GFile                *file,
+static GimpImage      * load_image               (GFile                *file,
                                                   GimpRunMode           run_mode,
                                                   GError              **error);
 
@@ -136,19 +136,19 @@ desktop_load (GimpProcedure        *procedure,
               gpointer              run_data)
 {
   GimpValueArray *return_values;
-  gint32          image_ID;
+  GimpImage      *image;
   GError         *error  = NULL;
 
-  image_ID = load_image (file, run_mode, &error);
+  image = load_image (file, run_mode, &error);
 
-  if (image_ID != -1)
+  if (image)
     {
       return_values = gimp_procedure_new_return_values (procedure,
                                                         GIMP_PDB_SUCCESS,
                                                         NULL);
 
-      gimp_value_set_image_id (gimp_value_array_index (return_values, 1),
-                               image_ID);
+      g_value_set_object (gimp_value_array_index (return_values, 1),
+                          image);
     }
   else
     {
@@ -160,17 +160,17 @@ desktop_load (GimpProcedure        *procedure,
   return return_values;
 }
 
-static gint32
+static GimpImage *
 load_image (GFile        *file,
             GimpRunMode   run_mode,
             GError      **load_error)
 {
-  GKeyFile *key_file = g_key_file_new ();
-  gchar    *filename = NULL;
-  gchar    *group    = NULL;
-  gchar    *value    = NULL;
-  gint32    image_ID = -1;
-  GError   *error    = NULL;
+  GKeyFile  *key_file = g_key_file_new ();
+  GimpImage *image    = NULL;
+  gchar     *filename = NULL;
+  gchar     *group    = NULL;
+  gchar     *value    = NULL;
+  GError    *error    = NULL;
 
   filename = g_file_get_path (file);
 
@@ -191,7 +191,7 @@ load_image (GFile        *file,
   value = g_key_file_get_value (key_file,
                                 group, G_KEY_FILE_DESKTOP_KEY_URL, &error);
   if (value)
-    image_ID = gimp_file_load (run_mode, value, value);
+    image = gimp_file_load (run_mode, value, value);
 
  out:
   if (error)
@@ -207,5 +207,5 @@ load_image (GFile        *file,
   g_free (filename);
   g_key_file_free (key_file);
 
-  return image_ID;
+  return image;
 }
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index c32a62b7c7..b02e0da782 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -20,7 +20,7 @@
     'file-cel' => { ui => 1, gegl => 1, old_api => 1 },
     'file-csource' => { ui => 1, gegl => 1, old_api => 1 },
     'file-compressor' => { gio => 1, libdep => 'Z:BZIP2:LZMA', cflags => 'LZMA_CFLAGS', old_api => 1 },
-    'file-desktop-link' => { gio => 1, old_api => 1 },
+    'file-desktop-link' => { gio => 1 },
     'file-dicom' => { ui => 1, gegl => 1, cflags => '-fno-strict-aliasing', old_api => 1 },
     'file-gbr' => { ui => 1, gegl => 1 },
     'file-gegl' => { ui => 1, gegl => 1, old_api => 1 },


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