[gimp] plug-ins: port script-fu to libgimp objects



commit 1178f54522723c6d7e674b5c593b9fc14de97f4a
Author: Michael Natterer <mitch gimp org>
Date:   Tue Aug 27 18:09:50 2019 +0200

    plug-ins: port script-fu to libgimp objects

 plug-ins/script-fu/Makefile.am        |  1 -
 plug-ins/script-fu/scheme-wrapper.c   | 15 +++++++++++++--
 plug-ins/script-fu/script-fu-script.c | 10 +++++++++-
 3 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/script-fu/Makefile.am b/plug-ins/script-fu/Makefile.am
index 3f96fe0657..46ad336588 100644
--- a/plug-ins/script-fu/Makefile.am
+++ b/plug-ins/script-fu/Makefile.am
@@ -31,7 +31,6 @@ script_fu_RC = script-fu.rc.o
 endif
 
 AM_CPPFLAGS = \
-       -DGIMP_DEPRECATED_REPLACE_NEW_API \
        -I$(top_srcdir)         \
        $(GTK_CFLAGS)           \
        $(GEGL_CFLAGS)          \
diff --git a/plug-ins/script-fu/scheme-wrapper.c b/plug-ins/script-fu/scheme-wrapper.c
index 637a827496..d2da3c856a 100644
--- a/plug-ins/script-fu/scheme-wrapper.c
+++ b/plug-ins/script-fu/scheme-wrapper.c
@@ -1331,7 +1331,18 @@ script_fu_marshal_procedure_call (scheme   *sc,
                         i, type_name, return_vals[i].type);
           }
 #endif
-          if (G_VALUE_HOLDS_INT (value))
+          if (G_VALUE_HOLDS_OBJECT (value))
+            {
+              GObject *object = g_value_get_object (value);
+              gint     id     = -1;
+
+              if (object)
+                g_object_get (object, "id", &id, NULL);
+
+              return_val = sc->vptr->cons (sc, sc->vptr->mk_integer (sc, id),
+                                           return_val);
+            }
+          else if (G_VALUE_HOLDS_INT (value))
             {
               gint v = g_value_get_int (value);
 
@@ -1568,7 +1579,7 @@ script_fu_marshal_procedure_call (scheme   *sc,
    */
   if (return_val == sc->NIL)
     {
-      if (GIMP_VALUES_GET_INT (values, 0) == GIMP_PDB_SUCCESS)
+      if (GIMP_VALUES_GET_ENUM (values, 0) == GIMP_PDB_SUCCESS)
         return_val = sc->vptr->cons (sc, sc->T, sc->NIL);
       else
         return_val = sc->vptr->cons (sc, sc->F, sc->NIL);
diff --git a/plug-ins/script-fu/script-fu-script.c b/plug-ins/script-fu/script-fu-script.c
index 95a800fa5b..f492ce93c8 100644
--- a/plug-ins/script-fu/script-fu-script.c
+++ b/plug-ins/script-fu/script-fu-script.c
@@ -710,7 +710,15 @@ script_fu_script_get_command_from_params (SFScript             *script,
         case SF_CHANNEL:
         case SF_VECTORS:
         case SF_DISPLAY:
-          g_string_append_printf (s, "%d", g_value_get_int (value));
+          {
+            GObject *object = g_value_get_object (value);
+            gint     id     = -1;
+
+            if (object)
+              g_object_get (object, "id", &id, NULL);
+
+            g_string_append_printf (s, "%d", id);
+          }
           break;
 
         case SF_COLOR:


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