Commit aeef7260 authored by Michael Natterer's avatar Michael Natterer 😴

libgimp: implement GimpProcedure::create_config() in all subclasses

parent e80c90e1
...@@ -44,6 +44,10 @@ static void gimp_load_procedure_install (GimpProcedure *procedure); ...@@ -44,6 +44,10 @@ static void gimp_load_procedure_install (GimpProcedure *procedure);
static GimpValueArray * static GimpValueArray *
gimp_load_procedure_run (GimpProcedure *procedure, gimp_load_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args); const GimpValueArray *args);
static GimpProcedureConfig *
gimp_load_procedure_create_config (GimpProcedure *procedure,
GParamSpec **args,
gint n_args);
G_DEFINE_TYPE_WITH_PRIVATE (GimpLoadProcedure, gimp_load_procedure, G_DEFINE_TYPE_WITH_PRIVATE (GimpLoadProcedure, gimp_load_procedure,
...@@ -63,6 +67,7 @@ gimp_load_procedure_class_init (GimpLoadProcedureClass *klass) ...@@ -63,6 +67,7 @@ gimp_load_procedure_class_init (GimpLoadProcedureClass *klass)
procedure_class->install = gimp_load_procedure_install; procedure_class->install = gimp_load_procedure_install;
procedure_class->run = gimp_load_procedure_run; procedure_class->run = gimp_load_procedure_run;
procedure_class->create_config = gimp_load_procedure_create_config;
} }
static void static void
...@@ -139,6 +144,8 @@ gimp_load_procedure_install (GimpProcedure *procedure) ...@@ -139,6 +144,8 @@ gimp_load_procedure_install (GimpProcedure *procedure)
load_proc->priv->thumbnail_proc); load_proc->priv->thumbnail_proc);
} }
#define ARG_OFFSET 2
static GimpValueArray * static GimpValueArray *
gimp_load_procedure_run (GimpProcedure *procedure, gimp_load_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args) const GimpValueArray *args)
...@@ -153,9 +160,9 @@ gimp_load_procedure_run (GimpProcedure *procedure, ...@@ -153,9 +160,9 @@ gimp_load_procedure_run (GimpProcedure *procedure,
run_mode = GIMP_VALUES_GET_ENUM (args, 0); run_mode = GIMP_VALUES_GET_ENUM (args, 0);
file = GIMP_VALUES_GET_FILE (args, 1); file = GIMP_VALUES_GET_FILE (args, 1);
remaining = gimp_value_array_new (gimp_value_array_length (args) - 2); remaining = gimp_value_array_new (gimp_value_array_length (args) - ARG_OFFSET);
for (i = 2; i < gimp_value_array_length (args); i++) for (i = ARG_OFFSET; i < gimp_value_array_length (args); i++)
{ {
GValue *value = gimp_value_array_index (args, i); GValue *value = gimp_value_array_index (args, i);
...@@ -173,6 +180,27 @@ gimp_load_procedure_run (GimpProcedure *procedure, ...@@ -173,6 +180,27 @@ gimp_load_procedure_run (GimpProcedure *procedure,
return return_values; return return_values;
} }
static GimpProcedureConfig *
gimp_load_procedure_create_config (GimpProcedure *procedure,
GParamSpec **args,
gint n_args)
{
if (n_args > ARG_OFFSET)
{
args += ARG_OFFSET;
n_args -= ARG_OFFSET;
}
else
{
args = NULL;
n_args = 0;
}
return GIMP_PROCEDURE_CLASS (parent_class)->create_config (procedure,
args,
n_args);
}
/* public functions */ /* public functions */
......
...@@ -41,6 +41,10 @@ static void gimp_save_procedure_install (GimpProcedure *procedure); ...@@ -41,6 +41,10 @@ static void gimp_save_procedure_install (GimpProcedure *procedure);
static GimpValueArray * static GimpValueArray *
gimp_save_procedure_run (GimpProcedure *procedure, gimp_save_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args); const GimpValueArray *args);
static GimpProcedureConfig *
gimp_save_procedure_create_config (GimpProcedure *procedure,
GParamSpec **args,
gint n_args);
G_DEFINE_TYPE_WITH_PRIVATE (GimpSaveProcedure, gimp_save_procedure, G_DEFINE_TYPE_WITH_PRIVATE (GimpSaveProcedure, gimp_save_procedure,
...@@ -60,6 +64,7 @@ gimp_save_procedure_class_init (GimpSaveProcedureClass *klass) ...@@ -60,6 +64,7 @@ gimp_save_procedure_class_init (GimpSaveProcedureClass *klass)
procedure_class->install = gimp_save_procedure_install; procedure_class->install = gimp_save_procedure_install;
procedure_class->run = gimp_save_procedure_run; procedure_class->run = gimp_save_procedure_run;
procedure_class->create_config = gimp_save_procedure_create_config;
} }
static void static void
...@@ -131,6 +136,8 @@ gimp_save_procedure_install (GimpProcedure *procedure) ...@@ -131,6 +136,8 @@ gimp_save_procedure_install (GimpProcedure *procedure)
priority); priority);
} }
#define ARG_OFFSET 4
static GimpValueArray * static GimpValueArray *
gimp_save_procedure_run (GimpProcedure *procedure, gimp_save_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args) const GimpValueArray *args)
...@@ -149,9 +156,9 @@ gimp_save_procedure_run (GimpProcedure *procedure, ...@@ -149,9 +156,9 @@ gimp_save_procedure_run (GimpProcedure *procedure,
drawable = GIMP_VALUES_GET_DRAWABLE (args, 2); drawable = GIMP_VALUES_GET_DRAWABLE (args, 2);
file = GIMP_VALUES_GET_FILE (args, 3); file = GIMP_VALUES_GET_FILE (args, 3);
remaining = gimp_value_array_new (gimp_value_array_length (args) - 4); remaining = gimp_value_array_new (gimp_value_array_length (args) - ARG_OFFSET);
for (i = 4; i < gimp_value_array_length (args); i++) for (i = ARG_OFFSET; i < gimp_value_array_length (args); i++)
{ {
GValue *value = gimp_value_array_index (args, i); GValue *value = gimp_value_array_index (args, i);
...@@ -170,6 +177,27 @@ gimp_save_procedure_run (GimpProcedure *procedure, ...@@ -170,6 +177,27 @@ gimp_save_procedure_run (GimpProcedure *procedure,
return return_values; return return_values;
} }
static GimpProcedureConfig *
gimp_save_procedure_create_config (GimpProcedure *procedure,
GParamSpec **args,
gint n_args)
{
if (n_args > ARG_OFFSET)
{
args += ARG_OFFSET;
n_args -= ARG_OFFSET;
}
else
{
args = NULL;
n_args = 0;
}
return GIMP_PROCEDURE_CLASS (parent_class)->create_config (procedure,
args,
n_args);
}
/* public functions */ /* public functions */
......
...@@ -39,6 +39,11 @@ static void gimp_thumbnail_procedure_finalize (GObject *object ...@@ -39,6 +39,11 @@ static void gimp_thumbnail_procedure_finalize (GObject *object
static GimpValueArray * static GimpValueArray *
gimp_thumbnail_procedure_run (GimpProcedure *procedure, gimp_thumbnail_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args); const GimpValueArray *args);
static GimpProcedureConfig *
gimp_thumbnail_procedure_create_config
(GimpProcedure *procedure,
GParamSpec **args,
gint n_args);
G_DEFINE_TYPE_WITH_PRIVATE (GimpThumbnailProcedure, gimp_thumbnail_procedure, G_DEFINE_TYPE_WITH_PRIVATE (GimpThumbnailProcedure, gimp_thumbnail_procedure,
...@@ -57,6 +62,7 @@ gimp_thumbnail_procedure_class_init (GimpThumbnailProcedureClass *klass) ...@@ -57,6 +62,7 @@ gimp_thumbnail_procedure_class_init (GimpThumbnailProcedureClass *klass)
object_class->finalize = gimp_thumbnail_procedure_finalize; object_class->finalize = gimp_thumbnail_procedure_finalize;
procedure_class->run = gimp_thumbnail_procedure_run; procedure_class->run = gimp_thumbnail_procedure_run;
procedure_class->create_config = gimp_thumbnail_procedure_create_config;
} }
static void static void
...@@ -126,6 +132,8 @@ gimp_thumbnail_procedure_finalize (GObject *object) ...@@ -126,6 +132,8 @@ gimp_thumbnail_procedure_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
#define ARG_OFFSET 2
static GimpValueArray * static GimpValueArray *
gimp_thumbnail_procedure_run (GimpProcedure *procedure, gimp_thumbnail_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args) const GimpValueArray *args)
...@@ -140,9 +148,9 @@ gimp_thumbnail_procedure_run (GimpProcedure *procedure, ...@@ -140,9 +148,9 @@ gimp_thumbnail_procedure_run (GimpProcedure *procedure,
file = GIMP_VALUES_GET_FILE (args, 0); file = GIMP_VALUES_GET_FILE (args, 0);
size = GIMP_VALUES_GET_INT (args, 1); size = GIMP_VALUES_GET_INT (args, 1);
remaining = gimp_value_array_new (gimp_value_array_length (args) - 2); remaining = gimp_value_array_new (gimp_value_array_length (args) - ARG_OFFSET);
for (i = 2; i < gimp_value_array_length (args); i++) for (i = ARG_OFFSET; i < gimp_value_array_length (args); i++)
{ {
GValue *value = gimp_value_array_index (args, i); GValue *value = gimp_value_array_index (args, i);
...@@ -160,6 +168,27 @@ gimp_thumbnail_procedure_run (GimpProcedure *procedure, ...@@ -160,6 +168,27 @@ gimp_thumbnail_procedure_run (GimpProcedure *procedure,
return return_values; return return_values;
} }
static GimpProcedureConfig *
gimp_thumbnail_procedure_create_config (GimpProcedure *procedure,
GParamSpec **args,
gint n_args)
{
if (n_args > ARG_OFFSET)
{
args += ARG_OFFSET;
n_args -= ARG_OFFSET;
}
else
{
args = NULL;
n_args = 0;
}
return GIMP_PROCEDURE_CLASS (parent_class)->create_config (procedure,
args,
n_args);
}
/* public functions */ /* public functions */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment