plug-ins: port the easy script-fu procedures to gimp_procedure_new2().

This commit is contained in:
Jehan 2023-06-15 16:59:04 +02:00
parent 38ecbfc762
commit af00b66914
4 changed files with 26 additions and 23 deletions

View File

@ -53,7 +53,7 @@ static void script_fu_run_init (GimpProcedure *proced
GimpRunMode run_mode);
static void script_fu_extension_init (GimpPlugIn *plug_in);
static GimpValueArray * script_fu_refresh_proc (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
@ -338,9 +338,9 @@ script_fu_extension_init (GimpPlugIn *plug_in)
gimp_plug_in_add_menu_branch (plug_in, "<Image>/Filters",
N_("Alpha to _Logo"));
procedure = gimp_procedure_new (plug_in, "script-fu-refresh",
GIMP_PDB_PROC_TYPE_TEMPORARY,
script_fu_refresh_proc, NULL, NULL);
procedure = gimp_procedure_new2 (plug_in, "script-fu-refresh",
GIMP_PDB_PROC_TYPE_TEMPORARY,
script_fu_refresh_proc, NULL, NULL);
gimp_procedure_set_menu_label (procedure, _("_Refresh Scripts"));
gimp_procedure_add_menu_path (procedure,
@ -368,7 +368,7 @@ script_fu_extension_init (GimpPlugIn *plug_in)
static GimpValueArray *
script_fu_refresh_proc (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
if (script_fu_extension_is_busy ())

View File

@ -40,7 +40,7 @@ static GimpProcedure * script_fu_server_create_procedure (GimpPlugIn
const gchar *name);
static GimpValueArray * script_fu_server_outer_run (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static void script_fu_server_run_init (GimpProcedure *procedure,
GimpRunMode run_mode);
@ -84,9 +84,9 @@ 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_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
script_fu_server_outer_run, NULL, NULL);
procedure = gimp_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
script_fu_server_outer_run, NULL, NULL);
gimp_procedure_set_menu_label (procedure, _("_Start Server..."));
gimp_procedure_add_menu_path (procedure,
@ -184,15 +184,14 @@ script_fu_server_create_procedure (GimpPlugIn *plug_in,
*/
static GimpValueArray *
script_fu_server_outer_run (GimpProcedure *procedure,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpValueArray *return_vals = NULL;
GimpRunMode run_mode = GIMP_RUN_NONINTERACTIVE;
if (gimp_value_array_length (args) > 0)
script_fu_server_run_init (procedure, GIMP_VALUES_GET_ENUM (args, 0));
else
script_fu_server_run_init (procedure, GIMP_RUN_NONINTERACTIVE);
g_object_get (config, "run-mode", &run_mode, NULL);
script_fu_server_run_init (procedure, run_mode);
/* Remind any users watching the console. */
g_debug ("Starting. Further logging by server might be to a log file.");
@ -201,7 +200,7 @@ script_fu_server_outer_run (GimpProcedure *procedure,
* Call the inner run func, defined in script-fu-server.c
* !!! This does not return unless a client evals "(gimp-quit)"
*/
return_vals = script_fu_server_run (procedure, args);
return_vals = script_fu_server_run (procedure, config);
/*
* The server returns SUCCESS but no other values (to the caller)

View File

@ -271,18 +271,20 @@ script_fu_server_post_command (void)
GimpValueArray *
script_fu_server_run (GimpProcedure *procedure,
const GimpValueArray *args)
GimpProcedureConfig *config)
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
const gchar *ip;
gchar *ip;
gint port;
const gchar *logfile;
gchar *logfile;
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
ip = GIMP_VALUES_GET_STRING (args, 1);
port = GIMP_VALUES_GET_INT (args, 2);
logfile = GIMP_VALUES_GET_STRING (args, 3);
g_object_get (config,
"run-mode", &run_mode,
"ip", &ip,
"port", &port,
"logfile", &logfile,
NULL);
script_fu_set_run_mode (run_mode);
script_fu_set_print_flag (1);
@ -312,6 +314,8 @@ script_fu_server_run (GimpProcedure *procedure,
default:
break;
}
g_free (ip);
g_free (logfile);
return gimp_procedure_new_return_values (procedure, status, NULL);
}

View File

@ -20,7 +20,7 @@
GimpValueArray * script_fu_server_run (GimpProcedure *procedure,
const GimpValueArray *args);
GimpProcedureConfig *config);
#endif /* __SCRIPT_FU_SERVER__ */