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

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

parent e80c90e1
......@@ -37,13 +37,17 @@ struct _GimpLoadProcedurePrivate
};
static void gimp_load_procedure_constructed (GObject *object);
static void gimp_load_procedure_finalize (GObject *object);
static void gimp_load_procedure_constructed (GObject *object);
static void gimp_load_procedure_finalize (GObject *object);
static void gimp_load_procedure_install (GimpProcedure *procedure);
static void gimp_load_procedure_install (GimpProcedure *procedure);
static GimpValueArray *
gimp_load_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args);
gimp_load_procedure_run (GimpProcedure *procedure,
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,
......@@ -58,11 +62,12 @@ gimp_load_procedure_class_init (GimpLoadProcedureClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpProcedureClass *procedure_class = GIMP_PROCEDURE_CLASS (klass);
object_class->constructed = gimp_load_procedure_constructed;
object_class->finalize = gimp_load_procedure_finalize;
object_class->constructed = gimp_load_procedure_constructed;
object_class->finalize = gimp_load_procedure_finalize;
procedure_class->install = gimp_load_procedure_install;
procedure_class->run = gimp_load_procedure_run;
procedure_class->install = gimp_load_procedure_install;
procedure_class->run = gimp_load_procedure_run;
procedure_class->create_config = gimp_load_procedure_create_config;
}
static void
......@@ -139,6 +144,8 @@ gimp_load_procedure_install (GimpProcedure *procedure)
load_proc->priv->thumbnail_proc);
}
#define ARG_OFFSET 2
static GimpValueArray *
gimp_load_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args)
......@@ -153,9 +160,9 @@ gimp_load_procedure_run (GimpProcedure *procedure,
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
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);
......@@ -173,6 +180,27 @@ gimp_load_procedure_run (GimpProcedure *procedure,
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 */
......
......@@ -34,13 +34,17 @@ struct _GimpSaveProcedurePrivate
};
static void gimp_save_procedure_constructed (GObject *object);
static void gimp_save_procedure_finalize (GObject *object);
static void gimp_save_procedure_constructed (GObject *object);
static void gimp_save_procedure_finalize (GObject *object);
static void gimp_save_procedure_install (GimpProcedure *procedure);
static void gimp_save_procedure_install (GimpProcedure *procedure);
static GimpValueArray *
gimp_save_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args);
gimp_save_procedure_run (GimpProcedure *procedure,
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,
......@@ -55,11 +59,12 @@ gimp_save_procedure_class_init (GimpSaveProcedureClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpProcedureClass *procedure_class = GIMP_PROCEDURE_CLASS (klass);
object_class->constructed = gimp_save_procedure_constructed;
object_class->finalize = gimp_save_procedure_finalize;
object_class->constructed = gimp_save_procedure_constructed;
object_class->finalize = gimp_save_procedure_finalize;
procedure_class->install = gimp_save_procedure_install;
procedure_class->run = gimp_save_procedure_run;
procedure_class->install = gimp_save_procedure_install;
procedure_class->run = gimp_save_procedure_run;
procedure_class->create_config = gimp_save_procedure_create_config;
}
static void
......@@ -131,6 +136,8 @@ gimp_save_procedure_install (GimpProcedure *procedure)
priority);
}
#define ARG_OFFSET 4
static GimpValueArray *
gimp_save_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args)
......@@ -149,9 +156,9 @@ gimp_save_procedure_run (GimpProcedure *procedure,
drawable = GIMP_VALUES_GET_DRAWABLE (args, 2);
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);
......@@ -170,6 +177,27 @@ gimp_save_procedure_run (GimpProcedure *procedure,
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 */
......
......@@ -39,6 +39,11 @@ static void gimp_thumbnail_procedure_finalize (GObject *object
static GimpValueArray *
gimp_thumbnail_procedure_run (GimpProcedure *procedure,
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,
......@@ -53,10 +58,11 @@ gimp_thumbnail_procedure_class_init (GimpThumbnailProcedureClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpProcedureClass *procedure_class = GIMP_PROCEDURE_CLASS (klass);
object_class->constructed = gimp_thumbnail_procedure_constructed;
object_class->finalize = gimp_thumbnail_procedure_finalize;
object_class->constructed = gimp_thumbnail_procedure_constructed;
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
......@@ -126,6 +132,8 @@ gimp_thumbnail_procedure_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
#define ARG_OFFSET 2
static GimpValueArray *
gimp_thumbnail_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args)
......@@ -140,9 +148,9 @@ gimp_thumbnail_procedure_run (GimpProcedure *procedure,
file = GIMP_VALUES_GET_FILE (args, 0);
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);
......@@ -160,6 +168,27 @@ gimp_thumbnail_procedure_run (GimpProcedure *procedure,
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 */
......
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