From 714e9041d85d0ce8f6e7cfaffbc0535fbb59d783 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Fri, 26 Sep 2025 23:57:51 +0000 Subject: [PATCH] pdb: Set choice args to default in gimp-file-load This patch resolves the same issue as 8021b464, but for `gimp-file-load`. --- app/pdb/file-cmds.c | 13 +++++++++++-- pdb/groups/file.pdb | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/pdb/file-cmds.c b/app/pdb/file-cmds.c index aef4cda9e3..145c0b9dc4 100644 --- a/app/pdb/file-cmds.c +++ b/app/pdb/file-cmds.c @@ -84,8 +84,17 @@ file_load_invoker (GimpProcedure *procedure, gimp_value_array_index (new_args, 1)); for (i = 2; i < proc->num_args; i++) - if (G_IS_PARAM_SPEC_STRING (proc->args[i])) - g_value_set_static_string (gimp_value_array_index (new_args, i), ""); + if (GIMP_IS_PARAM_SPEC_CHOICE (proc->args[i])) + { + GParamSpecString *string_spec = G_PARAM_SPEC_STRING (proc->args[i]); + + g_value_set_static_string (gimp_value_array_index (new_args, i), + string_spec->default_value); + } + else if (G_IS_PARAM_SPEC_STRING (proc->args[i])) + { + g_value_set_static_string (gimp_value_array_index (new_args, i), ""); + } return_vals = gimp_pdb_execute_procedure_by_name_args (gimp->pdb, diff --git a/pdb/groups/file.pdb b/pdb/groups/file.pdb index 01254c4fd6..6974f4b4b4 100644 --- a/pdb/groups/file.pdb +++ b/pdb/groups/file.pdb @@ -76,8 +76,17 @@ HELP gimp_value_array_index (new_args, 1)); for (i = 2; i < proc->num_args; i++) - if (G_IS_PARAM_SPEC_STRING (proc->args[i])) - g_value_set_static_string (gimp_value_array_index (new_args, i), ""); + if (GIMP_IS_PARAM_SPEC_CHOICE (proc->args[i])) + { + GParamSpecString *string_spec = G_PARAM_SPEC_STRING (proc->args[i]); + + g_value_set_static_string (gimp_value_array_index (new_args, i), + string_spec->default_value); + } + else if (G_IS_PARAM_SPEC_STRING (proc->args[i])) + { + g_value_set_static_string (gimp_value_array_index (new_args, i), ""); + } return_vals = gimp_pdb_execute_procedure_by_name_args (gimp->pdb,