libgimp, plug-ins: move gimp_pdb_run_procedure*() to gimp_procedure_run*().

The gimp_procedure_run() already existed, though it was with an ordered
GimpValueArray array of arguments. Its usage feels redundant to the series of
gimp_pdb_run_procedure*() functions (which is confusing), but
gimp_procedure_run() was actually a bit more generic, because it does not
necessarily calls GimpProcedure-s through the PDB! For instance, it can runs a
local GimpProcedure, such as the case of one procedure which would want to call
another procedure in the same plug-in, but without having to go through PDB. Of
course, for local code, you may as well run relevant functions directly, yet it
makes sense that if one of the redundant-looking function is removed, it should
be the more specific one. Also gimp_procedure_run() feels a lot simpler and
logical, API wise.

A main difference in usage is that now, plug-in developers have to first
explicitly look up the GimpPdbProcedure with gimp_pdb_lookup_procedure() when
they wish to call PDB procedures on the wire. This was done anyway in the
gimp_pdb_run_procedure*() code, now it's explicit (rather than calling by name
directly).

Concretely:

* gimp_pdb_run_procedure(), gimp_pdb_run_procedure_config() and
  gimp_pdb_run_procedure_valist() are removed.
* gimp_procedure_run() API is modified to use a variable args list instead of a
  GimpValueArray.
* gimp_procedure_run_config() and gimp_procedure_run_valist() are added.
* gimp_procedure_run_config() in particular will be the one used in bindings
  which don't have variable args support through a (rename-to
  gimp_procedure_run) annotation.
This commit is contained in:
Jehan 2023-10-18 17:11:20 +02:00
parent 701357c02f
commit 57ca3f4807
21 changed files with 288 additions and 304 deletions

View File

@ -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

View File

@ -20,20 +20,16 @@
#include "config.h"
#include <gobject/gvaluecollector.h>
#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.

View File

@ -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,

View File

@ -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);

View File

@ -23,6 +23,8 @@
#include <stdarg.h>
#include <sys/types.h>
#include <gobject/gvaluecollector.h>
#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;

View File

@ -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__ */

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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
{

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);