diff --git a/app/pdb/gimp-pdb-compat.c b/app/pdb/gimp-pdb-compat.c index 4b174d6c84..c0f5db7ce0 100644 --- a/app/pdb/gimp-pdb-compat.c +++ b/app/pdb/gimp-pdb-compat.c @@ -471,7 +471,11 @@ gimp_pdb_compat_procs_register (GimpPDB *pdb, { "gimp-vectors-parasite-find", "gimp-item-get-parasite" }, { "gimp-vectors-parasite-attach", "gimp-item-attach-parasite" }, { "gimp-vectors-parasite-detach", "gimp-item-detach-parasite" }, - { "gimp-vectors-parasite-list", "gimp-item-get-parasite-list" } + { "gimp-vectors-parasite-list", "gimp-item-get-parasite-list" }, + { "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" } }; g_return_if_fail (GIMP_IS_PDB (pdb)); diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c index 9073afd594..7c5b3aca5c 100644 --- a/app/pdb/image-cmds.c +++ b/app/pdb/image-cmds.c @@ -2483,6 +2483,121 @@ image_get_vectors_by_tattoo_invoker (GimpProcedure *procedure, return return_vals; } +static GValueArray * +image_attach_parasite_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GimpImage *image; + const GimpParasite *parasite; + + image = gimp_value_get_image (&args->values[0], gimp); + parasite = g_value_get_boxed (&args->values[1]); + + if (success) + { + gimp_image_parasite_attach (image, parasite); + } + + return gimp_procedure_get_return_values (procedure, success, + error ? *error : NULL); +} + +static GValueArray * +image_detach_parasite_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GimpImage *image; + const gchar *name; + + image = gimp_value_get_image (&args->values[0], gimp); + name = g_value_get_string (&args->values[1]); + + if (success) + { + gimp_image_parasite_detach (image, name); + } + + return gimp_procedure_get_return_values (procedure, success, + error ? *error : NULL); +} + +static GValueArray * +image_get_parasite_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GValueArray *return_vals; + GimpImage *image; + const gchar *name; + GimpParasite *parasite = NULL; + + image = gimp_value_get_image (&args->values[0], gimp); + name = g_value_get_string (&args->values[1]); + + if (success) + { + parasite = gimp_parasite_copy (gimp_image_parasite_find (image, 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 * +image_get_parasite_list_invoker (GimpProcedure *procedure, + Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const GValueArray *args, + GError **error) +{ + gboolean success = TRUE; + GValueArray *return_vals; + GimpImage *image; + gint32 num_parasites = 0; + gchar **parasites = NULL; + + image = gimp_value_get_image (&args->values[0], gimp); + + if (success) + { + parasites = gimp_image_parasite_list (image, &num_parasites); + } + + return_vals = gimp_procedure_get_return_values (procedure, success, + error ? *error : NULL); + + if (success) + { + 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_image_procs (GimpPDB *pdb) { @@ -4959,4 +5074,131 @@ register_image_procs (GimpPDB *pdb) GIMP_PARAM_READWRITE)); gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); + + /* + * gimp-image-attach-parasite + */ + procedure = gimp_procedure_new (image_attach_parasite_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), + "gimp-image-attach-parasite"); + gimp_procedure_set_static_strings (procedure, + "gimp-image-attach-parasite", + "Add a parasite to an image.", + "This procedure attaches a parasite to an image. It has no return values.", + "Jay Cox", + "Jay Cox", + "1998", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_image_id ("image", + "image", + "The image", + pdb->gimp, FALSE, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + gimp_param_spec_parasite ("parasite", + "parasite", + "The parasite to attach to an image", + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + + /* + * gimp-image-detach-parasite + */ + procedure = gimp_procedure_new (image_detach_parasite_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), + "gimp-image-detach-parasite"); + gimp_procedure_set_static_strings (procedure, + "gimp-image-detach-parasite", + "Removes a parasite from an image.", + "This procedure detaches a parasite from an image. It has no return values.", + "Jay Cox", + "Jay Cox", + "1998", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_image_id ("image", + "image", + "The image", + pdb->gimp, FALSE, + GIMP_PARAM_READWRITE)); + gimp_procedure_add_argument (procedure, + gimp_param_spec_string ("name", + "name", + "The name of the parasite to detach from an image.", + FALSE, FALSE, FALSE, + NULL, + GIMP_PARAM_READWRITE)); + gimp_pdb_register_procedure (pdb, procedure); + g_object_unref (procedure); + + /* + * gimp-image-get-parasite + */ + procedure = gimp_procedure_new (image_get_parasite_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), + "gimp-image-get-parasite"); + gimp_procedure_set_static_strings (procedure, + "gimp-image-get-parasite", + "Look up a parasite in an image", + "Finds and returns the parasite that was previously attached to an image.", + "Jay Cox", + "Jay Cox", + "1998", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_image_id ("image", + "image", + "The image", + pdb->gimp, FALSE, + GIMP_PARAM_READWRITE)); + 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-image-get-parasite-list + */ + procedure = gimp_procedure_new (image_get_parasite_list_invoker); + gimp_object_set_static_name (GIMP_OBJECT (procedure), + "gimp-image-get-parasite-list"); + gimp_procedure_set_static_strings (procedure, + "gimp-image-get-parasite-list", + "List all parasites.", + "Returns a list of all currently attached parasites.", + "Marc Lehmann", + "Marc Lehmann", + "1999", + NULL); + gimp_procedure_add_argument (procedure, + gimp_param_spec_image_id ("image", + "image", + "The image", + pdb->gimp, FALSE, + GIMP_PARAM_READWRITE)); + 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/parasite-cmds.c b/app/pdb/parasite-cmds.c index 723390ed9f..4c7f44c7b1 100644 --- a/app/pdb/parasite-cmds.c +++ b/app/pdb/parasite-cmds.c @@ -26,7 +26,6 @@ #include "pdb-types.h" #include "core/gimp-parasites.h" -#include "core/gimpimage.h" #include "core/gimpparamspecs.h" #include "gimppdb.h" @@ -132,121 +131,6 @@ parasite_list_invoker (GimpProcedure *procedure, return return_vals; } -static GValueArray * -image_parasite_find_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GValueArray *return_vals; - GimpImage *image; - const gchar *name; - GimpParasite *parasite = NULL; - - image = gimp_value_get_image (&args->values[0], gimp); - name = g_value_get_string (&args->values[1]); - - if (success) - { - parasite = gimp_parasite_copy (gimp_image_parasite_find (image, 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 * -image_parasite_attach_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GimpImage *image; - const GimpParasite *parasite; - - image = gimp_value_get_image (&args->values[0], gimp); - parasite = g_value_get_boxed (&args->values[1]); - - if (success) - { - gimp_image_parasite_attach (image, parasite); - } - - return gimp_procedure_get_return_values (procedure, success, - error ? *error : NULL); -} - -static GValueArray * -image_parasite_detach_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GimpImage *image; - const gchar *name; - - image = gimp_value_get_image (&args->values[0], gimp); - name = g_value_get_string (&args->values[1]); - - if (success) - { - gimp_image_parasite_detach (image, name); - } - - return gimp_procedure_get_return_values (procedure, success, - error ? *error : NULL); -} - -static GValueArray * -image_parasite_list_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GValueArray *return_vals; - GimpImage *image; - gint32 num_parasites = 0; - gchar **parasites = NULL; - - image = gimp_value_get_image (&args->values[0], gimp); - - if (success) - { - parasites = gimp_image_parasite_list (image, &num_parasites); - } - - return_vals = gimp_procedure_get_return_values (procedure, success, - error ? *error : NULL); - - if (success) - { - 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) { @@ -354,131 +238,4 @@ register_parasite_procs (GimpPDB *pdb) GIMP_PARAM_READWRITE)); gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); - - /* - * gimp-image-parasite-find - */ - procedure = gimp_procedure_new (image_parasite_find_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), - "gimp-image-parasite-find"); - gimp_procedure_set_static_strings (procedure, - "gimp-image-parasite-find", - "Look up a parasite in an image", - "Finds and returns the parasite that was previously attached to an image.", - "Jay Cox", - "Jay Cox", - "1998", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_image_id ("image", - "image", - "The image", - pdb->gimp, FALSE, - GIMP_PARAM_READWRITE)); - 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-image-parasite-attach - */ - procedure = gimp_procedure_new (image_parasite_attach_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), - "gimp-image-parasite-attach"); - gimp_procedure_set_static_strings (procedure, - "gimp-image-parasite-attach", - "Add a parasite to an image.", - "This procedure attaches a parasite to an image. It has no return values.", - "Jay Cox", - "Jay Cox", - "1998", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_image_id ("image", - "image", - "The image", - pdb->gimp, FALSE, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - gimp_param_spec_parasite ("parasite", - "parasite", - "The parasite to attach to an image", - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - - /* - * gimp-image-parasite-detach - */ - procedure = gimp_procedure_new (image_parasite_detach_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), - "gimp-image-parasite-detach"); - gimp_procedure_set_static_strings (procedure, - "gimp-image-parasite-detach", - "Removes a parasite from an image.", - "This procedure detaches a parasite from an image. It has no return values.", - "Jay Cox", - "Jay Cox", - "1998", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_image_id ("image", - "image", - "The image", - pdb->gimp, FALSE, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - gimp_param_spec_string ("name", - "name", - "The name of the parasite to detach from an image.", - FALSE, FALSE, FALSE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - - /* - * gimp-image-parasite-list - */ - procedure = gimp_procedure_new (image_parasite_list_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), - "gimp-image-parasite-list"); - gimp_procedure_set_static_strings (procedure, - "gimp-image-parasite-list", - "List all parasites.", - "Returns a list of all currently attached parasites.", - "Marc Lehmann", - "Marc Lehmann", - "1999", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_image_id ("image", - "image", - "The image", - pdb->gimp, FALSE, - GIMP_PARAM_READWRITE)); - 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/libgimp/gimp.def b/libgimp/gimp.def index 1cda729236..992348b761 100644 --- a/libgimp/gimp.def +++ b/libgimp/gimp.def @@ -323,6 +323,7 @@ EXPORTS gimp_image_add_layer gimp_image_add_vectors gimp_image_add_vguide + gimp_image_attach_parasite gimp_image_attach_new_parasite gimp_image_base_type gimp_image_clean_all @@ -333,6 +334,7 @@ EXPORTS gimp_image_crop gimp_image_delete gimp_image_delete_guide + gimp_image_detach_parasite gimp_image_duplicate gimp_image_find_next_guide gimp_image_flatten @@ -359,6 +361,8 @@ EXPORTS gimp_image_get_layer_position gimp_image_get_layers gimp_image_get_name + gimp_image_get_parasite + gimp_image_get_parasite_list gimp_image_get_resolution gimp_image_get_selection gimp_image_get_tattoo_state diff --git a/libgimp/gimpimage.c b/libgimp/gimpimage.c index 870c4c0fd5..5b6f35b2ae 100644 --- a/libgimp/gimpimage.c +++ b/libgimp/gimpimage.c @@ -358,6 +358,74 @@ gimp_image_lower_vectors_to_bottom (gint32 image_ID, return gimp_image_lower_item_to_bottom (image_ID, vectors_ID); } +/** + * gimp_image_parasite_find: + * @image_ID: The image. + * @name: The name of the parasite to find. + * + * Deprecated: Use gimp_image_get_parasite() instead. + * + * Returns: The found parasite. + **/ +GimpParasite * +gimp_image_parasite_find (gint32 image_ID, + const gchar *name) +{ + return gimp_image_get_parasite (image_ID, name); +} + +/** + * gimp_image_parasite_attach: + * @image_ID: The image. + * @parasite: The parasite to attach to an image. + * + * Deprecated: Use gimp_image_attach_parasite() instead. + * + * Returns: TRUE on success. + **/ +gboolean +gimp_image_parasite_attach (gint32 image_ID, + const GimpParasite *parasite) +{ + return gimp_image_attach_parasite (image_ID, parasite); +} + +/** + * gimp_image_parasite_detach: + * @image_ID: The image. + * @name: The name of the parasite to detach from an image. + * + * Deprecated: Use gimp_image_detach_parasite() instead. + * + * Returns: TRUE on success. + **/ +gboolean +gimp_image_parasite_detach (gint32 image_ID, + const gchar *name) +{ + return gimp_image_detach_parasite (image_ID, name); +} + +/** + * gimp_image_parasite_list: + * @image_ID: The image. + * @num_parasites: The number of attached parasites. + * @parasites: The names of currently attached parasites. + * + * Deprecated: Use gimp_image_get_parasite_list() instead. + * + * Returns: TRUE on success. + **/ +gboolean +gimp_image_parasite_list (gint32 image_ID, + gint *num_parasites, + gchar ***parasites) +{ + *parasites = gimp_image_get_parasite_list (image_ID, num_parasites); + + return *parasites != NULL; +} + /** * gimp_image_attach_new_parasite: * @image_ID: the ID of the image to attach the #GimpParasite to. diff --git a/libgimp/gimpimage.h b/libgimp/gimpimage.h index 12f0792e8f..5a4976747b 100644 --- a/libgimp/gimpimage.h +++ b/libgimp/gimpimage.h @@ -26,54 +26,63 @@ G_BEGIN_DECLS /* For information look into the C source or the html documentation */ -guchar * gimp_image_get_colormap (gint32 image_ID, - gint *num_colors); -gboolean gimp_image_set_colormap (gint32 image_ID, - const guchar *colormap, - gint num_colors); +guchar * gimp_image_get_colormap (gint32 image_ID, + gint *num_colors); +gboolean gimp_image_set_colormap (gint32 image_ID, + const guchar *colormap, + gint num_colors); -guchar * gimp_image_get_thumbnail_data (gint32 image_ID, - gint *width, - gint *height, - gint *bpp); +guchar * gimp_image_get_thumbnail_data (gint32 image_ID, + gint *width, + gint *height, + gint *bpp); #ifndef GIMP_DISABLE_DEPRECATED -guchar * gimp_image_get_cmap (gint32 image_ID, - gint *num_colors); -gboolean gimp_image_set_cmap (gint32 image_ID, - const guchar *cmap, - gint num_colors); -gint gimp_image_get_layer_position (gint32 image_ID, - gint32 layer_ID); -gboolean gimp_image_raise_layer (gint32 image_ID, - gint32 layer_ID); -gboolean gimp_image_lower_layer (gint32 image_ID, - gint32 layer_ID); -gboolean gimp_image_raise_layer_to_top (gint32 image_ID, - gint32 layer_ID); -gboolean gimp_image_lower_layer_to_bottom (gint32 image_ID, - gint32 layer_ID); -gint gimp_image_get_channel_position (gint32 image_ID, - gint32 channel_ID); -gboolean gimp_image_raise_channel (gint32 image_ID, - gint32 channel_ID); -gboolean gimp_image_lower_channel (gint32 image_ID, - gint32 channel_ID); -gint gimp_image_get_vectors_position (gint32 image_ID, - gint32 vectors_ID); -gboolean gimp_image_raise_vectors (gint32 image_ID, - gint32 vectors_ID); -gboolean gimp_image_lower_vectors (gint32 image_ID, - gint32 vectors_ID); -gboolean gimp_image_raise_vectors_to_top (gint32 image_ID, - gint32 vectors_ID); -gboolean gimp_image_lower_vectors_to_bottom (gint32 image_ID, - gint32 vectors_ID); -gboolean gimp_image_attach_new_parasite (gint32 image_ID, - const gchar *name, - gint flags, - gint size, - gconstpointer data); +guchar * gimp_image_get_cmap (gint32 image_ID, + gint *num_colors); +gboolean gimp_image_set_cmap (gint32 image_ID, + const guchar *cmap, + gint num_colors); +gint gimp_image_get_layer_position (gint32 image_ID, + gint32 layer_ID); +gboolean gimp_image_raise_layer (gint32 image_ID, + gint32 layer_ID); +gboolean gimp_image_lower_layer (gint32 image_ID, + gint32 layer_ID); +gboolean gimp_image_raise_layer_to_top (gint32 image_ID, + gint32 layer_ID); +gboolean gimp_image_lower_layer_to_bottom (gint32 image_ID, + gint32 layer_ID); +gint gimp_image_get_channel_position (gint32 image_ID, + gint32 channel_ID); +gboolean gimp_image_raise_channel (gint32 image_ID, + gint32 channel_ID); +gboolean gimp_image_lower_channel (gint32 image_ID, + gint32 channel_ID); +gint gimp_image_get_vectors_position (gint32 image_ID, + gint32 vectors_ID); +gboolean gimp_image_raise_vectors (gint32 image_ID, + gint32 vectors_ID); +gboolean gimp_image_lower_vectors (gint32 image_ID, + gint32 vectors_ID); +gboolean gimp_image_raise_vectors_to_top (gint32 image_ID, + gint32 vectors_ID); +gboolean gimp_image_lower_vectors_to_bottom (gint32 image_ID, + gint32 vectors_ID); +GimpParasite * gimp_image_parasite_find (gint32 image_ID, + const gchar *name); +gboolean gimp_image_parasite_attach (gint32 image_ID, + const GimpParasite *parasite); +gboolean gimp_image_parasite_detach (gint32 image_ID, + const gchar *name); +gboolean gimp_image_parasite_list (gint32 image_ID, + gint *num_parasites, + gchar ***parasites); +gboolean gimp_image_attach_new_parasite (gint32 image_ID, + const gchar *name, + gint flags, + gint size, + gconstpointer data); #endif /* GIMP_DISABLE_DEPRECATED */ diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c index dce52fabed..145627edbe 100644 --- a/libgimp/gimpimage_pdb.c +++ b/libgimp/gimpimage_pdb.c @@ -2680,3 +2680,151 @@ gimp_image_get_vectors_by_tattoo (gint32 image_ID, return vectors_ID; } + +/** + * gimp_image_attach_parasite: + * @image_ID: The image. + * @parasite: The parasite to attach to an image. + * + * Add a parasite to an image. + * + * This procedure attaches a parasite to an image. It has no return + * values. + * + * Returns: TRUE on success. + * + * Since: GIMP 2.8 + **/ +gboolean +gimp_image_attach_parasite (gint32 image_ID, + const GimpParasite *parasite) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp-image-attach-parasite", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + 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_image_detach_parasite: + * @image_ID: The image. + * @name: The name of the parasite to detach from an image. + * + * Removes a parasite from an image. + * + * This procedure detaches a parasite from an image. It has no return + * values. + * + * Returns: TRUE on success. + * + * Since: GIMP 2.8 + **/ +gboolean +gimp_image_detach_parasite (gint32 image_ID, + const gchar *name) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp-image-detach-parasite", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + 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_image_get_parasite: + * @image_ID: The image. + * @name: The name of the parasite to find. + * + * Look up a parasite in an image + * + * Finds and returns the parasite that was previously attached to an + * image. + * + * Returns: The found parasite. + * + * Since: GIMP 2.8 + **/ +GimpParasite * +gimp_image_get_parasite (gint32 image_ID, + const gchar *name) +{ + GimpParam *return_vals; + gint nreturn_vals; + GimpParasite *parasite = NULL; + + return_vals = gimp_run_procedure ("gimp-image-get-parasite", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + 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_image_get_parasite_list: + * @image_ID: The image. + * @num_parasites: The number of attached parasites. + * + * List all parasites. + * + * Returns a list of all currently attached parasites. + * + * Returns: The names of currently attached parasites. + * + * Since: GIMP 2.8 + **/ +gchar ** +gimp_image_get_parasite_list (gint32 image_ID, + gint *num_parasites) +{ + GimpParam *return_vals; + gint nreturn_vals; + gchar **parasites = NULL; + gint i; + + return_vals = gimp_run_procedure ("gimp-image-get-parasite-list", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + 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/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h index 68060a56fb..194a02124e 100644 --- a/libgimp/gimpimage_pdb.h +++ b/libgimp/gimpimage_pdb.h @@ -197,6 +197,14 @@ gint32 gimp_image_get_channel_by_tattoo (gint32 gint tattoo); gint32 gimp_image_get_vectors_by_tattoo (gint32 image_ID, gint tattoo); +gboolean gimp_image_attach_parasite (gint32 image_ID, + const GimpParasite *parasite); +gboolean gimp_image_detach_parasite (gint32 image_ID, + const gchar *name); +GimpParasite* gimp_image_get_parasite (gint32 image_ID, + const gchar *name); +gchar** gimp_image_get_parasite_list (gint32 image_ID, + gint *num_parasites); G_END_DECLS diff --git a/libgimp/gimpparasite_pdb.c b/libgimp/gimpparasite_pdb.c index bfdbd2969e..26359c6aac 100644 --- a/libgimp/gimpparasite_pdb.c +++ b/libgimp/gimpparasite_pdb.c @@ -164,148 +164,3 @@ gimp_parasite_list (gint *num_parasites, return success; } - -/** - * gimp_image_parasite_find: - * @image_ID: The image. - * @name: The name of the parasite to find. - * - * Look up a parasite in an image - * - * Finds and returns the parasite that was previously attached to an - * image. - * - * Returns: The found parasite. - **/ -GimpParasite * -gimp_image_parasite_find (gint32 image_ID, - const gchar *name) -{ - GimpParam *return_vals; - gint nreturn_vals; - GimpParasite *parasite = NULL; - - return_vals = gimp_run_procedure ("gimp-image-parasite-find", - &nreturn_vals, - GIMP_PDB_IMAGE, image_ID, - 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_image_parasite_attach: - * @image_ID: The image. - * @parasite: The parasite to attach to an image. - * - * Add a parasite to an image. - * - * This procedure attaches a parasite to an image. It has no return - * values. - * - * Returns: TRUE on success. - **/ -gboolean -gimp_image_parasite_attach (gint32 image_ID, - const GimpParasite *parasite) -{ - GimpParam *return_vals; - gint nreturn_vals; - gboolean success = TRUE; - - return_vals = gimp_run_procedure ("gimp-image-parasite-attach", - &nreturn_vals, - GIMP_PDB_IMAGE, image_ID, - 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_image_parasite_detach: - * @image_ID: The image. - * @name: The name of the parasite to detach from an image. - * - * Removes a parasite from an image. - * - * This procedure detaches a parasite from an image. It has no return - * values. - * - * Returns: TRUE on success. - **/ -gboolean -gimp_image_parasite_detach (gint32 image_ID, - const gchar *name) -{ - GimpParam *return_vals; - gint nreturn_vals; - gboolean success = TRUE; - - return_vals = gimp_run_procedure ("gimp-image-parasite-detach", - &nreturn_vals, - GIMP_PDB_IMAGE, image_ID, - 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_image_parasite_list: - * @image_ID: The image. - * @num_parasites: The number of attached parasites. - * @parasites: The names of currently attached parasites. - * - * List all parasites. - * - * Returns a list of all currently attached parasites. - * - * Returns: TRUE on success. - **/ -gboolean -gimp_image_parasite_list (gint32 image_ID, - gint *num_parasites, - gchar ***parasites) -{ - GimpParam *return_vals; - gint nreturn_vals; - gboolean success = TRUE; - gint i; - - return_vals = gimp_run_procedure ("gimp-image-parasite-list", - &nreturn_vals, - GIMP_PDB_IMAGE, image_ID, - 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; -} diff --git a/libgimp/gimpparasite_pdb.h b/libgimp/gimpparasite_pdb.h index 43043aa303..5dfe3c43dc 100644 --- a/libgimp/gimpparasite_pdb.h +++ b/libgimp/gimpparasite_pdb.h @@ -28,20 +28,11 @@ 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); -GimpParasite* gimp_image_parasite_find (gint32 image_ID, - const gchar *name); -gboolean gimp_image_parasite_attach (gint32 image_ID, - const GimpParasite *parasite); -gboolean gimp_image_parasite_detach (gint32 image_ID, - const gchar *name); -gboolean gimp_image_parasite_list (gint32 image_ID, - gint *num_parasites, - gchar ***parasites); +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 diff --git a/plug-ins/common/compose.c b/plug-ins/common/compose.c index 695fb415e5..a7e274ed0f 100644 --- a/plug-ins/common/compose.c +++ b/plug-ins/common/compose.c @@ -479,8 +479,8 @@ run (const gchar *name, if (strcmp (name, RECOMPOSE_PROC) == 0) { - GimpParasite *parasite = gimp_image_parasite_find (param[1].data.d_image, - "decompose-data"); + GimpParasite *parasite = gimp_image_get_parasite (param[1].data.d_image, + "decompose-data"); if (! parasite) { diff --git a/plug-ins/common/decompose.c b/plug-ins/common/decompose.c index fa4b9a8168..20e30b5c10 100644 --- a/plug-ins/common/decompose.c +++ b/plug-ins/common/decompose.c @@ -459,7 +459,7 @@ run (const gchar *name, parasite = gimp_parasite_new ("decompose-data", 0, data->len + 1, data->str); - gimp_image_parasite_attach (image_ID_extract[j], parasite); + gimp_image_attach_parasite (image_ID_extract[j], parasite); gimp_parasite_free (parasite); if (run_mode != GIMP_RUN_NONINTERACTIVE) diff --git a/plug-ins/common/file-csource.c b/plug-ins/common/file-csource.c index 930fce1254..bdd5f0f479 100644 --- a/plug-ins/common/file-csource.c +++ b/plug-ins/common/file-csource.c @@ -160,7 +160,7 @@ run (const gchar *name, drawable_type == GIMP_GRAYA_IMAGE || drawable_type == GIMP_INDEXEDA_IMAGE); - parasite = gimp_image_parasite_find (image_ID, "gimp-comment"); + parasite = gimp_image_get_parasite (image_ID, "gimp-comment"); if (parasite) { config.comment = g_strndup (gimp_parasite_data (parasite), @@ -188,7 +188,7 @@ run (const gchar *name, { if (!config.comment || !config.comment[0]) { - gimp_image_parasite_detach (image_ID, "gimp-comment"); + gimp_image_attach_parasite (image_ID, "gimp-comment"); } else { @@ -196,7 +196,7 @@ run (const gchar *name, GIMP_PARASITE_PERSISTENT, strlen (config.comment) + 1, config.comment); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); } } diff --git a/plug-ins/common/file-dicom.c b/plug-ins/common/file-dicom.c index 5f551d3449..de437898e5 100644 --- a/plug-ins/common/file-dicom.c +++ b/plug-ins/common/file-dicom.c @@ -304,7 +304,7 @@ add_parasites_to_image (gpointer data, GimpParasite *parasite = (GimpParasite *) data; gint32 *image_ID = (gint32 *) user_data; - gimp_image_parasite_attach (*image_ID, parasite); + gimp_image_attach_parasite (*image_ID, parasite); gimp_parasite_free (parasite); } @@ -1038,7 +1038,7 @@ dicom_get_elements_list (gint32 image_ID) gchar **parasites = NULL; gint count = 0; - gimp_image_parasite_list (image_ID,&count,¶sites); + parasites = gimp_image_get_parasite_list (image_ID, &count); if (parasites && count > 0) { @@ -1048,7 +1048,7 @@ dicom_get_elements_list (gint32 image_ID) { if (strncmp (parasites[i], "dcm", 3) == 0) { - parasite = gimp_image_parasite_find (image_ID, parasites[i]); + parasite = gimp_image_get_parasite (image_ID, parasites[i]); if (parasite) { diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c index 805b0b2e9d..84e7b6c802 100644 --- a/plug-ins/common/file-gbr.c +++ b/plug-ins/common/file-gbr.c @@ -256,7 +256,7 @@ run (const gchar *name, break; } - parasite = gimp_image_parasite_find (orig_image_ID, "gimp-brush-name"); + parasite = gimp_image_get_parasite (orig_image_ID, "gimp-brush-name"); if (parasite) { gchar *name = g_strndup (gimp_parasite_data (parasite), @@ -318,12 +318,12 @@ run (const gchar *name, GIMP_PARASITE_PERSISTENT, strlen (info.description) + 1, info.description); - gimp_image_parasite_attach (orig_image_ID, parasite); + gimp_image_attach_parasite (orig_image_ID, parasite); gimp_parasite_free (parasite); } else { - gimp_image_parasite_detach (orig_image_ID, "gimp-brush-name"); + gimp_image_detach_parasite (orig_image_ID, "gimp-brush-name"); } } else @@ -588,7 +588,7 @@ load_image (const gchar *filename, parasite = gimp_parasite_new ("gimp-brush-name", GIMP_PARASITE_PERSISTENT, strlen (name) + 1, name); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); layer_ID = gimp_layer_new (image_ID, name, bh.width, bh.height, diff --git a/plug-ins/common/file-gif-load.c b/plug-ins/common/file-gif-load.c index f929ce53b9..621f4b24f7 100644 --- a/plug-ins/common/file-gif-load.c +++ b/plug-ins/common/file-gif-load.c @@ -494,7 +494,7 @@ load_image (const gchar *filename, if (comment_parasite != NULL) { if (! thumbnail) - gimp_image_parasite_attach (image_ID, comment_parasite); + gimp_image_attach_parasite (image_ID, comment_parasite); gimp_parasite_free (comment_parasite); comment_parasite = NULL; diff --git a/plug-ins/common/file-gif-save.c b/plug-ins/common/file-gif-save.c index 1659eca5a1..f1249fbbe1 100644 --- a/plug-ins/common/file-gif-save.c +++ b/plug-ins/common/file-gif-save.c @@ -674,7 +674,7 @@ save_image (const gchar *filename, GIMP_PARASITE_PERSISTENT, strlen (globalcomment) + 1, (void*) globalcomment); - gimp_image_parasite_attach (orig_image_ID, comment_parasite); + gimp_image_attach_parasite (orig_image_ID, comment_parasite); gimp_parasite_free (comment_parasite); comment_parasite = NULL; } @@ -1152,7 +1152,7 @@ save_dialog (gint32 image_ID) g_free (globalcomment); #ifdef FACEHUGGERS - GIF2_CMNT = gimp_image_parasite_find (image_ID, "gimp-comment"); + GIF2_CMNT = gimp_image_get_parasite (image_ID, "gimp-comment"); if (GIF2_CMNT) globalcomment = g_strndup (gimp_parasite_data (GIF2_CMNT), gimp_parasite_data_size (GIF2_CMNT)); diff --git a/plug-ins/common/file-gih.c b/plug-ins/common/file-gih.c index d5eb25746d..92ed17271d 100644 --- a/plug-ins/common/file-gih.c +++ b/plug-ins/common/file-gih.c @@ -334,8 +334,8 @@ run (const gchar *name, } pipe_parasite = - gimp_image_parasite_find (orig_image_ID, - "gimp-brush-pipe-parameters"); + gimp_image_get_parasite (orig_image_ID, + "gimp-brush-pipe-parameters"); if (pipe_parasite) gimp_pixpipe_params_parse (gimp_parasite_data (pipe_parasite), &gihparams); @@ -383,8 +383,8 @@ run (const gchar *name, case GIMP_RUN_WITH_LAST_VALS: gimp_get_data (SAVE_PROC, &info); pipe_parasite = - gimp_image_parasite_find (orig_image_ID, - "gimp-brush-pipe-parameters"); + gimp_image_get_parasite (orig_image_ID, + "gimp-brush-pipe-parameters"); gimp_pixpipe_params_init (&gihparams); if (pipe_parasite) gimp_pixpipe_params_parse (gimp_parasite_data (pipe_parasite), @@ -731,7 +731,7 @@ gih_load_image (const gchar *filename, GIMP_PARASITE_PERSISTENT, strlen (paramstring) + 1, paramstring); - gimp_image_parasite_attach (image_ID, pipe_parasite); + gimp_image_attach_parasite (image_ID, pipe_parasite); gimp_parasite_free (pipe_parasite); g_free (paramstring); } @@ -1285,7 +1285,7 @@ gih_save_image (const gchar *filename, pipe_parasite = gimp_parasite_new ("gimp-brush-pipe-parameters", GIMP_PARASITE_PERSISTENT, strlen (parstring) + 1, parstring); - gimp_image_parasite_attach (orig_image_ID, pipe_parasite); + gimp_image_attach_parasite (orig_image_ID, pipe_parasite); gimp_parasite_free (pipe_parasite); g_free (parstring); diff --git a/plug-ins/common/file-jp2-load.c b/plug-ins/common/file-jp2-load.c index 4356772ed8..3dd1844644 100644 --- a/plug-ins/common/file-jp2-load.c +++ b/plug-ins/common/file-jp2-load.c @@ -457,7 +457,7 @@ load_icc_profile (jas_image_t *jas_image, GIMP_PARASITE_PERSISTENT | GIMP_PARASITE_UNDOABLE, profile_size, jas_iccile); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); g_free (jas_iccile); diff --git a/plug-ins/common/file-pat.c b/plug-ins/common/file-pat.c index b6691da3d2..98cb787c31 100644 --- a/plug-ins/common/file-pat.c +++ b/plug-ins/common/file-pat.c @@ -226,7 +226,7 @@ run (const gchar *name, break; } - parasite = gimp_image_parasite_find (orig_image_ID, "gimp-pattern-name"); + parasite = gimp_image_get_parasite (orig_image_ID, "gimp-pattern-name"); if (parasite) { gchar *name = g_strndup (gimp_parasite_data (parasite), @@ -287,12 +287,12 @@ run (const gchar *name, GIMP_PARASITE_PERSISTENT, strlen (description) + 1, description); - gimp_image_parasite_attach (orig_image_ID, parasite); + gimp_image_attach_parasite (orig_image_ID, parasite); gimp_parasite_free (parasite); } else { - gimp_image_parasite_detach (orig_image_ID, "gimp-pattern-name"); + gimp_image_detach_parasite (orig_image_ID, "gimp-pattern-name"); } } else @@ -427,7 +427,7 @@ load_image (const gchar *filename, parasite = gimp_parasite_new ("gimp-pattern-name", GIMP_PARASITE_PERSISTENT, strlen (name) + 1, name); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); layer_ID = gimp_layer_new (image_ID, name, ph.width, ph.height, diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c index 0cc0fc84f5..44320ddf8a 100644 --- a/plug-ins/common/file-png.c +++ b/plug-ins/common/file-png.c @@ -871,7 +871,7 @@ load_image (const gchar *filename, parasite = gimp_parasite_new ("gamma", GIMP_PARASITE_PERSISTENT, strlen (buf) + 1, buf); - gimp_image_parasite_attach (image, parasite); + gimp_image_attach_parasite (image, parasite); gimp_parasite_free (parasite); } @@ -1056,7 +1056,7 @@ load_image (const gchar *filename, parasite = gimp_parasite_new ("gimp-comment", GIMP_PARASITE_PERSISTENT, strlen (comment) + 1, comment); - gimp_image_parasite_attach (image, parasite); + gimp_image_attach_parasite (image, parasite); gimp_parasite_free (parasite); } @@ -1083,7 +1083,7 @@ load_image (const gchar *filename, GIMP_PARASITE_UNDOABLE, proflen, profile); - gimp_image_parasite_attach (image, parasite); + gimp_image_attach_parasite (image, parasite); gimp_parasite_free (parasite); if (profname) @@ -1097,7 +1097,7 @@ load_image (const gchar *filename, GIMP_PARASITE_PERSISTENT | GIMP_PARASITE_UNDOABLE, strlen (tmp), tmp); - gimp_image_parasite_attach (image, parasite); + gimp_image_attach_parasite (image, parasite); gimp_parasite_free (parasite); g_free (tmp); @@ -1209,7 +1209,7 @@ save_image (const gchar *filename, GimpParasite *parasite; gsize text_length = 0; - parasite = gimp_image_parasite_find (orig_image_ID, "gimp-comment"); + parasite = gimp_image_get_parasite (orig_image_ID, "gimp-comment"); if (parasite) { gchar *comment = g_strndup (gimp_parasite_data (parasite), @@ -1391,7 +1391,7 @@ save_image (const gchar *filename, GimpParasite *parasite; gdouble gamma = 1.0 / DEFAULT_GAMMA; - parasite = gimp_image_parasite_find (orig_image_ID, "gamma"); + parasite = gimp_image_get_parasite (orig_image_ID, "gamma"); if (parasite) { gamma = g_ascii_strtod (gimp_parasite_data (parasite), NULL); @@ -1436,12 +1436,12 @@ save_image (const gchar *filename, GimpParasite *profile_parasite; gchar *profile_name = NULL; - profile_parasite = gimp_image_parasite_find (orig_image_ID, "icc-profile"); + profile_parasite = gimp_image_get_parasite (orig_image_ID, "icc-profile"); if (profile_parasite) { - GimpParasite *parasite = gimp_image_parasite_find (orig_image_ID, - "icc-profile-name"); + GimpParasite *parasite = gimp_image_get_parasite (orig_image_ID, + "icc-profile-name"); if (parasite) profile_name = g_convert (gimp_parasite_data (parasite), gimp_parasite_data_size (parasite), @@ -1845,7 +1845,7 @@ save_dialog (gint32 image_ID, &pngvals.time); /* Comment toggle */ - parasite = gimp_image_parasite_find (image_ID, "gimp-comment"); + parasite = gimp_image_get_parasite (image_ID, "gimp-comment"); pg.comment = toggle_button_init (builder, "save-comment", pngvals.comment && parasite != NULL, diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c index 04897d5b53..b56518531f 100644 --- a/plug-ins/common/file-psp.c +++ b/plug-ins/common/file-psp.c @@ -964,7 +964,7 @@ read_creator_block (FILE *f, GIMP_PARASITE_PERSISTENT, strlen (comment->str) + 1, comment->str); - gimp_image_parasite_attach(image_ID, comment_parasite); + gimp_image_attach_parasite (image_ID, comment_parasite); gimp_parasite_free (comment_parasite); } @@ -1657,7 +1657,7 @@ read_tube_block (FILE *f, pipe_parasite = gimp_parasite_new ("gimp-brush-pipe-parameters", GIMP_PARASITE_PERSISTENT, strlen (parasite_text) + 1, parasite_text); - gimp_image_parasite_attach (image_ID, pipe_parasite); + gimp_image_attach_parasite (image_ID, pipe_parasite); gimp_parasite_free (pipe_parasite); g_free (parasite_text); diff --git a/plug-ins/common/file-tiff-load.c b/plug-ins/common/file-tiff-load.c index 913411f7f7..664256492b 100644 --- a/plug-ins/common/file-tiff-load.c +++ b/plug-ins/common/file-tiff-load.c @@ -802,7 +802,7 @@ load_image (const gchar *filename, GIMP_PARASITE_PERSISTENT | GIMP_PARASITE_UNDOABLE, profile_size, icc_profile); - gimp_image_parasite_attach (image, parasite); + gimp_image_attach_parasite (image, parasite); gimp_parasite_free (parasite); } #endif @@ -834,7 +834,7 @@ load_image (const gchar *filename, parasite = gimp_parasite_new ("tiff-save-options", 0, sizeof (save_vals), &save_vals); - gimp_image_parasite_attach (image, parasite); + gimp_image_attach_parasite (image, parasite); gimp_parasite_free (parasite); /* Attach a parasite containing the image description. Pretend to @@ -849,7 +849,7 @@ load_image (const gchar *filename, parasite = gimp_parasite_new ("gimp-comment", GIMP_PARASITE_PERSISTENT, strlen (img_desc) + 1, img_desc); - gimp_image_parasite_attach (image, parasite); + gimp_image_attach_parasite (image, parasite); gimp_parasite_free (parasite); } } diff --git a/plug-ins/common/file-tiff-save.c b/plug-ins/common/file-tiff-save.c index a0ce6f8034..ec649f0cee 100644 --- a/plug-ins/common/file-tiff-save.c +++ b/plug-ins/common/file-tiff-save.c @@ -265,7 +265,7 @@ run (const gchar *name, break; } - parasite = gimp_image_parasite_find (orig_image, "gimp-comment"); + parasite = gimp_image_get_parasite (orig_image, "gimp-comment"); if (parasite) { image_comment = g_strndup (gimp_parasite_data (parasite), @@ -279,7 +279,7 @@ run (const gchar *name, /* Possibly retrieve data */ gimp_get_data (SAVE_PROC, &tsvals); - parasite = gimp_image_parasite_find (orig_image, "tiff-save-options"); + parasite = gimp_image_get_parasite (orig_image, "tiff-save-options"); if (parasite) { const TiffSaveVals *pvals = gimp_parasite_data (parasite); @@ -326,7 +326,7 @@ run (const gchar *name, /* Possibly retrieve data */ gimp_get_data (SAVE_PROC, &tsvals); - parasite = gimp_image_parasite_find (orig_image, "tiff-save-options"); + parasite = gimp_image_get_parasite (orig_image, "tiff-save-options"); if (parasite) { const TiffSaveVals *pvals = gimp_parasite_data (parasite); @@ -906,7 +906,7 @@ save_image (const gchar *filename, parasite = gimp_parasite_new ("gimp-comment", GIMP_PARASITE_PERSISTENT, strlen (image_comment) + 1, image_comment); - gimp_image_parasite_attach (orig_image, parasite); + gimp_image_attach_parasite (orig_image, parasite); gimp_parasite_free (parasite); } @@ -917,7 +917,7 @@ save_image (const gchar *filename, uint32 profile_size; const guchar *icc_profile; - parasite = gimp_image_parasite_find (orig_image, "icc-profile"); + parasite = gimp_image_get_parasite (orig_image, "icc-profile"); if (parasite) { profile_size = gimp_parasite_data_size (parasite); diff --git a/plug-ins/common/file-xbm.c b/plug-ins/common/file-xbm.c index 444ae82606..0017a1a2e4 100644 --- a/plug-ins/common/file-xbm.c +++ b/plug-ins/common/file-xbm.c @@ -375,7 +375,7 @@ run (const gchar *name, if (run_mode == GIMP_RUN_INTERACTIVE) { /* Get the parasites */ - parasite = gimp_image_parasite_find (image_ID, "gimp-comment"); + parasite = gimp_image_get_parasite (image_ID, "gimp-comment"); if (parasite) { @@ -388,7 +388,7 @@ run (const gchar *name, gimp_parasite_free (parasite); } - parasite = gimp_image_parasite_find (image_ID, "hot-spot"); + parasite = gimp_image_get_parasite (image_ID, "hot-spot"); if (parasite) { @@ -866,7 +866,7 @@ load_image (const gchar *filename, parasite = gimp_parasite_new ("gimp-comment", GIMP_PARASITE_PERSISTENT, strlen (comment) + 1, (gpointer) comment); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); g_free (comment); @@ -885,7 +885,7 @@ load_image (const gchar *filename, GIMP_PARASITE_PERSISTENT, strlen (str) + 1, (gpointer) str); g_free (str); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); } diff --git a/plug-ins/common/file-xmc.c b/plug-ins/common/file-xmc.c index ee0e01cc23..d648b2dc79 100644 --- a/plug-ins/common/file-xmc.c +++ b/plug-ins/common/file-xmc.c @@ -1747,7 +1747,7 @@ save_image (const gchar *filename, /* Save the comment back to the original image */ for (i = 0; i < 3; i++) { - gimp_image_parasite_detach (orig_image_ID, parasiteName[i]); + gimp_image_detach_parasite (orig_image_ID, parasiteName[i]); if (xmcparas.comments[i]) { @@ -1914,11 +1914,11 @@ set_comment_to_pname (const gint32 image_ID, g_return_val_if_fail (image_ID != -1, FALSE); g_return_val_if_fail (content, FALSE); - parasite = gimp_image_parasite_find (image_ID, pname); + parasite = gimp_image_get_parasite (image_ID, pname); if (! parasite) { parasite = gimp_parasite_new (pname, GIMP_PARASITE_PERSISTENT, - strlen (content) + 1, content); + strlen (content) + 1, content); } else { @@ -1934,7 +1934,7 @@ set_comment_to_pname (const gint32 image_ID, if (parasite) { - ret = gimp_image_parasite_attach (image_ID, parasite); + ret = gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); } @@ -1954,7 +1954,7 @@ get_comment_from_pname (const gint32 image_ID, g_return_val_if_fail (image_ID != -1, NULL); - parasite = gimp_image_parasite_find (image_ID, pname); + parasite = gimp_image_get_parasite (image_ID, pname); length = gimp_parasite_data_size (parasite); if (parasite) @@ -1995,7 +1995,7 @@ set_hotspot_to_parasite (gint32 image_ID) if (parasite) { - ret = gimp_image_parasite_attach (image_ID, parasite); + ret = gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); } @@ -2017,7 +2017,7 @@ get_hotspot_from_parasite (gint32 image_ID) DM_XMC("function: getHotsopt\n"); - parasite = gimp_image_parasite_find (image_ID, "hot-spot"); + parasite = gimp_image_get_parasite (image_ID, "hot-spot"); if (!parasite) /* cannot find a parasite named "hot-spot". */ { return FALSE; diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c index 790af76a59..206ffe18a9 100644 --- a/plug-ins/common/lcms.c +++ b/plug-ins/common/lcms.c @@ -756,7 +756,7 @@ lcms_image_get_profile (GimpColorConfig *config, g_return_val_if_fail (image != -1, NULL); - parasite = gimp_image_parasite_find (image, "icc-profile"); + parasite = gimp_image_get_parasite (image, "icc-profile"); if (parasite) { @@ -838,7 +838,7 @@ lcms_image_set_profile (gint32 image, g_mapped_file_unref (file); - gimp_image_parasite_attach (image, parasite); + gimp_image_attach_parasite (image, parasite); gimp_parasite_free (parasite); } else @@ -846,10 +846,10 @@ lcms_image_set_profile (gint32 image, if (undo_group) gimp_image_undo_group_start (image); - gimp_image_parasite_detach (image, "icc-profile"); + gimp_image_detach_parasite (image, "icc-profile"); } - gimp_image_parasite_detach (image, "icc-profile-name"); + gimp_image_detach_parasite (image, "icc-profile-name"); if (undo_group) gimp_image_undo_group_end (image); diff --git a/plug-ins/common/screenshot.c b/plug-ins/common/screenshot.c index f067df6e5a..47a7af47e3 100644 --- a/plug-ins/common/screenshot.c +++ b/plug-ins/common/screenshot.c @@ -793,7 +793,7 @@ create_image (GdkPixbuf *pixbuf, parasite = gimp_parasite_new ("gimp-comment", GIMP_PARASITE_PERSISTENT, strlen (comment) + 1, comment); - gimp_image_parasite_attach (image, parasite); + gimp_image_attach_parasite (image, parasite); gimp_parasite_free (parasite); g_free (comment); diff --git a/plug-ins/file-jpeg/gimpexif.c b/plug-ins/file-jpeg/gimpexif.c index 7f4f752ede..136ee2d7aa 100644 --- a/plug-ins/file-jpeg/gimpexif.c +++ b/plug-ins/file-jpeg/gimpexif.c @@ -63,7 +63,7 @@ void gimp_metadata_store_exif (gint32 image_ID, parasite = gimp_parasite_new ("exif-data", GIMP_PARASITE_PERSISTENT, exif_buf_len, exif_buf); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); } return_vals = gimp_run_procedure ("plug-in-metadata-decode-exif", @@ -96,8 +96,8 @@ ExifData * gimp_metadata_generate_exif (gint32 image_ID) { ExifData *exif_data; - GimpParasite *parasite = gimp_image_parasite_find (image_ID, - "exif-data"); + GimpParasite *parasite = gimp_image_get_parasite (image_ID, "exif-data"); + if (parasite) { exif_data = exif_data_new_from_data (gimp_parasite_data (parasite), diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c index 581b6e3b38..e5fed82574 100644 --- a/plug-ins/file-jpeg/jpeg-load.c +++ b/plug-ins/file-jpeg/jpeg-load.c @@ -317,7 +317,7 @@ load_image (const gchar *filename, GIMP_PARASITE_PERSISTENT, strlen (comment_buffer->str) + 1, comment_buffer->str); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); g_string_free (comment_buffer, TRUE); @@ -387,7 +387,7 @@ load_image (const gchar *filename, GIMP_PARASITE_PERSISTENT | GIMP_PARASITE_UNDOABLE, profile_size, profile); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); } diff --git a/plug-ins/file-jpeg/jpeg-save.c b/plug-ins/file-jpeg/jpeg-save.c index d6dd96c222..a56a08a5bd 100644 --- a/plug-ins/file-jpeg/jpeg-save.c +++ b/plug-ins/file-jpeg/jpeg-save.c @@ -600,7 +600,7 @@ save_image (const gchar *filename, if (jsvals.save_xmp) { /* FIXME: temporary hack until the right thing is done by a library */ - parasite = gimp_image_parasite_find (orig_image_ID, "gimp-metadata"); + parasite = gimp_image_get_parasite (orig_image_ID, "gimp-metadata"); if (parasite) { const gchar *xmp_data; @@ -626,7 +626,7 @@ save_image (const gchar *filename, } /* Step 4.3: store the color profile if there is one */ - parasite = gimp_image_parasite_find (orig_image_ID, "icc-profile"); + parasite = gimp_image_get_parasite (orig_image_ID, "icc-profile"); if (parasite) { jpeg_icc_write_profile (&cinfo, diff --git a/plug-ins/file-jpeg/jpeg-settings.c b/plug-ins/file-jpeg/jpeg-settings.c index d749fcf082..2b87ed01f0 100644 --- a/plug-ins/file-jpeg/jpeg-settings.c +++ b/plug-ins/file-jpeg/jpeg-settings.c @@ -136,7 +136,7 @@ jpeg_detect_original_settings (struct jpeg_decompress_struct *cinfo, parasite_size, parasite_data); g_free (parasite_data); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); return TRUE; } @@ -187,7 +187,7 @@ jpeg_restore_original_settings (gint32 image_ID, g_return_val_if_fail (subsmp != NULL, FALSE); g_return_val_if_fail (num_quant_tables != NULL, FALSE); - parasite = gimp_image_parasite_find (image_ID, "jpeg-settings"); + parasite = gimp_image_get_parasite (image_ID, "jpeg-settings"); if (parasite) { src = gimp_parasite_data (parasite); @@ -283,7 +283,7 @@ jpeg_restore_original_tables (gint32 image_ID, gint t; gint i; - parasite = gimp_image_parasite_find (image_ID, "jpeg-settings"); + parasite = gimp_image_get_parasite (image_ID, "jpeg-settings"); if (parasite) { src_size = gimp_parasite_data_size (parasite); @@ -344,7 +344,7 @@ jpeg_swap_original_settings (gint32 image_ID) gint i; gint j; - parasite = gimp_image_parasite_find (image_ID, "jpeg-settings"); + parasite = gimp_image_get_parasite (image_ID, "jpeg-settings"); if (parasite) { src_size = gimp_parasite_data_size (parasite); @@ -393,7 +393,7 @@ jpeg_swap_original_settings (gint32 image_ID) src_size, new_data); g_free (new_data); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); } } gimp_parasite_free (parasite); diff --git a/plug-ins/file-jpeg/jpeg.c b/plug-ins/file-jpeg/jpeg.c index bfda6e5e05..775e677aa0 100644 --- a/plug-ins/file-jpeg/jpeg.c +++ b/plug-ins/file-jpeg/jpeg.c @@ -323,7 +323,7 @@ run (const gchar *name, g_free (image_comment); image_comment = NULL; - parasite = gimp_image_parasite_find (orig_image_ID, "gimp-comment"); + parasite = gimp_image_get_parasite (orig_image_ID, "gimp-comment"); if (parasite) { image_comment = g_strndup (gimp_parasite_data (parasite), @@ -331,7 +331,7 @@ run (const gchar *name, gimp_parasite_free (parasite); } - parasite = gimp_image_parasite_find (orig_image_ID, "gimp-metadata"); + parasite = gimp_image_get_parasite (orig_image_ID, "gimp-metadata"); if (parasite) { has_metadata = TRUE; @@ -399,8 +399,8 @@ run (const gchar *name, &num_quant_tables); /* load up the previously used values (if file was saved once) */ - parasite = gimp_image_parasite_find (orig_image_ID, - "jpeg-save-options"); + parasite = gimp_image_get_parasite (orig_image_ID, + "jpeg-save-options"); if (parasite) { const JpegSaveVals *save_vals = gimp_parasite_data (parasite); @@ -505,21 +505,21 @@ run (const gchar *name, * was used to save this image. Dump the old parasites * and add new ones. */ - gimp_image_parasite_detach (orig_image_ID, "gimp-comment"); + gimp_image_detach_parasite (orig_image_ID, "gimp-comment"); if (image_comment && strlen (image_comment)) { parasite = gimp_parasite_new ("gimp-comment", GIMP_PARASITE_PERSISTENT, strlen (image_comment) + 1, image_comment); - gimp_image_parasite_attach (orig_image_ID, parasite); + gimp_image_attach_parasite (orig_image_ID, parasite); gimp_parasite_free (parasite); } - gimp_image_parasite_detach (orig_image_ID, "jpeg-save-options"); + gimp_image_detach_parasite (orig_image_ID, "jpeg-save-options"); parasite = gimp_parasite_new ("jpeg-save-options", - 0, sizeof (jsvals), &jsvals); - gimp_image_parasite_attach (orig_image_ID, parasite); + 0, sizeof (jsvals), &jsvals); + gimp_image_attach_parasite (orig_image_ID, parasite); gimp_parasite_free (parasite); } } diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c index 3dd53dc37c..60e6a12ecb 100644 --- a/plug-ins/file-psd/psd-image-res-load.c +++ b/plug-ins/file-psd/psd-image-res-load.c @@ -446,7 +446,7 @@ load_resource_unknown (const PSDimageres *res_a, IFDBG(2) g_debug ("Parasite name: %s", name); parasite = gimp_parasite_new (name, 0, res_a->data_len, data); - gimp_image_parasite_attach (image_id, parasite); + gimp_image_attach_parasite (image_id, parasite); gimp_parasite_free (parasite); g_free (data); g_free (name); @@ -481,7 +481,7 @@ load_resource_ps_only (const PSDimageres *res_a, IFDBG(2) g_debug ("Parasite name: %s", name); parasite = gimp_parasite_new (name, 0, res_a->data_len, data); - gimp_image_parasite_attach (image_id, parasite); + gimp_image_attach_parasite (image_id, parasite); gimp_parasite_free (parasite); g_free (data); g_free (name); @@ -723,7 +723,7 @@ load_resource_1008 (const PSDimageres *res_a, IFDBG(3) g_debug ("Caption: %s", caption); parasite = gimp_parasite_new (GIMP_PARASITE_COMMENT, GIMP_PARASITE_PERSISTENT, write_len, caption); - gimp_image_parasite_attach (image_id, parasite); + gimp_image_attach_parasite (image_id, parasite); gimp_parasite_free (parasite); g_free (caption); @@ -820,7 +820,7 @@ load_resource_1028 (const PSDimageres *res_a, parasite = gimp_parasite_new (GIMP_PARASITE_IPTC, GIMP_PARASITE_PERSISTENT, iptc_buf_len, iptc_buf); - gimp_image_parasite_attach (image_id, parasite); + gimp_image_attach_parasite (image_id, parasite); gimp_parasite_free (parasite); } @@ -835,7 +835,7 @@ load_resource_1028 (const PSDimageres *res_a, IFDBG(3) g_debug ("Parasite name: %s", name); parasite = gimp_parasite_new (name, 0, res_a->data_len, res_data); - gimp_image_parasite_attach (image_id, parasite); + gimp_image_attach_parasite (image_id, parasite); gimp_parasite_free (parasite); g_free (name); @@ -1077,7 +1077,7 @@ load_resource_1039 (const PSDimageres *res_a, parasite = gimp_parasite_new (GIMP_PARASITE_ICC_PROFILE, GIMP_PARASITE_PERSISTENT, res_a->data_len, icc_profile); - gimp_image_parasite_attach (image_id, parasite); + gimp_image_attach_parasite (image_id, parasite); gimp_parasite_free (parasite); g_free (icc_profile); @@ -1300,7 +1300,7 @@ load_resource_1058 (const PSDimageres *res_a, parasite = gimp_parasite_new (GIMP_PARASITE_EXIF, GIMP_PARASITE_PERSISTENT, exif_buf_len, exif_buf); - gimp_image_parasite_attach (image_id, parasite); + gimp_image_attach_parasite (image_id, parasite); gimp_parasite_free (parasite); } exif_data_unref (exif_data); @@ -1314,7 +1314,7 @@ load_resource_1058 (const PSDimageres *res_a, IFDBG(3) g_debug ("Parasite name: %s", name); parasite = gimp_parasite_new (name, 0, res_a->data_len, res_data); - gimp_image_parasite_attach (image_id, parasite); + gimp_image_attach_parasite (image_id, parasite); gimp_parasite_free (parasite); g_free (name); diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c index 0071a400c9..969a2663fc 100644 --- a/plug-ins/file-psd/psd-load.c +++ b/plug-ins/file-psd/psd-load.c @@ -942,14 +942,17 @@ add_color_map (const gint32 image_id, if (img_a->color_map_len) { if (img_a->color_mode != PSD_DUOTONE) - gimp_image_set_colormap (image_id, img_a->color_map, img_a->color_map_entries); + { + gimp_image_set_colormap (image_id, img_a->color_map, + img_a->color_map_entries); + } else { /* Add parasite for Duotone color data */ IFDBG(2) g_debug ("Add Duotone color data parasite"); parasite = gimp_parasite_new (PSD_PARASITE_DUOTONE_DATA, 0, img_a->color_map_len, img_a->color_map); - gimp_image_parasite_attach (image_id, parasite); + gimp_image_attach_parasite (image_id, parasite); gimp_parasite_free (parasite); } g_free (img_a->color_map); diff --git a/plug-ins/file-xjt/xjt.c b/plug-ins/file-xjt/xjt.c index ec41cac43a..ebfac01dad 100644 --- a/plug-ins/file-xjt/xjt.c +++ b/plug-ins/file-xjt/xjt.c @@ -1364,12 +1364,14 @@ p_write_image_parasites(const gchar *dirname, gchar **l_parasite_names = NULL; gint32 l_num_parasites = 0; - if (!gimp_image_parasite_list (image_id, &l_num_parasites, &l_parasite_names)) + l_parasite_names = gimp_image_get_parasite_list (image_id, &l_num_parasites); + + if (!l_parasite_names) return; for(l_idx = 0; l_idx < l_num_parasites; l_idx++) { - l_parasite = gimp_image_parasite_find(image_id, l_parasite_names[l_idx]); + l_parasite = gimp_image_get_parasite (image_id, l_parasite_names[l_idx]); if(l_parasite) { if(xjt_debug) printf("p_write_image_parasites NAME:%s:\n", l_parasite_names[l_idx]); @@ -2559,8 +2561,8 @@ p_create_and_attach_parasite (gint32 gimp_obj_id, */ if(parasite_props->parasite_type == XJT_IMAGE_PARASITE) { - if(xjt_debug) printf("XJT: gimp_image_parasite_attach name:%s\n", l_parasite.name); - gimp_image_parasite_attach(gimp_obj_id, &l_parasite); + if(xjt_debug) printf("XJT: gimp_image_attach_parasite name:%s\n", l_parasite.name); + gimp_image_attach_parasite(gimp_obj_id, &l_parasite); } else diff --git a/plug-ins/metadata/exif-decode.c b/plug-ins/metadata/exif-decode.c index 013d0bec46..b55521cce9 100644 --- a/plug-ins/metadata/exif-decode.c +++ b/plug-ins/metadata/exif-decode.c @@ -61,7 +61,7 @@ xmp_merge_from_exifbuffer (XMPModel *xmp_model, GError **error) { ExifData *exif_data; - GimpParasite *parasite = gimp_image_parasite_find (image_ID, "exif-data"); + GimpParasite *parasite = gimp_image_get_parasite (image_ID, "exif-data"); if (!parasite) return FALSE; diff --git a/plug-ins/metadata/metadata.c b/plug-ins/metadata/metadata.c index 17e844822e..cf37a835cd 100644 --- a/plug-ins/metadata/metadata.c +++ b/plug-ins/metadata/metadata.c @@ -385,7 +385,7 @@ run (const gchar *name, xmp_model = xmp_model_new (); /* if there is already a metadata parasite, load it */ - parasite = gimp_image_parasite_find (image_ID, METADATA_PARASITE); + parasite = gimp_image_get_parasite (image_ID, METADATA_PARASITE); if (parasite) { GError *error = NULL; @@ -549,7 +549,7 @@ run (const gchar *name, GIMP_PARASITE_PERSISTENT, buffer->len, (gpointer) buffer->str); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); if (! strcmp (name, ENCODE_XMP_PROC)) { *nreturn_vals = 2; diff --git a/plug-ins/print/print-utils.c b/plug-ins/print/print-utils.c index 4f68d714dd..743d6ed045 100644 --- a/plug-ins/print/print-utils.c +++ b/plug-ins/print/print-utils.c @@ -55,7 +55,7 @@ print_utils_key_file_load_from_parasite (gint32 image_ID, g_return_val_if_fail (parasite_name != NULL, NULL); - parasite = gimp_image_parasite_find (image_ID, parasite_name); + parasite = gimp_image_get_parasite (image_ID, parasite_name); if (! parasite) return NULL; @@ -140,6 +140,6 @@ print_utils_key_file_save_as_parasite (GKeyFile *key_file, parasite = gimp_parasite_new (parasite_name, 0, length, contents); g_free (contents); - gimp_image_parasite_attach (image_ID, parasite); + gimp_image_attach_parasite (image_ID, parasite); gimp_parasite_free (parasite); } diff --git a/plug-ins/pygimp/pygimp-drawable.c b/plug-ins/pygimp/pygimp-drawable.c index 8c97a40937..b21dc4975f 100644 --- a/plug-ins/pygimp/pygimp-drawable.c +++ b/plug-ins/pygimp/pygimp-drawable.c @@ -270,7 +270,7 @@ drw_attach_new_parasite(PyGimpDrawable *self, PyObject *args, PyObject *kwargs) parasite = gimp_parasite_new (name, flags, size + 1, data); - success = gimp_image_parasite_attach (self->ID, parasite); + success = gimp_item_attach_parasite (self->ID, parasite); gimp_parasite_free (parasite); if (!success) { diff --git a/plug-ins/pygimp/pygimp-image.c b/plug-ins/pygimp/pygimp-image.c index 10befe7a34..ee25ec1bf4 100644 --- a/plug-ins/pygimp/pygimp-image.c +++ b/plug-ins/pygimp/pygimp-image.c @@ -647,7 +647,7 @@ img_parasite_find(PyGimpImage *self, PyObject *args) if (!PyArg_ParseTuple(args, "s:parasite_find", &name)) return NULL; - return pygimp_parasite_new(gimp_image_parasite_find(self->ID, name)); + return pygimp_parasite_new (gimp_image_get_parasite (self->ID, name)); } static PyObject * @@ -659,7 +659,7 @@ img_parasite_attach(PyGimpImage *self, PyObject *args) ¶site)) return NULL; - if (!gimp_image_parasite_attach(self->ID, parasite->para)) { + if (! gimp_image_attach_parasite (self->ID, parasite->para)) { PyErr_Format(pygimp_error, "could not attach parasite '%s' to image (ID %d)", parasite->para->name, self->ID); @@ -687,7 +687,7 @@ img_attach_new_parasite(PyGimpImage *self, PyObject *args, PyObject *kwargs) return NULL; parasite = gimp_parasite_new (name, flags, size, data); - success = gimp_image_parasite_attach (self->ID, parasite); + success = gimp_image_attach_parasite (self->ID, parasite); gimp_parasite_free (parasite); if (!success) { @@ -709,7 +709,7 @@ img_parasite_detach(PyGimpImage *self, PyObject *args) if (!PyArg_ParseTuple(args, "s:parasite_detach", &name)) return NULL; - if (!gimp_image_parasite_detach(self->ID, name)) { + if (!gimp_image_detach_parasite (self->ID, name)) { PyErr_Format(pygimp_error, "could not detach parasite '%s' from image (ID %d)", name, self->ID); @@ -726,7 +726,9 @@ img_parasite_list(PyGimpImage *self) gint num_parasites; gchar **parasites; - if (gimp_image_parasite_list(self->ID, &num_parasites, ¶sites)) { + parasites = gimp_image_get_parasite_list (self->ID, &num_parasites); + + if (parasites) { PyObject *ret; gint i; diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index 4764a90801..70d630619f 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -2496,6 +2496,115 @@ CODE ); } +sub image_attach_parasite { + $blurb = 'Add a parasite to an image.'; + + $help = <<'HELP'; +This procedure attaches a parasite to an image. It has no return values. +HELP + + &jay_pdb_misc('1998', '2.8'); + + @inargs = ( + { name => 'image', type => 'image', + desc => 'The image' }, + { name => 'parasite', type => 'parasite', + desc => 'The parasite to attach to an image' } + ); + + %invoke = ( + code => <<'CODE' +{ + gimp_image_parasite_attach (image, parasite); +} +CODE + ); +} + +sub image_detach_parasite { + $blurb = 'Removes a parasite from an image.'; + + $help = <<'HELP'; +This procedure detaches a parasite from an image. It has no return values. +HELP + + &jay_pdb_misc('1998', '2.8'); + + @inargs = ( + { name => 'image', type => 'image', + desc => 'The image' }, + { name => 'name', type => 'string', + desc => 'The name of the parasite to detach from an image.' } + ); + + %invoke = ( + code => <<'CODE' +{ + gimp_image_parasite_detach (image, name); +} +CODE + ); +} + +sub image_get_parasite { + $blurb = 'Look up a parasite in an image'; + + $help = <<'HELP'; +Finds and returns the parasite that was previously attached to an image. +HELP + + &jay_pdb_misc('1998', '2.8'); + + @inargs = ( + { name => 'image', type => 'image', + desc => 'The image' }, + { 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_image_parasite_find (image, name)); + + if (! parasite) + success = FALSE; +} +CODE + ); +} + +sub image_get_parasite_list { + $blurb = 'List all parasites.'; + $help = 'Returns a list of all currently attached parasites.'; + + &marc_pdb_misc('1999', '2.8'); + + @inargs = ( + { name => 'image', type => 'image', + desc => 'The image' } + ); + + @outargs = ( + { name => 'parasites', type => 'stringarray', + desc => 'The names of currently attached parasites', + array => { desc => 'The number of attached parasites' } } + ); + + %invoke = ( + code => <<'CODE' +{ + parasites = gimp_image_parasite_list (image, &num_parasites); +} +CODE + ); +} + sub image_thumbnail { $blurb = 'Get a thumbnail of an image.'; @@ -2639,9 +2748,12 @@ CODE image_get_tattoo_state image_set_tattoo_state image_get_layer_by_tattoo image_get_channel_by_tattoo - image_get_vectors_by_tattoo); + image_get_vectors_by_tattoo + image_attach_parasite image_detach_parasite + image_get_parasite + image_get_parasite_list); -%exports = (app => [@procs], lib => [@procs[0..42,45..73]]); +%exports = (app => [@procs], lib => [@procs[0..42,45..77]]); $desc = 'Image'; $doc_title = 'gimpimage'; diff --git a/tools/pdbgen/pdb/parasite.pdb b/tools/pdbgen/pdb/parasite.pdb index 73233208c9..b9f11fbb10 100644 --- a/tools/pdbgen/pdb/parasite.pdb +++ b/tools/pdbgen/pdb/parasite.pdb @@ -114,123 +114,11 @@ CODE ); } -sub image_parasite_find { - $blurb = 'Look up a parasite in an image'; - - $help = <<'HELP'; -Finds and returns the parasite that was previously attached to an image. -HELP - - &jay_pdb_misc('1998'); - - @inargs = ( - { name => 'image', type => 'image', - desc => 'The image' }, - { 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_image_parasite_find (image, name)); - - if (! parasite) - success = FALSE; -} -CODE - ); -} - -sub image_parasite_attach { - $blurb = 'Add a parasite to an image.'; - - $help = <<'HELP'; -This procedure attaches a parasite to an image. It has no return values. -HELP - - &jay_pdb_misc('1998'); - - @inargs = ( - { name => 'image', type => 'image', - desc => 'The image' }, - { name => 'parasite', type => 'parasite', - desc => 'The parasite to attach to an image' } - ); - - %invoke = ( - code => <<'CODE' -{ - gimp_image_parasite_attach (image, parasite); -} -CODE - ); -} - -sub image_parasite_detach { - $blurb = 'Removes a parasite from an image.'; - - $help = <<'HELP'; -This procedure detaches a parasite from an image. It has no return values. -HELP - - &jay_pdb_misc('1998'); - - @inargs = ( - { name => 'image', type => 'image', - desc => 'The image' }, - { name => 'name', type => 'string', - desc => 'The name of the parasite to detach from an image.' } - ); - - %invoke = ( - code => <<'CODE' -{ - gimp_image_parasite_detach (image, name); -} -CODE - ); -} - -sub image_parasite_list { - $blurb = 'List all parasites.'; - $help = 'Returns a list of all currently attached parasites.'; - - &marc_pdb_misc('1999'); - - @inargs = ( - { name => 'image', type => 'image', - desc => 'The image' } - ); - - @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_image_parasite_list (image, &num_parasites); -} -CODE - ); -} - @headers = qw("core/gimp-parasites.h"); @procs = qw(parasite_find parasite_attach parasite_detach - parasite_list - image_parasite_find - image_parasite_attach image_parasite_detach - image_parasite_list); + parasite_list); %exports = (app => [@procs], lib => [@procs]);