pdb: avoid duplicate argument names in gimp-plugins-query

Also rename all arguments to make more sense.
This commit is contained in:
Michael Natterer 2019-09-09 01:51:33 +02:00
parent d745dc86c5
commit bde70bcdab
2 changed files with 66 additions and 57 deletions

View File

@ -57,31 +57,37 @@ plugins_query_invoker (GimpProcedure *procedure,
{ {
GimpValueArray *return_vals; GimpValueArray *return_vals;
const gchar *search_string; const gchar *search_string;
gint num_plugins = 0; gint num_procedures = 0;
gchar **plugin_procedure = NULL; gchar **procedures = NULL;
gchar **plugin_accelerator = NULL; gint num_accelerators = 0;
gchar **plugin_location = NULL; gchar **accelerators = NULL;
gint32 *plugin_install_time = NULL; gint num_locations = 0;
gchar **locations = NULL;
gint num_install_times = 0;
gint32 *install_times = NULL;
search_string = g_value_get_string (gimp_value_array_index (args, 0)); search_string = g_value_get_string (gimp_value_array_index (args, 0));
num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager, num_procedures = gimp_plug_in_manager_query (gimp->plug_in_manager,
search_string, search_string,
&plugin_procedure, &procedures,
&plugin_accelerator, &accelerators,
&plugin_location, &locations,
&plugin_install_time); &install_times);
num_accelerators = num_procedures;
num_locations = num_procedures;
num_install_times = num_procedures;
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL); return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
g_value_set_int (gimp_value_array_index (return_vals, 1), num_plugins); g_value_set_int (gimp_value_array_index (return_vals, 1), num_procedures);
gimp_value_take_string_array (gimp_value_array_index (return_vals, 2), plugin_procedure, num_plugins); gimp_value_take_string_array (gimp_value_array_index (return_vals, 2), procedures, num_procedures);
g_value_set_int (gimp_value_array_index (return_vals, 3), num_plugins); g_value_set_int (gimp_value_array_index (return_vals, 3), num_accelerators);
gimp_value_take_string_array (gimp_value_array_index (return_vals, 4), plugin_accelerator, num_plugins); gimp_value_take_string_array (gimp_value_array_index (return_vals, 4), accelerators, num_accelerators);
g_value_set_int (gimp_value_array_index (return_vals, 5), num_plugins); g_value_set_int (gimp_value_array_index (return_vals, 5), num_locations);
gimp_value_take_string_array (gimp_value_array_index (return_vals, 6), plugin_location, num_plugins); gimp_value_take_string_array (gimp_value_array_index (return_vals, 6), locations, num_locations);
g_value_set_int (gimp_value_array_index (return_vals, 7), num_plugins); g_value_set_int (gimp_value_array_index (return_vals, 7), num_install_times);
gimp_value_take_int32_array (gimp_value_array_index (return_vals, 8), plugin_install_time, num_plugins); gimp_value_take_int32_array (gimp_value_array_index (return_vals, 8), install_times, num_install_times);
return return_vals; return return_vals;
} }
@ -268,47 +274,47 @@ register_plug_in_procs (GimpPDB *pdb)
NULL, NULL,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE)); GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
g_param_spec_int ("num-plugins", g_param_spec_int ("num-procedures",
"num plugins", "num procedures",
"The number of plug-ins", "The number of matching procedures",
0, G_MAXINT32, 0, 0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
gimp_param_spec_string_array ("plugin-procedure", gimp_param_spec_string_array ("procedures",
"plugin procedure", "procedures",
"The plug-in procedure name", "The plug-in procedure name",
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
g_param_spec_int ("num-plugins", g_param_spec_int ("num-accelerators",
"num plugins", "num accelerators",
"The number of plug-ins", "The number of matching procedures",
0, G_MAXINT32, 0, 0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
gimp_param_spec_string_array ("plugin-accelerator", gimp_param_spec_string_array ("accelerators",
"plugin accelerator", "accelerators",
"String representing keyboard accelerator (could be empty string)", "String representing keyboard accelerator (could be empty string)",
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
g_param_spec_int ("num-plugins", g_param_spec_int ("num-locations",
"num plugins", "num locations",
"The number of plug-ins", "The number of matching procedures",
0, G_MAXINT32, 0, 0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
gimp_param_spec_string_array ("plugin-location", gimp_param_spec_string_array ("locations",
"plugin location", "locations",
"Location of the plug-in program", "Location of the plug-in program",
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
g_param_spec_int ("num-plugins", g_param_spec_int ("num-install-times",
"num plugins", "num install times",
"The number of plug-ins", "The number of matching procedures",
0, G_MAXINT32, 0, 0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
gimp_param_spec_int32_array ("plugin-install-time", gimp_param_spec_int32_array ("install-times",
"plugin install time", "install times",
"Time that the plug-in was installed", "Time that the plug-in was installed",
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);

View File

@ -30,34 +30,37 @@ sub plugins_query {
); );
@outargs = ( @outargs = (
{ name => 'plugin_procedure', type => 'stringarray', { name => 'procedures', type => 'stringarray',
desc => 'The plug-in procedure name', desc => 'The plug-in procedure name',
array => { name => 'num_plugins', array => { name => 'num_procedures',
desc => 'The number of plug-ins' } }, desc => 'The number of matching procedures' } },
{ name => 'plugin_accelerator', type => 'stringarray', { name => 'accelerators', type => 'stringarray',
desc => 'String representing keyboard accelerator (could be empty desc => 'String representing keyboard accelerator (could be empty
string)', string)',
array => { name => 'num_plugins', no_declare => 1, array => { name => 'num_accelerators',
desc => 'The number of plug-ins' } }, desc => 'The number of matching procedures' } },
{ name => 'plugin_location', type => 'stringarray', { name => 'locations', type => 'stringarray',
desc => 'Location of the plug-in program', desc => 'Location of the plug-in program',
array => { name => 'num_plugins', no_declare => 1, array => { name => 'num_locations',
desc => 'The number of plug-ins' } }, desc => 'The number of matching procedures' } },
{ name => 'plugin_install_time', type => 'int32array', { name => 'install_times', type => 'int32array',
desc => 'Time that the plug-in was installed', desc => 'Time that the plug-in was installed',
array => { name => 'num_plugins', no_declare => 1, array => { name => 'num_install_times',
desc => 'The number of plug-ins' } } desc => 'The number of matching procedures' } }
); );
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
{ {
num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager, num_procedures = gimp_plug_in_manager_query (gimp->plug_in_manager,
search_string, search_string,
&plugin_procedure, &procedures,
&plugin_accelerator, &accelerators,
&plugin_location, &locations,
&plugin_install_time); &install_times);
num_accelerators = num_procedures;
num_locations = num_procedures;
num_install_times = num_procedures;
} }
CODE CODE
); );