[gimp] app: remove virtual function GimpToolOptions::reset()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: remove virtual function GimpToolOptions::reset()
- Date: Tue, 29 Dec 2015 11:48:01 +0000 (UTC)
commit 2e40af5dcf49f578f7c2f5fc6555b9145090a4d8
Author: Michael Natterer <mitch gimp org>
Date: Tue Dec 29 12:47:04 2015 +0100
app: remove virtual function GimpToolOptions::reset()
and use GimpConfig::reset() instead.
app/actions/tool-options-commands.c | 4 ++--
app/core/gimptooloptions.c | 18 ------------------
app/core/gimptooloptions.h | 4 ----
app/paint/gimpmybrushoptions.c | 16 +++++++++-------
app/tools/gimp-tools.c | 2 +-
app/tools/gimpbucketfilloptions.c | 34 +++++++++++++++++++++++-----------
app/tools/gimpmagnifyoptions.c | 34 +++++++++++++++++++++++-----------
app/tools/gimpregionselectoptions.c | 34 +++++++++++++++++++++++-----------
app/tools/gimptextoptions.c | 25 ++++++++++++++++++-------
app/tools/gimptransformoptions.c | 34 +++++++++++++++++++++++-----------
10 files changed, 122 insertions(+), 83 deletions(-)
---
diff --git a/app/actions/tool-options-commands.c b/app/actions/tool-options-commands.c
index cf3f784..6d40337 100644
--- a/app/actions/tool-options-commands.c
+++ b/app/actions/tool-options-commands.c
@@ -175,7 +175,7 @@ tool_options_reset_cmd_callback (GtkAction *action,
GimpContext *context = gimp_get_user_context (gimp_editor_get_ui_manager (editor)->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
- gimp_tool_options_reset (tool_info->tool_options);
+ gimp_config_reset (GIMP_CONFIG (tool_info->tool_options));
}
void
@@ -222,7 +222,7 @@ tool_options_reset_all_cmd_callback (GtkAction *action,
{
GimpToolInfo *tool_info = list->data;
- gimp_tool_options_reset (tool_info->tool_options);
+ gimp_config_reset (GIMP_CONFIG (tool_info->tool_options));
}
}
diff --git a/app/core/gimptooloptions.c b/app/core/gimptooloptions.c
index d22ab06..b4b4be8 100644
--- a/app/core/gimptooloptions.c
+++ b/app/core/gimptooloptions.c
@@ -53,8 +53,6 @@ static void gimp_tool_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_tool_options_real_reset (GimpToolOptions *tool_options);
-
static void gimp_tool_options_config_reset (GimpConfig *config);
static void gimp_tool_options_tool_notify (GimpToolOptions *options,
@@ -77,8 +75,6 @@ gimp_tool_options_class_init (GimpToolOptionsClass *klass)
object_class->set_property = gimp_tool_options_set_property;
object_class->get_property = gimp_tool_options_get_property;
- klass->reset = gimp_tool_options_real_reset;
-
g_object_class_override_property (object_class, PROP_TOOL, "tool");
g_object_class_install_property (object_class, PROP_TOOL_INFO,
@@ -240,12 +236,6 @@ gimp_tool_options_get_property (GObject *object,
}
static void
-gimp_tool_options_real_reset (GimpToolOptions *tool_options)
-{
- gimp_config_reset (GIMP_CONFIG (tool_options));
-}
-
-static void
gimp_tool_options_config_reset (GimpConfig *config)
{
gchar *name = g_strdup (gimp_object_get_name (config));
@@ -276,14 +266,6 @@ gimp_tool_options_tool_notify (GimpToolOptions *options,
/* public functions */
-void
-gimp_tool_options_reset (GimpToolOptions *tool_options)
-{
- g_return_if_fail (GIMP_IS_TOOL_OPTIONS (tool_options));
-
- GIMP_TOOL_OPTIONS_GET_CLASS (tool_options)->reset (tool_options);
-}
-
gboolean
gimp_tool_options_serialize (GimpToolOptions *tool_options,
GError **error)
diff --git a/app/core/gimptooloptions.h b/app/core/gimptooloptions.h
index 3fc1f39..055ecf5 100644
--- a/app/core/gimptooloptions.h
+++ b/app/core/gimptooloptions.h
@@ -42,15 +42,11 @@ struct _GimpToolOptions
struct _GimpToolOptionsClass
{
GimpContextClass parent_class;
-
- void (* reset) (GimpToolOptions *tool_options);
};
GType gimp_tool_options_get_type (void) G_GNUC_CONST;
-void gimp_tool_options_reset (GimpToolOptions *tool_options);
-
gboolean gimp_tool_options_serialize (GimpToolOptions *tool_options,
GError **error);
gboolean gimp_tool_options_deserialize (GimpToolOptions *tool_options,
diff --git a/app/paint/gimpmybrushoptions.c b/app/paint/gimpmybrushoptions.c
index 044a469..5cbaf22 100644
--- a/app/paint/gimpmybrushoptions.c
+++ b/app/paint/gimpmybrushoptions.c
@@ -57,7 +57,8 @@ static void gimp_mybrush_options_get_property (GObject *object,
static void gimp_mybrush_options_mybrush_changed (GimpContext *context,
GimpMybrush *brush);
-static void gimp_mybrush_options_config_reset (GimpConfig *gimp_config);
+static void gimp_mybrush_options_reset (GimpConfig *config);
+
G_DEFINE_TYPE_WITH_CODE (GimpMybrushOptions, gimp_mybrush_options,
GIMP_TYPE_PAINT_OPTIONS,
@@ -66,6 +67,7 @@ G_DEFINE_TYPE_WITH_CODE (GimpMybrushOptions, gimp_mybrush_options,
static GimpConfigInterface *parent_config_iface = NULL;
+
static void
gimp_mybrush_options_class_init (GimpMybrushOptionsClass *klass)
{
@@ -95,13 +97,12 @@ gimp_mybrush_options_class_init (GimpMybrushOptionsClass *klass)
GIMP_PARAM_STATIC_STRINGS);
}
-
static void
gimp_mybrush_options_config_iface_init (GimpConfigInterface *config_iface)
{
parent_config_iface = g_type_interface_peek_parent (config_iface);
- config_iface->reset = gimp_mybrush_options_config_reset;
+ config_iface->reset = gimp_mybrush_options_reset;
}
static void
@@ -181,11 +182,12 @@ gimp_mybrush_options_mybrush_changed (GimpContext *context,
}
static void
-gimp_mybrush_options_config_reset (GimpConfig *gimp_config)
+gimp_mybrush_options_reset (GimpConfig *config)
{
- GimpContext *context = GIMP_CONTEXT (gimp_config);
+ GimpContext *context = GIMP_CONTEXT (config);
GimpMybrush *brush = gimp_context_get_mybrush (context);
- parent_config_iface->reset (gimp_config);
+ parent_config_iface->reset (config);
+
gimp_mybrush_options_mybrush_changed (context, brush);
-}
\ No newline at end of file
+}
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index a96188f..362ea00 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -322,7 +322,7 @@ gimp_tools_restore (Gimp *gimp)
GimpToolInfo *tool_info = GIMP_TOOL_INFO (list->data);
/* get default values from prefs (see bug #120832) */
- gimp_tool_options_reset (tool_info->tool_options);
+ gimp_config_reset (GIMP_CONFIG (tool_info->tool_options));
}
if (! gimp_contexts_load (gimp, &error))
diff --git a/app/tools/gimpbucketfilloptions.c b/app/tools/gimpbucketfilloptions.c
index 1ecc477..dffde6f 100644
--- a/app/tools/gimpbucketfilloptions.c
+++ b/app/tools/gimpbucketfilloptions.c
@@ -55,6 +55,8 @@ enum
};
+static void gimp_bucket_fill_options_config_iface_init (GimpConfigInterface *config_iface);
+
static void gimp_bucket_fill_options_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -64,26 +66,27 @@ static void gimp_bucket_fill_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_bucket_fill_options_reset (GimpToolOptions *tool_options);
+static void gimp_bucket_fill_options_reset (GimpConfig *config);
-G_DEFINE_TYPE (GimpBucketFillOptions, gimp_bucket_fill_options,
- GIMP_TYPE_PAINT_OPTIONS)
+G_DEFINE_TYPE_WITH_CODE (GimpBucketFillOptions, gimp_bucket_fill_options,
+ GIMP_TYPE_PAINT_OPTIONS,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+ gimp_bucket_fill_options_config_iface_init))
#define parent_class gimp_bucket_fill_options_parent_class
+static GimpConfigInterface *parent_config_iface = NULL;
+
static void
gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_bucket_fill_options_set_property;
object_class->get_property = gimp_bucket_fill_options_get_property;
- options_class->reset = gimp_bucket_fill_options_reset;
-
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_FILL_MODE,
"fill-mode", NULL,
GIMP_TYPE_BUCKET_FILL_MODE,
@@ -120,6 +123,14 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
}
static void
+gimp_bucket_fill_options_config_iface_init (GimpConfigInterface *config_iface)
+{
+ parent_config_iface = g_type_interface_peek_parent (config_iface);
+
+ config_iface->reset = gimp_bucket_fill_options_reset;
+}
+
+static void
gimp_bucket_fill_options_init (GimpBucketFillOptions *options)
{
}
@@ -195,18 +206,19 @@ gimp_bucket_fill_options_get_property (GObject *object,
}
static void
-gimp_bucket_fill_options_reset (GimpToolOptions *tool_options)
+gimp_bucket_fill_options_reset (GimpConfig *config)
{
- GParamSpec *pspec;
+ GimpToolOptions *tool_options = GIMP_TOOL_OPTIONS (config);
+ GParamSpec *pspec;
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
"threshold");
if (pspec)
G_PARAM_SPEC_DOUBLE (pspec)->default_value =
tool_options->tool_info->gimp->config->default_threshold;
- GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
+ parent_config_iface->reset (config);
}
GtkWidget *
diff --git a/app/tools/gimpmagnifyoptions.c b/app/tools/gimpmagnifyoptions.c
index 78f8c19..068ff02 100644
--- a/app/tools/gimpmagnifyoptions.c
+++ b/app/tools/gimpmagnifyoptions.c
@@ -46,6 +46,8 @@ enum
};
+static void gimp_magnify_options_config_iface_init (GimpConfigInterface *config_iface);
+
static void gimp_magnify_options_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -55,26 +57,27 @@ static void gimp_magnify_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_magnify_options_reset (GimpToolOptions *tool_options);
+static void gimp_magnify_options_reset (GimpConfig *config);
-G_DEFINE_TYPE (GimpMagnifyOptions, gimp_magnify_options,
- GIMP_TYPE_TOOL_OPTIONS)
+G_DEFINE_TYPE_WITH_CODE (GimpMagnifyOptions, gimp_magnify_options,
+ GIMP_TYPE_TOOL_OPTIONS,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+ gimp_magnify_options_config_iface_init))
#define parent_class gimp_magnify_options_parent_class
+static GimpConfigInterface *parent_config_iface = NULL;
+
static void
gimp_magnify_options_class_init (GimpMagnifyOptionsClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_magnify_options_set_property;
object_class->get_property = gimp_magnify_options_get_property;
- options_class->reset = gimp_magnify_options_reset;
-
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_AUTO_RESIZE,
"auto-resize",
_("Resize image window to accommodate "
@@ -91,6 +94,14 @@ gimp_magnify_options_class_init (GimpMagnifyOptionsClass *klass)
}
static void
+gimp_magnify_options_config_iface_init (GimpConfigInterface *config_iface)
+{
+ parent_config_iface = g_type_interface_peek_parent (config_iface);
+
+ config_iface->reset = gimp_magnify_options_reset;
+}
+
+static void
gimp_magnify_options_init (GimpMagnifyOptions *options)
{
}
@@ -142,18 +153,19 @@ gimp_magnify_options_get_property (GObject *object,
}
static void
-gimp_magnify_options_reset (GimpToolOptions *tool_options)
+gimp_magnify_options_reset (GimpConfig *config)
{
- GParamSpec *pspec;
+ GimpToolOptions *tool_options = GIMP_TOOL_OPTIONS (config);
+ GParamSpec *pspec;
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
"auto-resize");
if (pspec)
G_PARAM_SPEC_BOOLEAN (pspec)->default_value =
GIMP_DISPLAY_CONFIG (tool_options->tool_info->gimp->config)->resize_windows_on_zoom;
- GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
+ parent_config_iface->reset (config);
}
GtkWidget *
diff --git a/app/tools/gimpregionselectoptions.c b/app/tools/gimpregionselectoptions.c
index 0fe87bf..2262104 100644
--- a/app/tools/gimpregionselectoptions.c
+++ b/app/tools/gimpregionselectoptions.c
@@ -50,6 +50,8 @@ enum
};
+static void gimp_region_select_options_config_iface_init (GimpConfigInterface *config_iface);
+
static void gimp_region_select_options_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -59,26 +61,27 @@ static void gimp_region_select_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_region_select_options_reset (GimpToolOptions *tool_options);
+static void gimp_region_select_options_reset (GimpConfig *config);
-G_DEFINE_TYPE (GimpRegionSelectOptions, gimp_region_select_options,
- GIMP_TYPE_SELECTION_OPTIONS)
+G_DEFINE_TYPE_WITH_CODE (GimpRegionSelectOptions, gimp_region_select_options,
+ GIMP_TYPE_SELECTION_OPTIONS,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+ gimp_region_select_options_config_iface_init))
#define parent_class gimp_region_select_options_parent_class
+static GimpConfigInterface *parent_config_iface = NULL;
+
static void
gimp_region_select_options_class_init (GimpRegionSelectOptionsClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_region_select_options_set_property;
object_class->get_property = gimp_region_select_options_get_property;
- options_class->reset = gimp_region_select_options_reset;
-
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SELECT_TRANSPARENT,
"select-transparent",
_("Allow completely transparent regions "
@@ -115,6 +118,14 @@ gimp_region_select_options_class_init (GimpRegionSelectOptionsClass *klass)
}
static void
+gimp_region_select_options_config_iface_init (GimpConfigInterface *config_iface)
+{
+ parent_config_iface = g_type_interface_peek_parent (config_iface);
+
+ config_iface->reset = gimp_region_select_options_reset;
+}
+
+static void
gimp_region_select_options_init (GimpRegionSelectOptions *options)
{
}
@@ -192,18 +203,19 @@ gimp_region_select_options_get_property (GObject *object,
}
static void
-gimp_region_select_options_reset (GimpToolOptions *tool_options)
+gimp_region_select_options_reset (GimpConfig *config)
{
- GParamSpec *pspec;
+ GimpToolOptions *tool_options = GIMP_TOOL_OPTIONS (config);
+ GParamSpec *pspec;
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
"threshold");
if (pspec)
G_PARAM_SPEC_DOUBLE (pspec)->default_value =
tool_options->tool_info->gimp->config->default_threshold;
- GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
+ parent_config_iface->reset (config);
}
GtkWidget *
diff --git a/app/tools/gimptextoptions.c b/app/tools/gimptextoptions.c
index bb5b478..8395fe7 100644
--- a/app/tools/gimptextoptions.c
+++ b/app/tools/gimptextoptions.c
@@ -72,6 +72,8 @@ enum
};
+static void gimp_text_options_config_iface_init (GimpConfigInterface *config_iface);
+
static void gimp_text_options_finalize (GObject *object);
static void gimp_text_options_set_property (GObject *object,
guint property_id,
@@ -82,7 +84,7 @@ static void gimp_text_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_text_options_reset (GimpToolOptions *tool_options);
+static void gimp_text_options_reset (GimpConfig *config);
static void gimp_text_options_notify_font (GimpContext *context,
GParamSpec *pspec,
@@ -100,24 +102,25 @@ static void gimp_text_options_notify_text_color (GimpText *text,
G_DEFINE_TYPE_WITH_CODE (GimpTextOptions, gimp_text_options,
GIMP_TYPE_TOOL_OPTIONS,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+ gimp_text_options_config_iface_init)
G_IMPLEMENT_INTERFACE (GIMP_TYPE_RECTANGLE_OPTIONS,
NULL))
#define parent_class gimp_text_options_parent_class
+static GimpConfigInterface *parent_config_iface = NULL;
+
static void
gimp_text_options_class_init (GimpTextOptionsClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gimp_text_options_finalize;
object_class->set_property = gimp_text_options_set_property;
object_class->get_property = gimp_text_options_get_property;
- options_class->reset = gimp_text_options_reset;
-
/* The 'highlight' property is defined here because we want different
* default values for the Crop, Text and the Rectangle Select tools.
*/
@@ -215,6 +218,14 @@ gimp_text_options_class_init (GimpTextOptionsClass *klass)
}
static void
+gimp_text_options_config_iface_init (GimpConfigInterface *config_iface)
+{
+ parent_config_iface = g_type_interface_peek_parent (config_iface);
+
+ config_iface->reset = gimp_text_options_reset;
+}
+
+static void
gimp_text_options_init (GimpTextOptions *options)
{
options->size_entry = NULL;
@@ -358,9 +369,9 @@ gimp_text_options_set_property (GObject *object,
}
static void
-gimp_text_options_reset (GimpToolOptions *tool_options)
+gimp_text_options_reset (GimpConfig *config)
{
- GObject *object = G_OBJECT (tool_options);
+ GObject *object = G_OBJECT (config);
/* implement reset() ourselves because the default impl would
* reset *all* properties, including all rectangle properties
diff --git a/app/tools/gimptransformoptions.c b/app/tools/gimptransformoptions.c
index 45c7773..a326415 100644
--- a/app/tools/gimptransformoptions.c
+++ b/app/tools/gimptransformoptions.c
@@ -67,6 +67,8 @@ enum
};
+static void gimp_transform_options_config_iface_init (GimpConfigInterface *config_iface);
+
static void gimp_transform_options_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -76,7 +78,7 @@ static void gimp_transform_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_transform_options_reset (GimpToolOptions *tool_options);
+static void gimp_transform_options_reset (GimpConfig *config);
static gboolean gimp_transform_options_sync_grid (GBinding *binding,
const GValue *source_value,
@@ -84,23 +86,24 @@ static gboolean gimp_transform_options_sync_grid (GBinding *binding,
gpointer user_data);
-G_DEFINE_TYPE (GimpTransformOptions, gimp_transform_options,
- GIMP_TYPE_TOOL_OPTIONS)
+G_DEFINE_TYPE_WITH_CODE (GimpTransformOptions, gimp_transform_options,
+ GIMP_TYPE_TOOL_OPTIONS,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+ gimp_transform_options_config_iface_init))
#define parent_class gimp_transform_options_parent_class
+static GimpConfigInterface *parent_config_iface = NULL;
+
static void
gimp_transform_options_class_init (GimpTransformOptionsClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_transform_options_set_property;
object_class->get_property = gimp_transform_options_get_property;
- options_class->reset = gimp_transform_options_reset;
-
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TYPE,
"type", NULL,
GIMP_TYPE_TRANSFORM_TYPE,
@@ -199,6 +202,14 @@ gimp_transform_options_class_init (GimpTransformOptionsClass *klass)
}
static void
+gimp_transform_options_config_iface_init (GimpConfigInterface *config_iface)
+{
+ parent_config_iface = g_type_interface_peek_parent (config_iface);
+
+ config_iface->reset = gimp_transform_options_reset;
+}
+
+static void
gimp_transform_options_init (GimpTransformOptions *options)
{
}
@@ -344,18 +355,19 @@ gimp_transform_options_get_property (GObject *object,
}
static void
-gimp_transform_options_reset (GimpToolOptions *tool_options)
+gimp_transform_options_reset (GimpConfig *config)
{
- GParamSpec *pspec;
+ GimpToolOptions *tool_options = GIMP_TOOL_OPTIONS (config);
+ GParamSpec *pspec;
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
"interpolation");
if (pspec)
G_PARAM_SPEC_ENUM (pspec)->default_value =
tool_options->tool_info->gimp->config->interpolation_type;
- GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
+ parent_config_iface->reset (config);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]