mirror of https://github.com/GNOME/gimp.git
libgimp, plug-ins: rename gimp_procedure_new2() as gimp_procedure_new() and…
… remove the latter. Now all GimpProcedure use this new implementation with use a config object.
This commit is contained in:
parent
f6f622b93d
commit
2b38a2df86
|
@ -767,7 +767,6 @@ EXPORTS
|
|||
gimp_procedure_get_sensitivity_mask
|
||||
gimp_procedure_get_type
|
||||
gimp_procedure_new
|
||||
gimp_procedure_new2
|
||||
gimp_procedure_new_arguments
|
||||
gimp_procedure_new_return_values
|
||||
gimp_procedure_run
|
||||
|
|
|
@ -84,7 +84,6 @@ struct _GimpProcedurePrivate
|
|||
GParamSpec **values;
|
||||
|
||||
GimpRunFunc run_func;
|
||||
GimpRunConfigFunc run_config_func;
|
||||
gpointer run_data;
|
||||
GDestroyNotify run_data_destroy;
|
||||
|
||||
|
@ -480,8 +479,6 @@ gimp_procedure_real_uninstall (GimpProcedure *procedure)
|
|||
static GimpValueArray *
|
||||
gimp_procedure_real_run (GimpProcedure *procedure,
|
||||
const GimpValueArray *args)
|
||||
{
|
||||
if (procedure->priv->run_config_func)
|
||||
{
|
||||
GimpProcedureConfig *config;
|
||||
GimpImage *image = NULL;
|
||||
|
@ -502,7 +499,7 @@ gimp_procedure_real_run (GimpProcedure *procedure,
|
|||
config = gimp_procedure_create_config (procedure);
|
||||
gimp_procedure_config_begin_run (config, image, run_mode, args);
|
||||
|
||||
retvals = procedure->priv->run_config_func (procedure, config,
|
||||
retvals = procedure->priv->run_func (procedure, config,
|
||||
procedure->priv->run_data);
|
||||
if (retvals != NULL &&
|
||||
gimp_value_array_length (retvals) > 0 &&
|
||||
|
@ -514,12 +511,6 @@ gimp_procedure_real_run (GimpProcedure *procedure,
|
|||
|
||||
return retvals;
|
||||
}
|
||||
else
|
||||
{
|
||||
return procedure->priv->run_func (procedure, args,
|
||||
procedure->priv->run_data);
|
||||
}
|
||||
}
|
||||
|
||||
static GimpProcedureConfig *
|
||||
gimp_procedure_real_create_config (GimpProcedure *procedure,
|
||||
|
@ -641,84 +632,6 @@ gimp_procedure_new (GimpPlugIn *plug_in,
|
|||
|
||||
return procedure;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_procedure_new2:
|
||||
* @plug_in: a #GimpPlugIn.
|
||||
* @name: the new procedure's name.
|
||||
* @proc_type: the new procedure's #GimpPDBProcType.
|
||||
* @run_func: the run function for the new procedure.
|
||||
* @run_data: user data passed to @run_func.
|
||||
* @run_data_destroy: (nullable): free function for @run_data, or %NULL.
|
||||
*
|
||||
* Creates a new procedure named @name which will call @run_func when
|
||||
* invoked.
|
||||
*
|
||||
* The @name parameter is mandatory and should be unique, or it will
|
||||
* overwrite an already existing procedure (overwrite procedures only
|
||||
* if you know what you're doing).
|
||||
*
|
||||
* @proc_type should be %GIMP_PDB_PROC_TYPE_PLUGIN for "normal" plug-ins.
|
||||
*
|
||||
* Using %GIMP_PDB_PROC_TYPE_EXTENSION means that the plug-in will add
|
||||
* temporary procedures. Therefore, the GIMP core will wait until the
|
||||
* %GIMP_PDB_PROC_TYPE_EXTENSION procedure has called
|
||||
* [method@Procedure.extension_ready], which means that the procedure
|
||||
* has done its initialization, installed its temporary procedures and
|
||||
* is ready to run.
|
||||
*
|
||||
* *Not calling [method@Procedure.extension_ready] from a
|
||||
* %GIMP_PDB_PROC_TYPE_EXTENSION procedure will cause the GIMP core to
|
||||
* lock up.*
|
||||
*
|
||||
* Additionally, a %GIMP_PDB_PROC_TYPE_EXTENSION procedure with no
|
||||
* arguments added is an "automatic" extension that will be
|
||||
* automatically started on each GIMP startup.
|
||||
*
|
||||
* %GIMP_PDB_PROC_TYPE_TEMPORARY must be used for temporary procedures
|
||||
* that are created during a plug-ins lifetime. They must be added to
|
||||
* the #GimpPlugIn using [method@PlugIn.add_temp_procedure].
|
||||
*
|
||||
* @run_func is called via [method@Procedure.run].
|
||||
*
|
||||
* For %GIMP_PDB_PROC_TYPE_PLUGIN and %GIMP_PDB_PROC_TYPE_EXTENSION
|
||||
* procedures the call of @run_func is basically the lifetime of the
|
||||
* plug-in.
|
||||
*
|
||||
* TODO: when all plug-ins have been ported to gimp_procedure_new2(), it must be
|
||||
* renamed and gimp_procedure_new() removed.
|
||||
*
|
||||
* Returns: a new #GimpProcedure.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
GimpProcedure *
|
||||
gimp_procedure_new2 (GimpPlugIn *plug_in,
|
||||
const gchar *name,
|
||||
GimpPDBProcType proc_type,
|
||||
GimpRunConfigFunc run_func,
|
||||
gpointer run_data,
|
||||
GDestroyNotify run_data_destroy)
|
||||
{
|
||||
GimpProcedure *procedure;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), NULL);
|
||||
g_return_val_if_fail (gimp_is_canonical_identifier (name), NULL);
|
||||
g_return_val_if_fail (proc_type != GIMP_PDB_PROC_TYPE_INTERNAL, NULL);
|
||||
g_return_val_if_fail (run_func != NULL, NULL);
|
||||
|
||||
procedure = g_object_new (GIMP_TYPE_PROCEDURE,
|
||||
"plug-in", plug_in,
|
||||
"name", name,
|
||||
"procedure-type", proc_type,
|
||||
NULL);
|
||||
|
||||
procedure->priv->run_config_func = run_func;
|
||||
procedure->priv->run_data = run_data;
|
||||
procedure->priv->run_data_destroy = run_data_destroy;
|
||||
|
||||
return procedure;
|
||||
}
|
||||
/**
|
||||
* gimp_procedure_get_plug_in:
|
||||
* @procedure: A #GimpProcedure.
|
||||
|
|
|
@ -34,7 +34,7 @@ G_BEGIN_DECLS
|
|||
/**
|
||||
* GimpRunFunc:
|
||||
* @procedure: the #GimpProcedure that runs.
|
||||
* @args: the @procedure's arguments.
|
||||
* @config: the @procedure's arguments in a config object.
|
||||
* @run_data: (closure): the run_data given in gimp_procedure_new().
|
||||
*
|
||||
* The run function is run during the lifetime of the GIMP session,
|
||||
|
@ -45,9 +45,6 @@ G_BEGIN_DECLS
|
|||
* Since: 3.0
|
||||
**/
|
||||
typedef GimpValueArray * (* GimpRunFunc) (GimpProcedure *procedure,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
typedef GimpValueArray * (* GimpRunConfigFunc) (GimpProcedure *procedure,
|
||||
GimpProcedureConfig *config,
|
||||
gpointer run_data);
|
||||
|
||||
|
@ -141,12 +138,6 @@ GimpProcedure * gimp_procedure_new (GimpPlugIn *plug_i
|
|||
GimpRunFunc run_func,
|
||||
gpointer run_data,
|
||||
GDestroyNotify run_data_destroy);
|
||||
GimpProcedure * gimp_procedure_new2 (GimpPlugIn *plug_in,
|
||||
const gchar *name,
|
||||
GimpPDBProcType proc_type,
|
||||
GimpRunConfigFunc run_func,
|
||||
gpointer run_data,
|
||||
GDestroyNotify run_data_destroy);
|
||||
|
||||
GimpPlugIn * gimp_procedure_get_plug_in (GimpProcedure *procedure);
|
||||
const gchar * gimp_procedure_get_name (GimpProcedure *procedure);
|
||||
|
|
|
@ -99,7 +99,7 @@ gimp_progress_install_vtable (const GimpProgressVtable *vtable,
|
|||
progress_data->data = user_data;
|
||||
progress_data->data_destroy = user_data_destroy;
|
||||
|
||||
procedure = gimp_procedure_new2 (plug_in,
|
||||
procedure = gimp_procedure_new (plug_in,
|
||||
progress_callback,
|
||||
GIMP_PDB_PROC_TYPE_TEMPORARY,
|
||||
gimp_temp_progress_run,
|
||||
|
|
|
@ -365,7 +365,7 @@ gimp_resource_select_new (const gchar *title,
|
|||
|
||||
/* !!! Only part of the adaption has been initialized. */
|
||||
|
||||
procedure = gimp_procedure_new2 (plug_in,
|
||||
procedure = gimp_procedure_new (plug_in,
|
||||
temp_PDB_callback_name,
|
||||
GIMP_PDB_PROC_TYPE_TEMPORARY,
|
||||
gimp_temp_resource_run,
|
||||
|
|
|
@ -116,7 +116,7 @@ busy_dialog_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
busy_dialog_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ glob_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
glob_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ pdf_create_procedure (GimpPlugIn *plug_in,
|
|||
}
|
||||
else if (! strcmp (name, SAVE_MULTI_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
pdf_save_multi, NULL, NULL);
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ browser_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (procedure_name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, procedure_name,
|
||||
procedure = gimp_procedure_new (plug_in, procedure_name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
browser_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ browser_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
browser_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ editor_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
editor_run, plug_in, NULL);
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ browser_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
browser_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ webpage_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
webpage_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ fli_create_procedure (GimpPlugIn *plug_in,
|
|||
}
|
||||
else if (! strcmp (name, INFO_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
fli_info, NULL, NULL);
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ help_browser_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, GIMP_HELP_BROWSER_EXT_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_EXTENSION,
|
||||
help_browser_run, plug_in, NULL);
|
||||
|
||||
|
@ -197,7 +197,7 @@ temp_proc_install (GimpPlugIn *plug_in)
|
|||
{
|
||||
GimpProcedure *procedure;
|
||||
|
||||
procedure = gimp_procedure_new2 (plug_in, GIMP_HELP_BROWSER_TEMP_EXT_PROC,
|
||||
procedure = gimp_procedure_new (plug_in, GIMP_HELP_BROWSER_TEMP_EXT_PROC,
|
||||
GIMP_PDB_PROC_TYPE_TEMPORARY,
|
||||
temp_proc_run, plug_in, NULL);
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ help_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, GIMP_HELP_EXT_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_EXTENSION,
|
||||
help_run, NULL, NULL);
|
||||
|
||||
|
@ -198,7 +198,7 @@ help_temp_proc_install (GimpPlugIn *plug_in)
|
|||
{
|
||||
GimpProcedure *procedure;
|
||||
|
||||
procedure = gimp_procedure_new2 (plug_in, GIMP_HELP_TEMP_EXT_PROC,
|
||||
procedure = gimp_procedure_new (plug_in, GIMP_HELP_TEMP_EXT_PROC,
|
||||
GIMP_PDB_PROC_TYPE_TEMPORARY,
|
||||
help_temp_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -743,7 +743,7 @@ metadata_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
metadata_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ metadata_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
metadata_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -533,7 +533,7 @@ print_temp_proc_install (GimpImage *image)
|
|||
gchar *name = print_temp_proc_name (image);
|
||||
GimpProcedure *procedure;
|
||||
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_TEMPORARY,
|
||||
print_temp_proc_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ screenshot_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, PLUG_IN_PROC))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
screenshot_run, NULL, NULL);
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ script_fu_script_create_PDB_procedure (GimpPlugIn *plug_in,
|
|||
g_debug ("script_fu_script_create_PDB_procedure: %s, plugin type %i, ordinary proc",
|
||||
script->name, plug_in_type);
|
||||
|
||||
procedure = gimp_procedure_new2 (plug_in, script->name,
|
||||
procedure = gimp_procedure_new (plug_in, script->name,
|
||||
plug_in_type,
|
||||
script_fu_run_procedure,
|
||||
script, NULL);
|
||||
|
|
|
@ -99,7 +99,7 @@ script_fu_create_procedure (GimpPlugIn *plug_in,
|
|||
|
||||
if (! strcmp (name, "extension-script-fu"))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_EXTENSION,
|
||||
script_fu_run, NULL, NULL);
|
||||
|
||||
|
@ -115,7 +115,7 @@ script_fu_create_procedure (GimpPlugIn *plug_in,
|
|||
}
|
||||
else if (! strcmp (name, "plug-in-script-fu-console"))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
script_fu_run, NULL, NULL);
|
||||
|
||||
|
@ -147,7 +147,7 @@ script_fu_create_procedure (GimpPlugIn *plug_in,
|
|||
}
|
||||
else if (! strcmp (name, "plug-in-script-fu-text-console"))
|
||||
{
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
script_fu_run, NULL, NULL);
|
||||
|
||||
|
@ -338,7 +338,7 @@ script_fu_extension_init (GimpPlugIn *plug_in)
|
|||
gimp_plug_in_add_menu_branch (plug_in, "<Image>/Filters",
|
||||
N_("Alpha to _Logo"));
|
||||
|
||||
procedure = gimp_procedure_new2 (plug_in, "script-fu-refresh",
|
||||
procedure = gimp_procedure_new (plug_in, "script-fu-refresh",
|
||||
GIMP_PDB_PROC_TYPE_TEMPORARY,
|
||||
script_fu_refresh_proc, NULL, NULL);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ script_fu_server_create_procedure (GimpPlugIn *plug_in,
|
|||
GimpProcedure *procedure = NULL;
|
||||
|
||||
/* The run func script_fu_server_outer_run is defined in this source file. */
|
||||
procedure = gimp_procedure_new2 (plug_in, name,
|
||||
procedure = gimp_procedure_new (plug_in, name,
|
||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||
script_fu_server_outer_run, NULL, NULL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue