plug-ins: port several of the easy plug-ins to gimp_procedure_new2().

This commit is contained in:
Jehan 2023-06-15 04:39:28 +02:00
parent f6da799c11
commit e92ef9d45a
5 changed files with 46 additions and 52 deletions

View file

@ -62,7 +62,7 @@ static GList * busy_dialog_query_procedures (GimpPlugIn
static GimpProcedure * busy_dialog_create_procedure (GimpPlugIn *plug_in,
const gchar *name);
static GimpValueArray * busy_dialog_run (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static GimpPDBStatusType busy_dialog (gint read_fd,
@ -116,9 +116,9 @@ busy_dialog_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
busy_dialog_run, NULL, NULL);
procedure = gimp_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
busy_dialog_run, NULL, NULL);
gimp_procedure_set_documentation (procedure,
"Show a dialog while waiting for an "
@ -173,30 +173,30 @@ busy_dialog_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray *
busy_dialog_run (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpValueArray *return_vals = NULL;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode = GIMP_RUN_INTERACTIVE;
gint read_fd;
gint write_fd;
const gchar *message;
gboolean cancelable;
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
g_object_get (config,
"run-mode", &run_mode,
"read-fd", &read_fd,
"write-fd", &write_fd,
"message", &message,
"cancelable", &cancelable,
NULL);
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_NONINTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
if (gimp_value_array_length (args) != 5)
{
status = GIMP_PDB_CALLING_ERROR;
}
else
{
status = busy_dialog (GIMP_VALUES_GET_INT (args, 1),
GIMP_VALUES_GET_INT (args, 2),
GIMP_VALUES_GET_STRING (args, 3),
GIMP_VALUES_GET_BOOLEAN (args, 4));
}
status = busy_dialog (read_fd, write_fd, message, cancelable);
break;
default:

View file

@ -192,7 +192,7 @@ static GimpValueArray * pdf_save (GimpProcedure *procedur
const GimpValueArray *args,
gpointer run_data);
static GimpValueArray * pdf_save_multi (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static GimpPDBStatusType pdf_save_image (GimpProcedure *procedure,
@ -385,9 +385,9 @@ pdf_create_procedure (GimpPlugIn *plug_in,
}
else if (! strcmp (name, SAVE_MULTI_PROC))
{
procedure = gimp_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
pdf_save_multi, NULL, NULL);
procedure = gimp_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
pdf_save_multi, NULL, NULL);
gimp_procedure_set_image_types (procedure, "*");
@ -534,10 +534,9 @@ pdf_save (GimpProcedure *procedure,
static GimpValueArray *
pdf_save_multi (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GError *error = NULL;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
@ -550,13 +549,11 @@ pdf_save_multi (GimpProcedure *procedure,
gegl_init (NULL, NULL);
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
g_object_get (config,
"uri", &uri,
"count", &multi_page.image_count,
"images", &image_ids,
"run-mode", &run_mode,
"uri", &uri,
"count", &multi_page.image_count,
"images", &image_ids,
NULL);
file = g_file_new_for_uri (uri);
@ -608,9 +605,6 @@ pdf_save_multi (GimpProcedure *procedure,
(run_mode != GIMP_RUN_NONINTERACTIVE),
&error);
gimp_procedure_config_end_run (config, status);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure, status, error);
}

View file

@ -108,7 +108,7 @@ static GimpValueArray * fli_save (GimpProcedure *procedure,
const GimpValueArray *args,
gpointer run_data);
static GimpValueArray * fli_info (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static GimpImage * load_image (GFile *file,
@ -248,9 +248,9 @@ fli_create_procedure (GimpPlugIn *plug_in,
}
else if (! strcmp (name, INFO_PROC))
{
procedure = gimp_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
fli_info, NULL, NULL);
procedure = gimp_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
fli_info, NULL, NULL);
gimp_procedure_set_documentation (procedure,
"Get information about a Fli movie",
@ -405,7 +405,7 @@ fli_save (GimpProcedure *procedure,
static GimpValueArray *
fli_info (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpValueArray *return_vals;
@ -415,7 +415,7 @@ fli_info (GimpProcedure *procedure,
gint32 frames;
GError *error = NULL;
file = GIMP_VALUES_GET_FILE (args, 0);
g_object_get (config, "file", &file, NULL);
if (! get_info (file, &width, &height, &frames,
&error))

View file

@ -72,7 +72,7 @@ static GimpProcedure * metadata_create_procedure (GimpPlugIn *plug_in
const gchar *name);
static GimpValueArray * metadata_run (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
@ -743,9 +743,9 @@ metadata_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
metadata_run, NULL, NULL);
procedure = gimp_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
metadata_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "*");
@ -784,7 +784,7 @@ metadata_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray *
metadata_run (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpImage *image;
@ -793,7 +793,7 @@ metadata_run (GimpProcedure *procedure,
gimp_ui_init (PLUG_IN_BINARY);
image = GIMP_VALUES_GET_IMAGE (args, 1);
g_object_get (config, "image", &image, NULL);
metadata = gimp_image_get_metadata (image);

View file

@ -93,7 +93,7 @@ static GimpProcedure * metadata_create_procedure (GimpPlugIn *plug_in
const gchar *name);
static GimpValueArray * metadata_run (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static gboolean metadata_viewer_dialog (GimpImage *image,
@ -168,9 +168,9 @@ metadata_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
metadata_run, NULL, NULL);
procedure = gimp_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
metadata_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "*");
@ -210,7 +210,7 @@ metadata_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray *
metadata_run (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpImage *image;
@ -219,7 +219,7 @@ metadata_run (GimpProcedure *procedure,
gimp_ui_init (PLUG_IN_BINARY);
image = GIMP_VALUES_GET_IMAGE (args, 1);
g_object_get (config, "image", &image, NULL);
metadata = gimp_image_get_metadata (image);