[gimp] libgimp: deprecate and rename the global pararasite functions
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: deprecate and rename the global pararasite functions
- Date: Tue, 8 Mar 2011 13:32:39 +0000 (UTC)
commit bb6436cb4421433a081e3f744659ca6ab588b561
Author: Michael Natterer <mitch gimp org>
Date: Tue Mar 8 14:31:04 2011 +0100
libgimp: deprecate and rename the global pararasite functions
just as it was done for items and images. Remove the "parasite" PDB
group completely.
app/pdb/Makefile.am | 1 -
app/pdb/gimp-cmds.c | 202 +++++++++++++++++++++++++++++++++
app/pdb/gimp-pdb-compat.c | 6 +-
app/pdb/internal-procs.c | 1 -
app/pdb/internal-procs.h | 1 -
app/pdb/parasite-cmds.c | 241 ----------------------------------------
libgimp/Makefile.am | 2 -
libgimp/gimp.c | 60 ++++++++++
libgimp/gimp.h | 13 ++-
libgimp/gimp_pdb.c | 134 ++++++++++++++++++++++
libgimp/gimp_pdb.h | 8 +-
libgimp/gimp_pdb_headers.h | 1 -
libgimp/gimpparasite_pdb.c | 166 ---------------------------
libgimp/gimpparasite_pdb.h | 40 -------
plug-ins/common/file-dicom.c | 2 +-
plug-ins/common/file-png.c | 4 +-
plug-ins/file-jpeg/jpeg-exif.c | 4 +-
plug-ins/file-jpeg/jpeg-save.c | 4 +-
plug-ins/pygimp/gimpmodule.c | 12 +-
tools/pdbgen/Makefile.am | 1 -
tools/pdbgen/groups.pl | 1 -
tools/pdbgen/pdb/gimp.pdb | 108 +++++++++++++++++-
tools/pdbgen/pdb/parasite.pdb | 130 ---------------------
23 files changed, 535 insertions(+), 607 deletions(-)
---
diff --git a/app/pdb/Makefile.am b/app/pdb/Makefile.am
index eb86f14..dbbf1ad 100644
--- a/app/pdb/Makefile.am
+++ b/app/pdb/Makefile.am
@@ -69,7 +69,6 @@ libappinternal_procs_a_SOURCES = \
palette-cmds.c \
palette-select-cmds.c \
palettes-cmds.c \
- parasite-cmds.c \
paths-cmds.c \
pattern-cmds.c \
pattern-select-cmds.c \
diff --git a/app/pdb/gimp-cmds.c b/app/pdb/gimp-cmds.c
index ce91ab1..8dda7d7 100644
--- a/app/pdb/gimp-cmds.c
+++ b/app/pdb/gimp-cmds.c
@@ -26,6 +26,7 @@
#include "pdb-types.h"
#include "base/base-utils.h"
+#include "core/gimp-parasites.h"
#include "core/gimp.h"
#include "core/gimpparamspecs.h"
@@ -94,6 +95,104 @@ quit_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
+static GValueArray *
+attach_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const GimpParasite *parasite;
+
+ parasite = g_value_get_boxed (&args->values[0]);
+
+ if (success)
+ {
+ gimp_parasite_attach (gimp, parasite);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GValueArray *
+detach_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ const gchar *name;
+
+ name = g_value_get_string (&args->values[0]);
+
+ if (success)
+ {
+ gimp_parasite_detach (gimp, name);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GValueArray *
+get_parasite_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GValueArray *return_vals;
+ const gchar *name;
+ GimpParasite *parasite = NULL;
+
+ name = g_value_get_string (&args->values[0]);
+
+ if (success)
+ {
+ parasite = gimp_parasite_copy (gimp_parasite_find (gimp, name));
+
+ if (! parasite)
+ success = FALSE;
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_take_boxed (&return_vals->values[1], parasite);
+
+ return return_vals;
+}
+
+static GValueArray *
+get_parasite_list_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ GValueArray *return_vals;
+ gint32 num_parasites = 0;
+ gchar **parasites = NULL;
+
+ parasites = gimp_parasite_list (gimp, &num_parasites);
+
+ return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+
+ g_value_set_int (&return_vals->values[1], num_parasites);
+ gimp_value_take_stringarray (&return_vals->values[2], parasites, num_parasites);
+
+ return return_vals;
+}
+
void
register_gimp_procs (GimpPDB *pdb)
{
@@ -168,4 +267,107 @@ register_gimp_procs (GimpPDB *pdb)
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
+
+ /*
+ * gimp-attach-parasite
+ */
+ procedure = gimp_procedure_new (attach_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-attach-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-attach-parasite",
+ "Add a global parasite.",
+ "This procedure attaches a global parasite. It has no return values.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_parasite ("parasite",
+ "parasite",
+ "The parasite to attach",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-detach-parasite
+ */
+ procedure = gimp_procedure_new (detach_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-detach-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-detach-parasite",
+ "Removes a global parasite.",
+ "This procedure detaches a global parasite from. It has no return values.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the parasite to detach.",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-parasite
+ */
+ procedure = gimp_procedure_new (get_parasite_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-parasite");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-parasite",
+ "Look up a global parasite.",
+ "Finds and returns the global parasite that was previously attached.",
+ "Jay Cox",
+ "Jay Cox",
+ "1998",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("name",
+ "name",
+ "The name of the parasite to find",
+ FALSE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_parasite ("parasite",
+ "parasite",
+ "The found parasite",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-get-parasite-list
+ */
+ procedure = gimp_procedure_new (get_parasite_list_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-get-parasite-list");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-get-parasite-list",
+ "List all parasites.",
+ "Returns a list of all currently attached global parasites.",
+ "Marc Lehmann",
+ "Marc Lehmann",
+ "1999",
+ NULL);
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-parasites",
+ "num parasites",
+ "The number of attached parasites",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_string_array ("parasites",
+ "parasites",
+ "The names of currently attached parasites",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
}
diff --git a/app/pdb/gimp-pdb-compat.c b/app/pdb/gimp-pdb-compat.c
index c0f5db7..8a99b89 100644
--- a/app/pdb/gimp-pdb-compat.c
+++ b/app/pdb/gimp-pdb-compat.c
@@ -475,7 +475,11 @@ gimp_pdb_compat_procs_register (GimpPDB *pdb,
{ "gimp-image-parasite-find", "gimp-image-get-parasite" },
{ "gimp-image-parasite-attach", "gimp-image-attach-parasite" },
{ "gimp-image-parasite-detach", "gimp-image-detach-parasite" },
- { "gimp-image-parasite-list", "gimp-image-get-parasite-list" }
+ { "gimp-image-parasite-list", "gimp-image-get-parasite-list" },
+ { "gimp-parasite-find", "gimp-get-parasite" },
+ { "gimp-parasite-attach", "gimp-attach-parasite" },
+ { "gimp-parasite-detach", "gimp-detach-parasite" },
+ { "gimp-parasite-list", "gimp-get-parasite-list" }
};
g_return_if_fail (GIMP_IS_PDB (pdb));
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 4f2713c..a16da75 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -69,7 +69,6 @@ internal_procs_init (GimpPDB *pdb)
register_palette_procs (pdb);
register_palette_select_procs (pdb);
register_palettes_procs (pdb);
- register_parasite_procs (pdb);
register_paths_procs (pdb);
register_pattern_procs (pdb);
register_pattern_select_procs (pdb);
diff --git a/app/pdb/internal-procs.h b/app/pdb/internal-procs.h
index a8b3a27..95c4b1e 100644
--- a/app/pdb/internal-procs.h
+++ b/app/pdb/internal-procs.h
@@ -58,7 +58,6 @@ void register_paint_tools_procs (GimpPDB *pdb);
void register_palette_procs (GimpPDB *pdb);
void register_palette_select_procs (GimpPDB *pdb);
void register_palettes_procs (GimpPDB *pdb);
-void register_parasite_procs (GimpPDB *pdb);
void register_paths_procs (GimpPDB *pdb);
void register_pattern_procs (GimpPDB *pdb);
void register_pattern_select_procs (GimpPDB *pdb);
diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am
index a2abe6c..659ecf0 100644
--- a/libgimp/Makefile.am
+++ b/libgimp/Makefile.am
@@ -102,7 +102,6 @@ PDB_WRAPPERS_C = \
gimppalette_pdb.c \
gimppalettes_pdb.c \
gimppaletteselect_pdb.c \
- gimpparasite_pdb.c \
gimppaths_pdb.c \
gimppattern_pdb.c \
gimppatterns_pdb.c \
@@ -155,7 +154,6 @@ PDB_WRAPPERS_H = \
gimppalette_pdb.h \
gimppalettes_pdb.h \
gimppaletteselect_pdb.h \
- gimpparasite_pdb.h \
gimppaths_pdb.h \
gimppattern_pdb.h \
gimppatterns_pdb.h \
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index b0fbb4b..ac2682b 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -1505,6 +1505,66 @@ gimp_extension_process (guint timeout)
}
/**
+ * gimp_parasite_find:
+ * @name: The name of the parasite to find.
+ *
+ * Deprecated: Use gimp_get_parasite() instead.
+ *
+ * Returns: The found parasite.
+ **/
+GimpParasite *
+gimp_parasite_find (const gchar *name)
+{
+ return gimp_get_parasite (name);
+}
+
+/**
+ * gimp_parasite_attach:
+ * @parasite: The parasite to attach.
+ *
+ * Deprecated: Use gimp_attach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_parasite_attach (const GimpParasite *parasite)
+{
+ return gimp_attach_parasite (parasite);
+}
+
+/**
+ * gimp_parasite_detach:
+ * @name: The name of the parasite to detach.
+ *
+ * Deprecated: Use gimp_detach_parasite() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_parasite_detach (const gchar *name)
+{
+ return gimp_parasite_detach (name);
+}
+
+/**
+ * gimp_parasite_list:
+ * @num_parasites: The number of attached parasites.
+ * @parasites: The names of currently attached parasites.
+ *
+ * Deprecated: Use gimp_get_parasite_list() instead.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_parasite_list (gint *num_parasites,
+ gchar ***parasites)
+{
+ *parasites = gimp_get_parasite_list (num_parasites);
+
+ return *parasites != NULL;
+}
+
+/**
* gimp_attach_new_parasite:
* @name: the name of the #GimpParasite to create and attach.
* @flags: the flags set on the #GimpParasite.
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index 407f4a3..c6bb484 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -333,10 +333,15 @@ const gchar * gimp_get_progname (void) G_GNUC_CONST;
gboolean gimp_install_cmap (void) G_GNUC_CONST;
gint gimp_min_colors (void) G_GNUC_CONST;
-gboolean gimp_attach_new_parasite (const gchar *name,
- gint flags,
- gint size,
- gconstpointer data);
+GimpParasite * gimp_parasite_find (const gchar *name);
+gboolean gimp_parasite_attach (const GimpParasite *parasite);
+gboolean gimp_parasite_detach (const gchar *name);
+gboolean gimp_parasite_list (gint *num_parasites,
+ gchar ***parasites);
+gboolean gimp_attach_new_parasite (const gchar *name,
+ gint flags,
+ gint size,
+ gconstpointer data);
#endif /* GIMP_DISABLE_DEPRECATED */
diff --git a/libgimp/gimp_pdb.c b/libgimp/gimp_pdb.c
index 9ade367..7d89eb0 100644
--- a/libgimp/gimp_pdb.c
+++ b/libgimp/gimp_pdb.c
@@ -92,3 +92,137 @@ gimp_getpid (void)
return pid;
}
+
+/**
+ * gimp_attach_parasite:
+ * @parasite: The parasite to attach.
+ *
+ * Add a global parasite.
+ *
+ * This procedure attaches a global parasite. It has no return values.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.8
+ **/
+gboolean
+gimp_attach_parasite (const GimpParasite *parasite)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-attach-parasite",
+ &nreturn_vals,
+ GIMP_PDB_PARASITE, parasite,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_detach_parasite:
+ * @name: The name of the parasite to detach.
+ *
+ * Removes a global parasite.
+ *
+ * This procedure detaches a global parasite from. It has no return
+ * values.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.8
+ **/
+gboolean
+gimp_detach_parasite (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-detach-parasite",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
+ * gimp_get_parasite:
+ * @name: The name of the parasite to find.
+ *
+ * Look up a global parasite.
+ *
+ * Finds and returns the global parasite that was previously attached.
+ *
+ * Returns: The found parasite.
+ *
+ * Since: GIMP 2.8
+ **/
+GimpParasite *
+gimp_get_parasite (const gchar *name)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpParasite *parasite = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-get-parasite",
+ &nreturn_vals,
+ GIMP_PDB_STRING, name,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite);
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return parasite;
+}
+
+/**
+ * gimp_get_parasite_list:
+ * @num_parasites: The number of attached parasites.
+ *
+ * List all parasites.
+ *
+ * Returns a list of all currently attached global parasites.
+ *
+ * Returns: The names of currently attached parasites.
+ *
+ * Since: GIMP 2.8
+ **/
+gchar **
+gimp_get_parasite_list (gint *num_parasites)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gchar **parasites = NULL;
+ gint i;
+
+ return_vals = gimp_run_procedure ("gimp-get-parasite-list",
+ &nreturn_vals,
+ GIMP_PDB_END);
+
+ *num_parasites = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_parasites = return_vals[1].data.d_int32;
+ parasites = g_new (gchar *, *num_parasites);
+ for (i = 0; i < *num_parasites; i++)
+ parasites[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return parasites;
+}
diff --git a/libgimp/gimp_pdb.h b/libgimp/gimp_pdb.h
index 6b71a87..b45eacd 100644
--- a/libgimp/gimp_pdb.h
+++ b/libgimp/gimp_pdb.h
@@ -28,8 +28,12 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gchar* gimp_version (void);
-gint gimp_getpid (void);
+gchar* gimp_version (void);
+gint gimp_getpid (void);
+gboolean gimp_attach_parasite (const GimpParasite *parasite);
+gboolean gimp_detach_parasite (const gchar *name);
+GimpParasite* gimp_get_parasite (const gchar *name);
+gchar** gimp_get_parasite_list (gint *num_parasites);
G_END_DECLS
diff --git a/libgimp/gimp_pdb_headers.h b/libgimp/gimp_pdb_headers.h
index a747d21..62c3dc0 100644
--- a/libgimp/gimp_pdb_headers.h
+++ b/libgimp/gimp_pdb_headers.h
@@ -57,7 +57,6 @@
#include <libgimp/gimppalette_pdb.h>
#include <libgimp/gimppalettes_pdb.h>
#include <libgimp/gimppaletteselect_pdb.h>
-#include <libgimp/gimpparasite_pdb.h>
#include <libgimp/gimppaths_pdb.h>
#include <libgimp/gimppattern_pdb.h>
#include <libgimp/gimppatterns_pdb.h>
diff --git a/plug-ins/common/file-dicom.c b/plug-ins/common/file-dicom.c
index de43789..82d0975 100644
--- a/plug-ins/common/file-dicom.c
+++ b/plug-ins/common/file-dicom.c
@@ -549,7 +549,7 @@ load_image (const gchar *filename,
GimpParasite *parasite;
gchar pname[255];
- /* all elements are retrievable using gimp_parasite_list() */
+ /* all elements are retrievable using gimp_get_parasite_list() */
g_snprintf (pname, sizeof (pname),
"dcm/%04x-%04x-%s", group_word, element_word, value_rep);
if ((parasite = gimp_parasite_new (pname,
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 44320dd..e9a4ed8 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -1912,7 +1912,7 @@ load_defaults (void)
{
GimpParasite *parasite;
- parasite = gimp_parasite_find (PNG_DEFAULTS_PARASITE);
+ parasite = gimp_get_parasite (PNG_DEFAULTS_PARASITE);
if (parasite)
{
@@ -1969,7 +1969,7 @@ save_defaults (void)
GIMP_PARASITE_PERSISTENT,
strlen (def_str), def_str);
- gimp_parasite_attach (parasite);
+ gimp_attach_parasite (parasite);
gimp_parasite_free (parasite);
g_free (def_str);
diff --git a/plug-ins/file-jpeg/jpeg-exif.c b/plug-ins/file-jpeg/jpeg-exif.c
index a547386..2805858 100644
--- a/plug-ins/file-jpeg/jpeg-exif.c
+++ b/plug-ins/file-jpeg/jpeg-exif.c
@@ -253,7 +253,7 @@ jpeg_exif_rotate_query (gint32 image_ID,
if (orientation < 2 || orientation > 8)
return;
- parasite = gimp_parasite_find (JPEG_EXIF_ROTATE_PARASITE);
+ parasite = gimp_get_parasite (JPEG_EXIF_ROTATE_PARASITE);
if (parasite)
{
@@ -388,7 +388,7 @@ jpeg_exif_rotate_query_dialog (gint32 image_ID)
parasite = gimp_parasite_new (JPEG_EXIF_ROTATE_PARASITE,
GIMP_PARASITE_PERSISTENT,
strlen (str), str);
- gimp_parasite_attach (parasite);
+ gimp_attach_parasite (parasite);
gimp_parasite_free (parasite);
}
diff --git a/plug-ins/file-jpeg/jpeg-save.c b/plug-ins/file-jpeg/jpeg-save.c
index a56a08a..f68aa97 100644
--- a/plug-ins/file-jpeg/jpeg-save.c
+++ b/plug-ins/file-jpeg/jpeg-save.c
@@ -1266,7 +1266,7 @@ load_save_defaults (void)
jsvals.save_thumbnail = TRUE;
#endif /* HAVE_EXIF */
- parasite = gimp_parasite_find (JPEG_DEFAULTS_PARASITE);
+ parasite = gimp_get_parasite (JPEG_DEFAULTS_PARASITE);
if (! parasite)
return;
@@ -1321,7 +1321,7 @@ save_defaults (void)
GIMP_PARASITE_PERSISTENT,
strlen (def_str), def_str);
- gimp_parasite_attach (parasite);
+ gimp_attach_parasite (parasite);
gimp_parasite_free (parasite);
g_free (def_str);
diff --git a/plug-ins/pygimp/gimpmodule.c b/plug-ins/pygimp/gimpmodule.c
index 4a41b99..7fe283d 100644
--- a/plug-ins/pygimp/gimpmodule.c
+++ b/plug-ins/pygimp/gimpmodule.c
@@ -1239,7 +1239,7 @@ pygimp_parasite_find(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:parasite_find", &name))
return NULL;
- return pygimp_parasite_new(gimp_parasite_find(name));
+ return pygimp_parasite_new(gimp_get_parasite(name));
}
static PyObject *
@@ -1251,7 +1251,7 @@ pygimp_parasite_attach(PyObject *self, PyObject *args)
&PyGimpParasite_Type, ¶site))
return NULL;
- if (!gimp_parasite_attach(parasite->para)) {
+ if (!gimp_attach_parasite(parasite->para)) {
PyErr_Format(pygimp_error, "could not attach parasite '%s'",
gimp_parasite_name(parasite->para));
return NULL;
@@ -1274,7 +1274,7 @@ pygimp_attach_new_parasite(PyObject *self, PyObject *args)
parasite = gimp_parasite_new (name, flags, size, data);
- if (!gimp_parasite_attach (parasite)) {
+ if (!gimp_attach_parasite (parasite)) {
PyErr_Format(pygimp_error, "could not attach new parasite '%s'", name);
gimp_parasite_free (parasite);
return NULL;
@@ -1294,7 +1294,7 @@ pygimp_parasite_detach(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:parasite_detach", &name))
return NULL;
- if (!gimp_parasite_detach(name)) {
+ if (!gimp_detach_parasite(name)) {
PyErr_Format(pygimp_error, "could not detach parasite '%s'", name);
return NULL;
}
@@ -1309,7 +1309,9 @@ pygimp_parasite_list(PyObject *self)
gint num_parasites;
gchar **parasites;
- if (gimp_parasite_list(&num_parasites, ¶sites)) {
+ parasites = gimp_get_parasite_list (&num_parasites);
+
+ if (parasites) {
PyObject *ret;
gint i;
diff --git a/tools/pdbgen/Makefile.am b/tools/pdbgen/Makefile.am
index a921fc6..a324813 100644
--- a/tools/pdbgen/Makefile.am
+++ b/tools/pdbgen/Makefile.am
@@ -36,7 +36,6 @@ pdb_sources = \
pdb/palette.pdb \
pdb/palette_select.pdb \
pdb/palettes.pdb \
- pdb/parasite.pdb \
pdb/paths.pdb \
pdb/pattern.pdb \
pdb/pattern_select.pdb \
diff --git a/tools/pdbgen/groups.pl b/tools/pdbgen/groups.pl
index 692dae7..4681c3d 100644
--- a/tools/pdbgen/groups.pl
+++ b/tools/pdbgen/groups.pl
@@ -34,7 +34,6 @@
palette
palette_select
palettes
- parasite
paths
pattern
pattern_select
diff --git a/tools/pdbgen/pdb/gimp.pdb b/tools/pdbgen/pdb/gimp.pdb
index 3ab8f53..7e985c7 100644
--- a/tools/pdbgen/pdb/gimp.pdb
+++ b/tools/pdbgen/pdb/gimp.pdb
@@ -89,14 +89,116 @@ CODE
);
}
+sub attach_parasite {
+ $blurb = 'Add a global parasite.';
- headers = qw("core/gimp.h");
+ $help = <<'HELP';
+This procedure attaches a global parasite. It has no return values.
+HELP
+
+ &jay_pdb_misc('1998', '2.8');
+
+ @inargs = (
+ { name => 'parasite', type => 'parasite',
+ desc => 'The parasite to attach' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ gimp_parasite_attach (gimp, parasite);
+}
+CODE
+ );
+}
+
+sub detach_parasite {
+ $blurb = 'Removes a global parasite.';
+
+ $help = <<'HELP';
+This procedure detaches a global parasite from. It has no return values.
+HELP
+
+ &jay_pdb_misc('1998', '2.8');
+
+ @inargs = (
+ { name => 'name', type => 'string',
+ desc => 'The name of the parasite to detach.' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ gimp_parasite_detach (gimp, name);
+}
+CODE
+ );
+}
+
+sub get_parasite {
+ $blurb = 'Look up a global parasite.';
+
+ $help = <<'HELP';
+Finds and returns the global parasite that was previously attached.
+HELP
+
+ &jay_pdb_misc('1998', '2.8');
+
+ @inargs = (
+ { name => 'name', type => 'string',
+ desc => 'The name of the parasite to find' }
+ );
+
+ @outargs = (
+ { name => 'parasite', type => 'parasite',
+ desc => 'The found parasite' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ parasite = gimp_parasite_copy (gimp_parasite_find (gimp, name));
+
+ if (! parasite)
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub get_parasite_list {
+ $blurb = 'List all parasites.';
+ $help = 'Returns a list of all currently attached global parasites.';
+
+ &marc_pdb_misc('1999', '2.8');
+
+ @outargs = (
+ { name => 'parasites', type => 'stringarray',
+ desc => 'The names of currently attached parasites',
+ array => { desc => 'The number of attached parasites' } }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ parasites = gimp_parasite_list (gimp, &num_parasites);
+}
+CODE
+ );
+}
+
+
+ headers = qw("core/gimp.h"
+ "core/gimp-parasites.h");
@procs = qw(version
getpid
- quit);
+ quit
+ attach_parasite detach_parasite
+ get_parasite
+ get_parasite_list);
-%exports = (app => [ procs], lib => [ procs[0 1]]);
+%exports = (app => [ procs], lib => [ procs[0 1,3..6]]);
$desc = 'Miscellaneous';
$doc_title = 'gimp';
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]