[gimp] app: implement GimpConfig::reset() in GimpPDBContext
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: implement GimpConfig::reset() in GimpPDBContext
- Date: Mon, 9 Nov 2015 02:25:09 +0000 (UTC)
commit dac5493132ef14be4d39ce6f85ae285b5c716cb5
Author: Michael Natterer <mitch gimp org>
Date: Mon Nov 9 03:20:45 2015 +0100
app: implement GimpConfig::reset() in GimpPDBContext
and reset its paint and stroke options.
app/pdb/gimppdbcontext.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/app/pdb/gimppdbcontext.c b/app/pdb/gimppdbcontext.c
index d8967c0..d7aca1e 100644
--- a/app/pdb/gimppdbcontext.c
+++ b/app/pdb/gimppdbcontext.c
@@ -58,6 +58,8 @@ enum
};
+static void gimp_pdb_context_iface_init (GimpConfigInterface *iface);
+
static void gimp_pdb_context_constructed (GObject *object);
static void gimp_pdb_context_finalize (GObject *object);
static void gimp_pdb_context_set_property (GObject *object,
@@ -69,11 +71,17 @@ static void gimp_pdb_context_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
+static void gimp_pdb_context_reset (GimpConfig *config);
+
-G_DEFINE_TYPE (GimpPDBContext, gimp_pdb_context, GIMP_TYPE_CONTEXT)
+G_DEFINE_TYPE_WITH_CODE (GimpPDBContext, gimp_pdb_context, GIMP_TYPE_CONTEXT,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+ gimp_pdb_context_iface_init))
#define parent_class gimp_pdb_context_parent_class
+static GimpConfigInterface *parent_config_iface = NULL;
+
static void
gimp_pdb_context_class_init (GimpPDBContextClass *klass)
@@ -147,6 +155,17 @@ gimp_pdb_context_class_init (GimpPDBContextClass *klass)
}
static void
+gimp_pdb_context_iface_init (GimpConfigInterface *iface)
+{
+ parent_config_iface = g_type_interface_peek_parent (iface);
+
+ if (! parent_config_iface)
+ parent_config_iface = g_type_default_interface_peek (GIMP_TYPE_CONFIG);
+
+ iface->reset = gimp_pdb_context_reset;
+}
+
+static void
gimp_pdb_context_init (GimpPDBContext *context)
{
context->paint_options_list = gimp_list_new (GIMP_TYPE_PAINT_OPTIONS,
@@ -341,6 +360,31 @@ gimp_pdb_context_get_property (GObject *object,
}
}
+static void
+gimp_pdb_context_reset (GimpConfig *config)
+{
+ GimpPDBContext *context = GIMP_PDB_CONTEXT (config);
+ GList *list;
+
+ for (list = GIMP_LIST (context->paint_options_list)->list;
+ list;
+ list = g_list_next (list))
+ {
+ gimp_config_reset (list->data);
+ }
+
+ gimp_config_reset (GIMP_CONFIG (context->stroke_options));
+
+ /* preserve the traditional PDB default */
+ g_object_set (context->stroke_options,
+ "method", GIMP_STROKE_PAINT_METHOD,
+ NULL);
+
+ parent_config_iface->reset (config);
+
+ g_object_notify (G_OBJECT (context), "antialias");
+}
+
GimpContext *
gimp_pdb_context_new (Gimp *gimp,
GimpContext *parent,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]