[gimp/wip/Jehan/classy-GIMP: 52/65] libgimp: GimpSaveProcedure() now uses GimpImage/GimpDrawable object...



commit 7cdc6fcde18a70562f0c9a76d00619a5f9bace2b
Author: Jehan <jehan girinstud io>
Date:   Wed Aug 14 14:59:40 2019 +0200

    libgimp: GimpSaveProcedure() now uses GimpImage/GimpDrawable object...
    
    ... as parameters.
    And GimpLoadProcedure() now expects the run() function to return a
    GimpImage object.

 libgimp/gimploadprocedure.c | 10 +++++-----
 libgimp/gimpsaveprocedure.c | 38 +++++++++++++++++++-------------------
 libgimp/gimpsaveprocedure.h |  8 ++++----
 3 files changed, 28 insertions(+), 28 deletions(-)
---
diff --git a/libgimp/gimploadprocedure.c b/libgimp/gimploadprocedure.c
index 0b1259d387..3eef7a3709 100644
--- a/libgimp/gimploadprocedure.c
+++ b/libgimp/gimploadprocedure.c
@@ -97,11 +97,11 @@ gimp_load_procedure_constructed (GObject *object)
                                                        GIMP_PARAM_READWRITE));
 
   gimp_procedure_add_return_value (procedure,
-                                   gimp_param_spec_image_id ("image",
-                                                             "Image",
-                                                             "Output image",
-                                                             FALSE,
-                                                             GIMP_PARAM_READWRITE));
+                                   g_param_spec_object ("image",
+                                                        "Image",
+                                                        "Output image",
+                                                        GIMP_TYPE_IMAGE,
+                                                        GIMP_PARAM_READWRITE));
 }
 
 static void
diff --git a/libgimp/gimpsaveprocedure.c b/libgimp/gimpsaveprocedure.c
index 964860f4e2..23d366f8de 100644
--- a/libgimp/gimpsaveprocedure.c
+++ b/libgimp/gimpsaveprocedure.c
@@ -77,18 +77,18 @@ gimp_save_procedure_constructed (GObject *object)
   G_OBJECT_CLASS (parent_class)->constructed (object);
 
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_image_id ("image",
-                                                         "Image",
-                                                         "The image to save",
-                                                         FALSE,
-                                                         G_PARAM_READWRITE));
+                               g_param_spec_object ("image",
+                                                    "Image",
+                                                    "The image to save",
+                                                    GIMP_TYPE_IMAGE,
+                                                    G_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_drawable_id ("drawable",
-                                                            "Drawable",
-                                                            "The drawable "
-                                                            "to save",
-                                                            FALSE,
-                                                            G_PARAM_READWRITE));
+                               g_param_spec_object ("drawable",
+                                                    "Drawable",
+                                                    "The drawable "
+                                                    "to save",
+                                                    GIMP_TYPE_DRAWABLE,
+                                                    G_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_string ("uri",
                                                        "URI",
@@ -153,17 +153,17 @@ gimp_save_procedure_run (GimpProcedure        *procedure,
   GimpValueArray    *remaining;
   GimpValueArray    *return_values;
   GimpRunMode        run_mode;
-  gint32             image_id;
-  gint32             drawable_id;
+  GimpImage         *image;
+  GimpDrawable      *drawable;
   const gchar       *uri;
   GFile             *file;
   gint               i;
 
-  run_mode    = g_value_get_enum           (gimp_value_array_index (args, 0));
-  image_id    = gimp_value_get_image_id    (gimp_value_array_index (args, 1));
-  drawable_id = gimp_value_get_drawable_id (gimp_value_array_index (args, 2));
-  uri         = g_value_get_string         (gimp_value_array_index (args, 3));
-  /* raw_uri  = g_value_get_string         (gimp_value_array_index (args, 4)); */
+  run_mode   = g_value_get_enum   (gimp_value_array_index (args, 0));
+  image      = g_value_get_object (gimp_value_array_index (args, 1));
+  drawable   = g_value_get_object (gimp_value_array_index (args, 2));
+  uri        = g_value_get_string (gimp_value_array_index (args, 3));
+  /* raw_uri = g_value_get_string (gimp_value_array_index (args, 4)); */
 
   if (gimp_file_procedure_get_handles_uri (GIMP_FILE_PROCEDURE (procedure)))
     file = g_file_new_for_uri (uri);
@@ -181,7 +181,7 @@ gimp_save_procedure_run (GimpProcedure        *procedure,
 
   return_values = save_proc->priv->run_func (procedure,
                                              run_mode,
-                                             image_id, drawable_id,
+                                             image, drawable,
                                              file,
                                              remaining,
                                              save_proc->priv->run_data);
diff --git a/libgimp/gimpsaveprocedure.h b/libgimp/gimpsaveprocedure.h
index 0e5000452d..e8c07f3d4f 100644
--- a/libgimp/gimpsaveprocedure.h
+++ b/libgimp/gimpsaveprocedure.h
@@ -33,8 +33,8 @@ G_BEGIN_DECLS
  * GimpRunSaveFunc:
  * @procedure:   the #GimpProcedure that runs.
  * @run_mode:    the #GimpRunMode.
- * @image_id:    the image to save.
- * @drawable_id: the drawable to save.
+ * @image:       the image to save.
+ * @drawable:    the drawable to save.
  * @file:        the #GFile to save to.
  * @args:        the @procedure's remaining arguments.
  * @run_data:    the run_data given in gimp_save_procedure_new().
@@ -48,8 +48,8 @@ G_BEGIN_DECLS
  **/
 typedef GimpValueArray * (* GimpRunSaveFunc) (GimpProcedure        *procedure,
                                               GimpRunMode           run_mode,
-                                              gint32                image_id,
-                                              gint32                drawable_id,
+                                              GimpImage            *image,
+                                              GimpDrawable         *drawable,
                                               GFile                *file,
                                               const GimpValueArray *args,
                                               gpointer              run_data);


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