diff --git a/libgimp/gimp.def b/libgimp/gimp.def index 1e5d29d94d..c5ff000521 100644 --- a/libgimp/gimp.def +++ b/libgimp/gimp.def @@ -703,9 +703,6 @@ EXPORTS gimp_pdb_lookup_procedure gimp_pdb_procedure_exists gimp_pdb_query_procedures - gimp_pdb_run_procedure - gimp_pdb_run_procedure_config - gimp_pdb_run_procedure_valist gimp_pdb_set_data gimp_pdb_temp_procedure_name gimp_pencil @@ -766,6 +763,8 @@ EXPORTS gimp_procedure_new_arguments gimp_procedure_new_return_values gimp_procedure_run + gimp_procedure_run_config + gimp_procedure_run_valist gimp_procedure_set_argument_sync gimp_procedure_set_attribution gimp_procedure_set_documentation diff --git a/libgimp/gimppdb.c b/libgimp/gimppdb.c index ab3b16c769..7ea8f819a9 100644 --- a/libgimp/gimppdb.c +++ b/libgimp/gimppdb.c @@ -20,20 +20,16 @@ #include "config.h" -#include - #include "gimp.h" #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "gimp-private.h" #include "gimpgpparams.h" #include "gimppdb-private.h" #include "gimppdb_pdb.h" #include "gimppdbprocedure.h" #include "gimpplugin-private.h" -#include "gimpprocedureconfig-private.h" #include "libgimp-intl.h" @@ -190,160 +186,6 @@ gimp_pdb_lookup_procedure (GimpPDB *pdb, return procedure; } -/** - * gimp_pdb_run_procedure: (skip) - * @pdb: the #GimpPDB object. - * @procedure_name: the procedure registered name. - * @first_arg_name: the name of an argument of @procedure_name. - * @...: the call arguments. - * - * Runs the procedure named @procedure_name with arguments given as - * list of `(name, value)` pairs, terminated by %NULL. - * - * The order of arguments does not matter and if any argument is missing, its - * default value will be used. The value type must correspond to the argument - * type as registered for @procedure_name. - * - * Returns: (transfer full): the return values for the procedure call. - * - * Since: 3.0 - */ -GimpValueArray * -gimp_pdb_run_procedure (GimpPDB *pdb, - const gchar *procedure_name, - const gchar *first_arg_name, - ...) -{ - GimpValueArray *return_values; - va_list args; - - g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL); - g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL); - - va_start (args, first_arg_name); - - return_values = gimp_pdb_run_procedure_valist (pdb, procedure_name, - first_arg_name, args); - - va_end (args); - - return return_values; -} - -/** - * gimp_pdb_run_procedure_valist: (skip) - * @pdb: the #GimpPDB object. - * @procedure_name: the procedure registered name. - * @first_arg_name: the name of an argument of @procedure_name. - * @args: the call arguments. - * - * Runs the procedure named @procedure_name with arguments name, type and value - * given in the order as passed to [method@PDB.run_procedure]. - * - * Returns: (transfer full): the return values for the procedure call. - * - * Since: 3.0 - */ -GimpValueArray * -gimp_pdb_run_procedure_valist (GimpPDB *pdb, - const gchar *procedure_name, - const gchar *first_arg_name, - va_list args) -{ - GimpValueArray *return_values; - GimpProcedure *procedure; - GimpProcedureConfig *config; - const gchar *arg_name; - - g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL); - g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL); - - procedure = gimp_pdb_lookup_procedure (pdb, procedure_name); - config = gimp_procedure_create_config (procedure); - - arg_name = first_arg_name; - - while (arg_name != NULL) - { - GParamSpec *pspec; - gchar *error = NULL; - GValue value = G_VALUE_INIT; - - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), arg_name); - - if (pspec == NULL) - { - g_warning ("%s: %s has no property named '%s'", - G_STRFUNC, - g_type_name (G_TYPE_FROM_INSTANCE (config)), - arg_name); - g_clear_object (&config); - return NULL; - } - - g_value_init (&value, pspec->value_type); - G_VALUE_COLLECT (&value, args, G_VALUE_NOCOPY_CONTENTS, &error); - - if (error) - { - g_warning ("%s: %s", G_STRFUNC, error); - g_free (error); - g_clear_object (&config); - return NULL; - } - - g_object_set_property (G_OBJECT (config), arg_name, &value); - g_value_unset (&value); - - arg_name = va_arg (args, const gchar *); - } - - return_values = gimp_pdb_run_procedure_config (pdb, procedure_name, config); - g_clear_object (&config); - - return return_values; -} - -/** - * gimp_pdb_run_procedure_config: - * @pdb: the #GimpPDB object. - * @procedure_name: the registered name to call. - * @config: a config object obtained with gimp_procedure_create_config(). - * - * Runs the procedure named @procedure_name with @config. - * - * Returns: (transfer full): the return values for the procedure call. - * - * Since: 3.0 - */ -GimpValueArray * -gimp_pdb_run_procedure_config (GimpPDB *pdb, - const gchar *procedure_name, - GimpProcedureConfig *config) -{ - GimpProcedure *procedure; - GimpValueArray *args; - GimpValueArray *return_values; - - g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL); - g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL); - g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), NULL); - - procedure = gimp_pdb_lookup_procedure (pdb, procedure_name); - - g_return_val_if_fail (gimp_procedure_config_get_procedure (config) == procedure, - NULL); - - args = gimp_procedure_new_arguments (procedure); - - _gimp_procedure_config_get_values (config, args); - return_values = _gimp_pdb_run_procedure_array (pdb, procedure_name, args); - - gimp_value_array_unref (args); - - return return_values; -} - /** * gimp_pdb_temp_procedure_name: * @pdb: the #GimpPDB object. diff --git a/libgimp/gimppdb.h b/libgimp/gimppdb.h index 171c7f6716..580cec6a4e 100644 --- a/libgimp/gimppdb.h +++ b/libgimp/gimppdb.h @@ -73,18 +73,6 @@ gboolean gimp_pdb_procedure_exists (GimpPDB *pdb, GimpProcedure * gimp_pdb_lookup_procedure (GimpPDB *pdb, const gchar *procedure_name); -GimpValueArray * gimp_pdb_run_procedure (GimpPDB *pdb, - const gchar *procedure_name, - const gchar *first_arg_name, - ...) G_GNUC_NULL_TERMINATED; -GimpValueArray * gimp_pdb_run_procedure_valist (GimpPDB *pdb, - const gchar *procedure_name, - const gchar *first_arg_name, - va_list args); -GimpValueArray * gimp_pdb_run_procedure_config (GimpPDB *pdb, - const gchar *procedure_name, - GimpProcedureConfig *config); - gchar * gimp_pdb_temp_procedure_name (GimpPDB *pdb); gboolean gimp_pdb_dump_to_file (GimpPDB *pdb, diff --git a/libgimp/gimpplugin.c b/libgimp/gimpplugin.c index 04e98c5eb6..05c158a536 100644 --- a/libgimp/gimpplugin.c +++ b/libgimp/gimpplugin.c @@ -1410,7 +1410,7 @@ gimp_plug_in_proc_run_internal (GimpPlugIn *plug_in, proc_run->n_params, FALSE); - return_values = gimp_procedure_run (procedure, arguments); + return_values = _gimp_procedure_run_array (procedure, arguments); gimp_value_array_unref (arguments); diff --git a/libgimp/gimpprocedure.c b/libgimp/gimpprocedure.c index 117dc6ad1a..011caaaa67 100644 --- a/libgimp/gimpprocedure.c +++ b/libgimp/gimpprocedure.c @@ -23,6 +23,8 @@ #include #include +#include + #include "gimp.h" #include "libgimpbase/gimpprotocol.h" @@ -1862,19 +1864,146 @@ gimp_procedure_new_return_values (GimpProcedure *procedure, } /** - * gimp_procedure_run: + * gimp_procedure_run: (skip) + * @pdb: the #GimpPDB object. + * @procedure_name: the procedure registered name. + * @first_arg_name: the name of an argument of @procedure_name. + * @...: the call arguments. + * + * Runs the procedure named @procedure_name with arguments given as + * list of `(name, value)` pairs, terminated by %NULL. + * + * The order of arguments does not matter and if any argument is missing, its + * default value will be used. The value type must correspond to the argument + * type as registered for @procedure_name. + * + * Returns: (transfer full): the return values for the procedure call. + * + * Since: 3.0 + */ +GimpValueArray * +gimp_procedure_run (GimpProcedure *procedure, + const gchar *first_arg_name, + ...) +{ + GimpValueArray *return_values; + va_list args; + + g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL); + + va_start (args, first_arg_name); + + return_values = gimp_procedure_run_valist (procedure, first_arg_name, args); + + va_end (args); + + return return_values; +} + +/** + * gimp_procedure_run_valist: (skip) + * @pdb: the #GimpPDB object. + * @procedure_name: the procedure registered name. + * @first_arg_name: the name of an argument of @procedure_name. + * @args: the call arguments. + * + * Runs @procedure with arguments names and values, given in the order as passed + * to [method@Procedure.run]. + * + * Returns: (transfer full): the return values for the procedure call. + * + * Since: 3.0 + */ +GimpValueArray * +gimp_procedure_run_valist (GimpProcedure *procedure, + const gchar *first_arg_name, + va_list args) +{ + GimpValueArray *return_values; + GimpProcedureConfig *config; + const gchar *arg_name; + + g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL); + + config = gimp_procedure_create_config (procedure); + arg_name = first_arg_name; + + while (arg_name != NULL) + { + GParamSpec *pspec; + gchar *error = NULL; + GValue value = G_VALUE_INIT; + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), arg_name); + + if (pspec == NULL) + { + g_warning ("%s: %s has no property named '%s'", + G_STRFUNC, + g_type_name (G_TYPE_FROM_INSTANCE (config)), + arg_name); + g_clear_object (&config); + return NULL; + } + + g_value_init (&value, pspec->value_type); + G_VALUE_COLLECT (&value, args, G_VALUE_NOCOPY_CONTENTS, &error); + + if (error) + { + g_warning ("%s: %s", G_STRFUNC, error); + g_free (error); + g_clear_object (&config); + return NULL; + } + + g_object_set_property (G_OBJECT (config), arg_name, &value); + g_value_unset (&value); + + arg_name = va_arg (args, const gchar *); + } + + return_values = gimp_procedure_run_config (procedure, config); + g_clear_object (&config); + + return return_values; +} + +/** + * gimp_procedure_run_config: (rename-to gimp_procedure_run) * @procedure: a @GimpProcedure. * @args: the @procedure's arguments. * - * Runs the procedure, calling the run_func given in [ctor@Procedure.new]. + * Runs @procedure, calling the run_func given in [ctor@Procedure.new]. * * Returns: (transfer full): The @procedure's return values. * * Since: 3.0 **/ GimpValueArray * -gimp_procedure_run (GimpProcedure *procedure, - GimpValueArray *args) +gimp_procedure_run_config (GimpProcedure *procedure, + GimpProcedureConfig *config) +{ + GimpValueArray *return_vals; + GimpValueArray *args; + + g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL); + g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), NULL); + g_return_val_if_fail (gimp_procedure_config_get_procedure (config) == procedure, NULL); + + args = gimp_procedure_new_arguments (procedure); + _gimp_procedure_config_get_values (config, args); + + return_vals = _gimp_procedure_run_array (procedure, args); + + gimp_value_array_unref (args); + + return return_vals; +} + +GimpValueArray * +_gimp_procedure_run_array (GimpProcedure *procedure, + GimpValueArray *args) { GimpValueArray *return_vals; GError *error = NULL; diff --git a/libgimp/gimpprocedure.h b/libgimp/gimpprocedure.h index e2cb8b9324..ac85fdb3fa 100644 --- a/libgimp/gimpprocedure.h +++ b/libgimp/gimpprocedure.h @@ -236,7 +236,13 @@ GimpValueArray * gimp_procedure_new_return_values (GimpProcedure *proced GError *error); GimpValueArray * gimp_procedure_run (GimpProcedure *procedure, - GimpValueArray *args); + const gchar *first_arg_name, + ...) G_GNUC_NULL_TERMINATED; +GimpValueArray * gimp_procedure_run_valist (GimpProcedure *procedure, + const gchar *first_arg_name, + va_list args); +GimpValueArray * gimp_procedure_run_config (GimpProcedure *procedure, + GimpProcedureConfig *config); void gimp_procedure_extension_ready (GimpProcedure *procedure); @@ -244,6 +250,12 @@ GimpProcedureConfig * gimp_procedure_create_config (GimpProcedure *procedure); +/* Internal use */ + +G_GNUC_INTERNAL GimpValueArray * _gimp_procedure_run_array (GimpProcedure *procedure, + GimpValueArray *args); + + G_END_DECLS #endif /* __GIMP_PROCEDURE_H__ */ diff --git a/libgimp/gimpsaveproceduredialog.c b/libgimp/gimpsaveproceduredialog.c index 08867f63b9..75f232c660 100644 --- a/libgimp/gimpsaveproceduredialog.c +++ b/libgimp/gimpsaveproceduredialog.c @@ -328,11 +328,13 @@ static gpointer gimp_save_procedure_dialog_edit_metadata_thread (gpointer data) { GimpSaveProcedureDialog *dialog = data; + GimpProcedure *procedure; - gimp_pdb_run_procedure (gimp_get_pdb (), "plug-in-metadata-editor", - "run-mode", GIMP_RUN_INTERACTIVE, - "image", dialog->priv->image, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), "plug-in-metadata-editor"); + gimp_procedure_run (procedure, + "run-mode", GIMP_RUN_INTERACTIVE, + "image", dialog->priv->image, + NULL); g_mutex_lock (&dialog->priv->metadata_thread_mutex); g_thread_unref (dialog->priv->metadata_thread); diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c index 3bb13bfd30..7562816e6a 100644 --- a/plug-ins/common/file-gbr.c +++ b/plug-ins/common/file-gbr.c @@ -231,6 +231,7 @@ gbr_save (GimpProcedure *procedure, if (status == GIMP_PDB_SUCCESS) { + GimpProcedure *procedure; GimpValueArray *save_retvals; GimpObjectArray *drawables_array; gint spacing; @@ -242,16 +243,16 @@ gbr_save (GimpProcedure *procedure, drawables_array = gimp_object_array_new (GIMP_TYPE_DRAWABLE, (GObject **) drawables, n_drawables, FALSE); - save_retvals = - gimp_pdb_run_procedure (gimp_get_pdb (), - "file-gbr-save-internal", - "image", image, - "num-drawables", n_drawables, - "drawables", drawables_array, - "file", file, - "spacing", spacing, - "name", description, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + "file-gbr-save-internal"); + save_retvals = gimp_procedure_run (procedure, + "image", image, + "num-drawables", n_drawables, + "drawables", drawables_array, + "file", file, + "spacing", spacing, + "name", description, + NULL); gimp_object_array_free (drawables_array); g_free (description); diff --git a/plug-ins/common/file-gih.c b/plug-ins/common/file-gih.c index 0e2ed1ad42..240e5cad70 100644 --- a/plug-ins/common/file-gih.c +++ b/plug-ins/common/file-gih.c @@ -382,6 +382,7 @@ gih_save (GimpProcedure *procedure, if (status == GIMP_PDB_SUCCESS) { + GimpProcedure *procedure; GimpValueArray *save_retvals; GimpObjectArray *drawables_array; gchar *paramstring; @@ -390,16 +391,17 @@ gih_save (GimpProcedure *procedure, drawables_array = gimp_object_array_new (GIMP_TYPE_DRAWABLE, (GObject **) drawables, n_drawables, FALSE); - save_retvals = gimp_pdb_run_procedure (gimp_get_pdb (), - "file-gih-save-internal", - "image", image, - "num-drawables", n_drawables, - "drawables", drawables_array, - "file", file, - "spacing", spacing, - "name", description, - "params", paramstring, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + "file-gih-save-internal"); + save_retvals = gimp_procedure_run (procedure, + "image", image, + "num-drawables", n_drawables, + "drawables", drawables_array, + "file", file, + "spacing", spacing, + "name", description, + "params", paramstring, + NULL); gimp_object_array_free (drawables_array); if (GIMP_VALUES_GET_ENUM (save_retvals, 0) == GIMP_PDB_SUCCESS) diff --git a/plug-ins/common/file-pat.c b/plug-ins/common/file-pat.c index 98f5ad8c7f..080a8e2202 100644 --- a/plug-ins/common/file-pat.c +++ b/plug-ins/common/file-pat.c @@ -209,6 +209,7 @@ pat_save (GimpProcedure *procedure, if (status == GIMP_PDB_SUCCESS) { + GimpProcedure *procedure; GimpValueArray *save_retvals; GimpObjectArray *drawables_array; @@ -218,14 +219,15 @@ pat_save (GimpProcedure *procedure, "description", &description, NULL); - save_retvals = gimp_pdb_run_procedure (gimp_get_pdb (), - "file-pat-save-internal", - "image", image, - "num-drawables", n_drawables, - "drawables", drawables_array, - "file", file, - "name", description, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + "file-pat-save-internal"); + save_retvals = gimp_procedure_run (procedure, + "image", image, + "num-drawables", n_drawables, + "drawables", drawables_array, + "file", file, + "name", description, + NULL); if (GIMP_VALUES_GET_ENUM (save_retvals, 0) != GIMP_PDB_SUCCESS) { diff --git a/plug-ins/common/file-pix.c b/plug-ins/common/file-pix.c index 62b7fcadb0..5bfe8b1389 100644 --- a/plug-ins/common/file-pix.c +++ b/plug-ins/common/file-pix.c @@ -569,7 +569,6 @@ load_esm_image (GInputStream *input, GError **error) { GimpImage *image = NULL; - GimpValueArray *return_vals = NULL; GFile *temp_file = NULL; FILE *fp; goffset file_size; @@ -595,7 +594,9 @@ load_esm_image (GInputStream *input, } else { - guchar buffer[file_size - 21]; + GimpProcedure *procedure; + GimpValueArray *return_vals; + guchar buffer[file_size - 21]; if (! g_input_stream_read_all (input, buffer, sizeof (buffer), NULL, NULL, error)) @@ -610,12 +611,11 @@ load_esm_image (GInputStream *input, fwrite (buffer, sizeof (guchar), file_size, fp); fclose (fp); - return_vals = - gimp_pdb_run_procedure (gimp_get_pdb (), - "file-jpeg-load", - "run-mode", GIMP_RUN_NONINTERACTIVE, - "file", temp_file, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), "file-jpeg-load"); + return_vals = gimp_procedure_run (procedure, + "run-mode", GIMP_RUN_NONINTERACTIVE, + "file", temp_file, + NULL); if (return_vals) { diff --git a/plug-ins/common/plugin-browser.c b/plug-ins/common/plugin-browser.c index 59190a62c0..833a0978cc 100644 --- a/plug-ins/common/plugin-browser.c +++ b/plug-ins/common/plugin-browser.c @@ -361,6 +361,7 @@ browser_search (GimpBrowser *gimp_browser, gint search_type, PluginBrowser *browser) { + GimpProcedure *procedure; GimpValueArray *return_vals; const gchar **procedure_strs; gint num_plugins = 0; @@ -371,10 +372,11 @@ browser_search (GimpBrowser *gimp_browser, gimp_browser_show_message (GIMP_BROWSER (browser->browser), _("Searching by name")); - return_vals = gimp_pdb_run_procedure (gimp_get_pdb (), - "gimp-plug-ins-query", - "search-string", search_text, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + "gimp-plug-ins-query"); + return_vals = gimp_procedure_run (procedure, + "search-string", search_text, + NULL); if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS) { diff --git a/plug-ins/file-icns/file-icns-load.c b/plug-ins/file-icns/file-icns-load.c index c9bbab277c..6582ee996f 100644 --- a/plug-ins/file-icns/file-icns-load.c +++ b/plug-ins/file-icns/file-icns-load.c @@ -423,6 +423,8 @@ icns_attach_image (GimpImage *image, if (temp_file_type && procedure_name) { + GimpProcedure *procedure; + temp_file = gimp_temp_file (temp_file_type); fp = g_fopen (g_file_peek_path (temp_file), "wb"); @@ -439,12 +441,11 @@ icns_attach_image (GimpImage *image, fwrite (icns->data + 8, sizeof (guchar), icns->size - 8, fp); fclose (fp); - return_vals = - gimp_pdb_run_procedure (gimp_get_pdb (), - procedure_name, - "run-mode", GIMP_RUN_NONINTERACTIVE, - "file", temp_file, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), procedure_name); + return_vals = gimp_procedure_run (procedure, + "run-mode", GIMP_RUN_NONINTERACTIVE, + "file", temp_file, + NULL); } if (temp_image && return_vals) @@ -460,9 +461,9 @@ icns_attach_image (GimpImage *image, g_file_delete (temp_file, NULL, NULL); g_object_unref (temp_file); - gimp_value_array_unref (return_vals); g_free (layers); } + g_clear_pointer (&return_vals, gimp_value_array_unref); } else { diff --git a/plug-ins/file-icns/file-icns-save.c b/plug-ins/file-icns/file-icns-save.c index 95ca90d027..782475921f 100644 --- a/plug-ins/file-icns/file-icns-save.c +++ b/plug-ins/file-icns/file-icns-save.c @@ -413,7 +413,6 @@ icns_export_image (GFile *file, GList *iter; gint i; guint32 file_size = 8; - GimpValueArray *return_vals = NULL; gint duplicates[ICNS_TYPE_NUM]; for (i = 0; i < ICNS_TYPE_NUM; i++) @@ -452,6 +451,8 @@ icns_export_image (GFile *file, /* MacOS X format icons */ if (match != -1 && duplicates[match] == 0) { + GimpProcedure *procedure; + GimpValueArray *return_vals; GimpDrawable **drawables = NULL; GFile *temp_file = NULL; GimpObjectArray *args; @@ -466,23 +467,22 @@ icns_export_image (GFile *file, args = gimp_object_array_new (GIMP_TYPE_DRAWABLE, (GObject **) drawables, 1, FALSE); - return_vals = - gimp_pdb_run_procedure (gimp_get_pdb (), - "file-png-save", - "run-mode", GIMP_RUN_NONINTERACTIVE, - "image", image, - "num-drawables", 1, - "drawables", args, - "file", temp_file, - "interlaced", FALSE, - "compression", 9, - "bkgd", FALSE, - "offs", FALSE, - "phys", FALSE, - "time", FALSE, - "save-transparent", FALSE, - "optimize-palette", FALSE, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), "file-png-save"); + return_vals = gimp_procedure_run (procedure, + "run-mode", GIMP_RUN_NONINTERACTIVE, + "image", image, + "num-drawables", 1, + "drawables", args, + "file", temp_file, + "interlaced", FALSE, + "compression", 9, + "bkgd", FALSE, + "offs", FALSE, + "phys", FALSE, + "time", FALSE, + "save-transparent", FALSE, + "optimize-palette", FALSE, + NULL); gimp_object_array_free (args); g_clear_pointer (&drawables, g_free); diff --git a/plug-ins/file-ico/ico-dialog.c b/plug-ins/file-ico/ico-dialog.c index be1a5c0fdd..a531ca4898 100644 --- a/plug-ins/file-ico/ico-dialog.c +++ b/plug-ins/file-ico/ico-dialog.c @@ -470,6 +470,7 @@ ico_dialog_update_icon_preview (GtkWidget *dialog, GimpImage *image; GimpImage *tmp_image; GimpLayer *tmp_layer; + GimpProcedure *procedure; GimpValueArray *return_vals; image = gimp_item_get_image (GIMP_ITEM (layer)); @@ -504,14 +505,14 @@ ico_dialog_update_icon_preview (GtkWidget *dialog, if (gimp_drawable_is_indexed (layer)) gimp_image_convert_rgb (tmp_image); - return_vals = - gimp_pdb_run_procedure (gimp_get_pdb (), - "plug-in-threshold-alpha", - "run-mode", GIMP_RUN_NONINTERACTIVE, - "image", tmp_image, - "drawable", tmp_layer, - "threshold", ICO_ALPHA_THRESHOLD, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + "plug-in-threshold-alpha"); + return_vals = gimp_procedure_run (procedure, + "run-mode", GIMP_RUN_NONINTERACTIVE, + "image", tmp_image, + "drawable", tmp_layer, + "threshold", ICO_ALPHA_THRESHOLD, + NULL); gimp_value_array_unref (return_vals); diff --git a/plug-ins/file-ico/ico-save.c b/plug-ins/file-ico/ico-save.c index b835c03392..d82ab019c2 100644 --- a/plug-ins/file-ico/ico-save.c +++ b/plug-ins/file-ico/ico-save.c @@ -823,16 +823,17 @@ ico_image_get_reduced_buf (GimpDrawable *layer, } else if (bpp == 24) { + GimpProcedure *procedure; GimpValueArray *return_vals; - return_vals = - gimp_pdb_run_procedure (gimp_get_pdb (), - "plug-in-threshold-alpha", - "run-mode", GIMP_RUN_NONINTERACTIVE, - "image", tmp_image, - "drawable", tmp_layer, - "threshold", ICO_ALPHA_THRESHOLD, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + "plug-in-threshold-alpha"); + return_vals = gimp_procedure_run (procedure, + "run-mode", GIMP_RUN_NONINTERACTIVE, + "image", tmp_image, + "drawable", tmp_layer, + "threshold", ICO_ALPHA_THRESHOLD, + NULL); gimp_value_array_unref (return_vals); } diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c index 24870784e8..eb93e24abd 100644 --- a/plug-ins/file-jpeg/jpeg-load.c +++ b/plug-ins/file-jpeg/jpeg-load.c @@ -475,6 +475,7 @@ load_image (GFile *file, { FILE *fp; GFile *temp_file = NULL; + GimpProcedure *procedure; GimpValueArray *return_vals = NULL; temp_file = gimp_temp_file ("tmp"); @@ -496,15 +497,15 @@ load_image (GFile *file, g_free (photoshop_data); - return_vals = - gimp_pdb_run_procedure (gimp_get_pdb (), - "file-psd-load-metadata", - "run-mode", GIMP_RUN_NONINTERACTIVE, - "file", temp_file, - "size", photoshop_len, - "image", image, - "metadata-type", FALSE, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + "file-psd-load-metadata"); + return_vals = gimp_procedure_run (procedure, + "run-mode", GIMP_RUN_NONINTERACTIVE, + "file", temp_file, + "size", photoshop_len, + "image", image, + "metadata-type", FALSE, + NULL); g_file_delete (temp_file, NULL, NULL); g_object_unref (temp_file); diff --git a/plug-ins/file-tiff/file-tiff-load.c b/plug-ins/file-tiff/file-tiff-load.c index 2a7b151304..c633073e31 100644 --- a/plug-ins/file-tiff/file-tiff-load.c +++ b/plug-ins/file-tiff/file-tiff-load.c @@ -1750,6 +1750,7 @@ load_image (GFile *file, { FILE *fp; GFile *temp_file = NULL; + GimpProcedure *procedure; GimpValueArray *return_vals = NULL; temp_file = gimp_temp_file ("tmp"); @@ -1766,15 +1767,15 @@ load_image (GFile *file, fwrite (photoshop_data, sizeof (guchar), photoshop_len, fp); fclose (fp); - return_vals = - gimp_pdb_run_procedure (gimp_get_pdb (), - "file-psd-load-metadata", - "run-mode", GIMP_RUN_NONINTERACTIVE, - "file", temp_file, - "size", photoshop_len, - "image", *image, - "metadata-type", FALSE, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + "file-psd-load-metadata"); + return_vals = gimp_procedure_run (procedure, + "run-mode", GIMP_RUN_NONINTERACTIVE, + "file", temp_file, + "size", photoshop_len, + "image", *image, + "metadata-type", FALSE, + NULL); g_file_delete (temp_file, NULL, NULL); g_object_unref (temp_file); @@ -1787,6 +1788,7 @@ load_image (GFile *file, { FILE *fp; GFile *temp_file = NULL; + GimpProcedure *procedure; GimpValueArray *return_vals = NULL; /* Photoshop metadata starts with 'Adobe Photoshop Document Data Block' @@ -1808,16 +1810,16 @@ load_image (GFile *file, fwrite (photoshop_data, sizeof (guchar), photoshop_len, fp); fclose (fp); - return_vals = - gimp_pdb_run_procedure (gimp_get_pdb (), - "file-psd-load-metadata", - "run-mode", run_mode, - "file", temp_file, - "size", photoshop_len, - "image", *image, - "metadata-type", TRUE, - "cmyk", is_cmyk, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + "file-psd-load-metadata"); + return_vals = gimp_procedure_run (procedure, + "run-mode", run_mode, + "file", temp_file, + "size", photoshop_len, + "image", *image, + "metadata-type", TRUE, + "cmyk", is_cmyk, + NULL); g_file_delete (temp_file, NULL, NULL); g_object_unref (temp_file); diff --git a/plug-ins/help/help.c b/plug-ins/help/help.c index 124519e4f8..9b17711f86 100644 --- a/plug-ins/help/help.c +++ b/plug-ins/help/help.c @@ -322,6 +322,7 @@ help_load_idle (gpointer data) if (uri) { + GimpProcedure *procedure; GimpValueArray *return_vals; #ifdef GIMP_HELP_DEBUG @@ -329,10 +330,9 @@ help_load_idle (gpointer data) idle_help->procedure, uri); #endif - return_vals = gimp_pdb_run_procedure (gimp_get_pdb (), - idle_help->procedure, - "domain-names", uri, - NULL); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), + idle_help->procedure); + return_vals = gimp_procedure_run (procedure, "domain-names", uri, NULL); gimp_value_array_unref (return_vals); g_free (uri); diff --git a/plug-ins/print/print.c b/plug-ins/print/print.c index 459b9d0add..1c3856d160 100644 --- a/plug-ins/print/print.c +++ b/plug-ins/print/print.c @@ -378,9 +378,10 @@ print_image (GimpImage *image, static GimpPDBStatusType page_setup (GimpImage *image) { - GtkPrintOperation *operation; - GimpValueArray *return_vals; - gchar *name; + GtkPrintOperation *operation; + GimpProcedure *procedure; + GimpValueArray *return_vals; + gchar *name; gimp_ui_init (PLUG_IN_BINARY); @@ -401,10 +402,8 @@ page_setup (GimpImage *image) gimp_plug_in_set_pdb_error_handler (gimp_get_plug_in (), GIMP_PDB_ERROR_HANDLER_PLUGIN); - return_vals = gimp_pdb_run_procedure (gimp_get_pdb (), - name, - "image", image, - G_TYPE_NONE); + procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), name); + return_vals = gimp_procedure_run (procedure, "image", image, NULL); gimp_value_array_unref (return_vals); g_free (name); diff --git a/plug-ins/script-fu/libscriptfu/scheme-wrapper.c b/plug-ins/script-fu/libscriptfu/scheme-wrapper.c index 4c127324f3..b939f30e33 100644 --- a/plug-ins/script-fu/libscriptfu/scheme-wrapper.c +++ b/plug-ins/script-fu/libscriptfu/scheme-wrapper.c @@ -1304,7 +1304,7 @@ script_fu_marshal_procedure_call (scheme *sc, return script_error (sc, "A script cannot refresh scripts", 0); g_debug ("calling %s", proc_name); - values = gimp_pdb_run_procedure_config (gimp_get_pdb (), proc_name, config); + values = gimp_procedure_run_config (procedure, config); g_debug ("done."); g_clear_object (&config);