libgimp: deprecate and rename the global pararasite functions

just as it was done for items and images. Remove the "parasite" PDB
group completely.
This commit is contained in:
Michael Natterer 2011-03-08 14:31:04 +01:00
parent db6f3dfe89
commit bb6436cb44
23 changed files with 535 additions and 607 deletions

View File

@ -69,7 +69,6 @@ libappinternal_procs_a_SOURCES = \
palette-cmds.c \ palette-cmds.c \
palette-select-cmds.c \ palette-select-cmds.c \
palettes-cmds.c \ palettes-cmds.c \
parasite-cmds.c \
paths-cmds.c \ paths-cmds.c \
pattern-cmds.c \ pattern-cmds.c \
pattern-select-cmds.c \ pattern-select-cmds.c \

View File

@ -26,6 +26,7 @@
#include "pdb-types.h" #include "pdb-types.h"
#include "base/base-utils.h" #include "base/base-utils.h"
#include "core/gimp-parasites.h"
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpparamspecs.h" #include "core/gimpparamspecs.h"
@ -94,6 +95,104 @@ quit_invoker (GimpProcedure *procedure,
error ? *error : NULL); 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 void
register_gimp_procs (GimpPDB *pdb) register_gimp_procs (GimpPDB *pdb)
{ {
@ -168,4 +267,107 @@ register_gimp_procs (GimpPDB *pdb)
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (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);
} }

View File

@ -475,7 +475,11 @@ gimp_pdb_compat_procs_register (GimpPDB *pdb,
{ "gimp-image-parasite-find", "gimp-image-get-parasite" }, { "gimp-image-parasite-find", "gimp-image-get-parasite" },
{ "gimp-image-parasite-attach", "gimp-image-attach-parasite" }, { "gimp-image-parasite-attach", "gimp-image-attach-parasite" },
{ "gimp-image-parasite-detach", "gimp-image-detach-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)); g_return_if_fail (GIMP_IS_PDB (pdb));

View File

@ -69,7 +69,6 @@ internal_procs_init (GimpPDB *pdb)
register_palette_procs (pdb); register_palette_procs (pdb);
register_palette_select_procs (pdb); register_palette_select_procs (pdb);
register_palettes_procs (pdb); register_palettes_procs (pdb);
register_parasite_procs (pdb);
register_paths_procs (pdb); register_paths_procs (pdb);
register_pattern_procs (pdb); register_pattern_procs (pdb);
register_pattern_select_procs (pdb); register_pattern_select_procs (pdb);

View File

@ -58,7 +58,6 @@ void register_paint_tools_procs (GimpPDB *pdb);
void register_palette_procs (GimpPDB *pdb); void register_palette_procs (GimpPDB *pdb);
void register_palette_select_procs (GimpPDB *pdb); void register_palette_select_procs (GimpPDB *pdb);
void register_palettes_procs (GimpPDB *pdb); void register_palettes_procs (GimpPDB *pdb);
void register_parasite_procs (GimpPDB *pdb);
void register_paths_procs (GimpPDB *pdb); void register_paths_procs (GimpPDB *pdb);
void register_pattern_procs (GimpPDB *pdb); void register_pattern_procs (GimpPDB *pdb);
void register_pattern_select_procs (GimpPDB *pdb); void register_pattern_select_procs (GimpPDB *pdb);

View File

@ -1,241 +0,0 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl. */
#include "config.h"
#include <gegl.h>
#include "libgimpbase/gimpbase.h"
#include "pdb-types.h"
#include "core/gimp-parasites.h"
#include "core/gimpparamspecs.h"
#include "gimppdb.h"
#include "gimpprocedure.h"
#include "internal-procs.h"
static GValueArray *
parasite_find_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 *
parasite_attach_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 *
parasite_detach_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 *
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_parasite_procs (GimpPDB *pdb)
{
GimpProcedure *procedure;
/*
* gimp-parasite-find
*/
procedure = gimp_procedure_new (parasite_find_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-parasite-find");
gimp_procedure_set_static_strings (procedure,
"gimp-parasite-find",
"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-parasite-attach
*/
procedure = gimp_procedure_new (parasite_attach_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-parasite-attach");
gimp_procedure_set_static_strings (procedure,
"gimp-parasite-attach",
"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-parasite-detach
*/
procedure = gimp_procedure_new (parasite_detach_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-parasite-detach");
gimp_procedure_set_static_strings (procedure,
"gimp-parasite-detach",
"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-parasite-list
*/
procedure = gimp_procedure_new (parasite_list_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-parasite-list");
gimp_procedure_set_static_strings (procedure,
"gimp-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);
}

View File

@ -102,7 +102,6 @@ PDB_WRAPPERS_C = \
gimppalette_pdb.c \ gimppalette_pdb.c \
gimppalettes_pdb.c \ gimppalettes_pdb.c \
gimppaletteselect_pdb.c \ gimppaletteselect_pdb.c \
gimpparasite_pdb.c \
gimppaths_pdb.c \ gimppaths_pdb.c \
gimppattern_pdb.c \ gimppattern_pdb.c \
gimppatterns_pdb.c \ gimppatterns_pdb.c \
@ -155,7 +154,6 @@ PDB_WRAPPERS_H = \
gimppalette_pdb.h \ gimppalette_pdb.h \
gimppalettes_pdb.h \ gimppalettes_pdb.h \
gimppaletteselect_pdb.h \ gimppaletteselect_pdb.h \
gimpparasite_pdb.h \
gimppaths_pdb.h \ gimppaths_pdb.h \
gimppattern_pdb.h \ gimppattern_pdb.h \
gimppatterns_pdb.h \ gimppatterns_pdb.h \

View File

@ -1504,6 +1504,66 @@ gimp_extension_process (guint timeout)
#endif #endif
} }
/**
* 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: * gimp_attach_new_parasite:
* @name: the name of the #GimpParasite to create and attach. * @name: the name of the #GimpParasite to create and attach.

View File

@ -333,10 +333,15 @@ const gchar * gimp_get_progname (void) G_GNUC_CONST;
gboolean gimp_install_cmap (void) G_GNUC_CONST; gboolean gimp_install_cmap (void) G_GNUC_CONST;
gint gimp_min_colors (void) G_GNUC_CONST; gint gimp_min_colors (void) G_GNUC_CONST;
gboolean gimp_attach_new_parasite (const gchar *name, GimpParasite * gimp_parasite_find (const gchar *name);
gint flags, gboolean gimp_parasite_attach (const GimpParasite *parasite);
gint size, gboolean gimp_parasite_detach (const gchar *name);
gconstpointer data); 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 */ #endif /* GIMP_DISABLE_DEPRECATED */

View File

@ -92,3 +92,137 @@ gimp_getpid (void)
return pid; 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;
}

View File

@ -28,8 +28,12 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
gchar* gimp_version (void); gchar* gimp_version (void);
gint gimp_getpid (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 G_END_DECLS

View File

@ -57,7 +57,6 @@
#include <libgimp/gimppalette_pdb.h> #include <libgimp/gimppalette_pdb.h>
#include <libgimp/gimppalettes_pdb.h> #include <libgimp/gimppalettes_pdb.h>
#include <libgimp/gimppaletteselect_pdb.h> #include <libgimp/gimppaletteselect_pdb.h>
#include <libgimp/gimpparasite_pdb.h>
#include <libgimp/gimppaths_pdb.h> #include <libgimp/gimppaths_pdb.h>
#include <libgimp/gimppattern_pdb.h> #include <libgimp/gimppattern_pdb.h>
#include <libgimp/gimppatterns_pdb.h> #include <libgimp/gimppatterns_pdb.h>

View File

@ -1,166 +0,0 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpparasite_pdb.c
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#include "config.h"
#include "gimp.h"
/**
* SECTION: gimpparasite
* @title: gimpparasite
* @short_description: Operations related to parasites.
*
* Operations related to parasites.
**/
/**
* gimp_parasite_find:
* @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.
**/
GimpParasite *
gimp_parasite_find (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpParasite *parasite = NULL;
return_vals = gimp_run_procedure ("gimp-parasite-find",
&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_parasite_attach:
* @parasite: The parasite to attach.
*
* Add a global parasite.
*
* This procedure attaches a global parasite. It has no return values.
*
* Returns: TRUE on success.
**/
gboolean
gimp_parasite_attach (const GimpParasite *parasite)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-parasite-attach",
&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_parasite_detach:
* @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.
**/
gboolean
gimp_parasite_detach (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-parasite-detach",
&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_parasite_list:
* @num_parasites: The number of attached parasites.
* @parasites: The names of currently attached parasites.
*
* List all parasites.
*
* Returns a list of all currently attached global parasites.
*
* Returns: TRUE on success.
**/
gboolean
gimp_parasite_list (gint *num_parasites,
gchar ***parasites)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
gint i;
return_vals = gimp_run_procedure ("gimp-parasite-list",
&nreturn_vals,
GIMP_PDB_END);
*num_parasites = 0;
*parasites = NULL;
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
if (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 success;
}

View File

@ -1,40 +0,0 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpparasite_pdb.h
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#ifndef __GIMP_PARASITE_PDB_H__
#define __GIMP_PARASITE_PDB_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
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);
G_END_DECLS
#endif /* __GIMP_PARASITE_PDB_H__ */

View File

@ -549,7 +549,7 @@ load_image (const gchar *filename,
GimpParasite *parasite; GimpParasite *parasite;
gchar pname[255]; 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), g_snprintf (pname, sizeof (pname),
"dcm/%04x-%04x-%s", group_word, element_word, value_rep); "dcm/%04x-%04x-%s", group_word, element_word, value_rep);
if ((parasite = gimp_parasite_new (pname, if ((parasite = gimp_parasite_new (pname,

View File

@ -1912,7 +1912,7 @@ load_defaults (void)
{ {
GimpParasite *parasite; GimpParasite *parasite;
parasite = gimp_parasite_find (PNG_DEFAULTS_PARASITE); parasite = gimp_get_parasite (PNG_DEFAULTS_PARASITE);
if (parasite) if (parasite)
{ {
@ -1969,7 +1969,7 @@ save_defaults (void)
GIMP_PARASITE_PERSISTENT, GIMP_PARASITE_PERSISTENT,
strlen (def_str), def_str); strlen (def_str), def_str);
gimp_parasite_attach (parasite); gimp_attach_parasite (parasite);
gimp_parasite_free (parasite); gimp_parasite_free (parasite);
g_free (def_str); g_free (def_str);

View File

@ -253,7 +253,7 @@ jpeg_exif_rotate_query (gint32 image_ID,
if (orientation < 2 || orientation > 8) if (orientation < 2 || orientation > 8)
return; return;
parasite = gimp_parasite_find (JPEG_EXIF_ROTATE_PARASITE); parasite = gimp_get_parasite (JPEG_EXIF_ROTATE_PARASITE);
if (parasite) if (parasite)
{ {
@ -388,7 +388,7 @@ jpeg_exif_rotate_query_dialog (gint32 image_ID)
parasite = gimp_parasite_new (JPEG_EXIF_ROTATE_PARASITE, parasite = gimp_parasite_new (JPEG_EXIF_ROTATE_PARASITE,
GIMP_PARASITE_PERSISTENT, GIMP_PARASITE_PERSISTENT,
strlen (str), str); strlen (str), str);
gimp_parasite_attach (parasite); gimp_attach_parasite (parasite);
gimp_parasite_free (parasite); gimp_parasite_free (parasite);
} }

View File

@ -1266,7 +1266,7 @@ load_save_defaults (void)
jsvals.save_thumbnail = TRUE; jsvals.save_thumbnail = TRUE;
#endif /* HAVE_EXIF */ #endif /* HAVE_EXIF */
parasite = gimp_parasite_find (JPEG_DEFAULTS_PARASITE); parasite = gimp_get_parasite (JPEG_DEFAULTS_PARASITE);
if (! parasite) if (! parasite)
return; return;
@ -1321,7 +1321,7 @@ save_defaults (void)
GIMP_PARASITE_PERSISTENT, GIMP_PARASITE_PERSISTENT,
strlen (def_str), def_str); strlen (def_str), def_str);
gimp_parasite_attach (parasite); gimp_attach_parasite (parasite);
gimp_parasite_free (parasite); gimp_parasite_free (parasite);
g_free (def_str); g_free (def_str);

View File

@ -1239,7 +1239,7 @@ pygimp_parasite_find(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:parasite_find", &name)) if (!PyArg_ParseTuple(args, "s:parasite_find", &name))
return NULL; return NULL;
return pygimp_parasite_new(gimp_parasite_find(name)); return pygimp_parasite_new(gimp_get_parasite(name));
} }
static PyObject * static PyObject *
@ -1251,7 +1251,7 @@ pygimp_parasite_attach(PyObject *self, PyObject *args)
&PyGimpParasite_Type, &parasite)) &PyGimpParasite_Type, &parasite))
return NULL; return NULL;
if (!gimp_parasite_attach(parasite->para)) { if (!gimp_attach_parasite(parasite->para)) {
PyErr_Format(pygimp_error, "could not attach parasite '%s'", PyErr_Format(pygimp_error, "could not attach parasite '%s'",
gimp_parasite_name(parasite->para)); gimp_parasite_name(parasite->para));
return NULL; return NULL;
@ -1274,7 +1274,7 @@ pygimp_attach_new_parasite(PyObject *self, PyObject *args)
parasite = gimp_parasite_new (name, flags, size, data); 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); PyErr_Format(pygimp_error, "could not attach new parasite '%s'", name);
gimp_parasite_free (parasite); gimp_parasite_free (parasite);
return NULL; return NULL;
@ -1294,7 +1294,7 @@ pygimp_parasite_detach(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:parasite_detach", &name)) if (!PyArg_ParseTuple(args, "s:parasite_detach", &name))
return NULL; return NULL;
if (!gimp_parasite_detach(name)) { if (!gimp_detach_parasite(name)) {
PyErr_Format(pygimp_error, "could not detach parasite '%s'", name); PyErr_Format(pygimp_error, "could not detach parasite '%s'", name);
return NULL; return NULL;
} }
@ -1309,7 +1309,9 @@ pygimp_parasite_list(PyObject *self)
gint num_parasites; gint num_parasites;
gchar **parasites; gchar **parasites;
if (gimp_parasite_list(&num_parasites, &parasites)) { parasites = gimp_get_parasite_list (&num_parasites);
if (parasites) {
PyObject *ret; PyObject *ret;
gint i; gint i;

View File

@ -36,7 +36,6 @@ pdb_sources = \
pdb/palette.pdb \ pdb/palette.pdb \
pdb/palette_select.pdb \ pdb/palette_select.pdb \
pdb/palettes.pdb \ pdb/palettes.pdb \
pdb/parasite.pdb \
pdb/paths.pdb \ pdb/paths.pdb \
pdb/pattern.pdb \ pdb/pattern.pdb \
pdb/pattern_select.pdb \ pdb/pattern_select.pdb \

View File

@ -34,7 +34,6 @@
palette palette
palette_select palette_select
palettes palettes
parasite
paths paths
pattern pattern
pattern_select pattern_select

View File

@ -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 @procs = qw(version
getpid 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'; $desc = 'Miscellaneous';
$doc_title = 'gimp'; $doc_title = 'gimp';

View File

@ -1,130 +0,0 @@
# GIMP - The GNU Image Manipulation Program
# Copyright (C) 1998 Jay Cox <jaycox@earthlink.net>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub parasite_find {
$blurb = 'Look up a global parasite.';
$help = <<'HELP';
Finds and returns the global parasite that was previously attached.
HELP
&jay_pdb_misc('1998');
@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 parasite_attach {
$blurb = 'Add a global parasite.';
$help = <<'HELP';
This procedure attaches a global parasite. It has no return values.
HELP
&jay_pdb_misc('1998');
@inargs = (
{ name => 'parasite', type => 'parasite',
desc => 'The parasite to attach' }
);
%invoke = (
code => <<'CODE'
{
gimp_parasite_attach (gimp, parasite);
}
CODE
);
}
sub parasite_detach {
$blurb = 'Removes a global parasite.';
$help = <<'HELP';
This procedure detaches a global parasite from. It has no return values.
HELP
&jay_pdb_misc('1998');
@inargs = (
{ name => 'name', type => 'string',
desc => 'The name of the parasite to detach.' }
);
%invoke = (
code => <<'CODE'
{
gimp_parasite_detach (gimp, name);
}
CODE
);
}
sub parasite_list {
$blurb = 'List all parasites.';
$help = 'Returns a list of all currently attached global parasites.';
&marc_pdb_misc('1999');
@outargs = (
{ name => 'parasites', type => 'stringarray', void_ret => 1,
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-parasites.h");
@procs = qw(parasite_find
parasite_attach parasite_detach
parasite_list);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Parasite procedures';
$doc_title = 'gimpparasite';
$doc_short_desc = 'Operations related to parasites.';
$doc_long_desc = 'Operations related to parasites.';
1;