gimp r24908 - in trunk: . app/tools
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24908 - in trunk: . app/tools
- Date: Mon, 18 Feb 2008 15:52:02 +0000 (GMT)
Author: mitch
Date: Mon Feb 18 15:52:01 2008
New Revision: 24908
URL: http://svn.gnome.org/viewvc/gimp?rev=24908&view=rev
Log:
2008-02-18 Michael Natterer <mitch gimp org>
* app/tools/gimpgegltool.c (gimp_gegl_tool_config_get_property):
clean up generic property handling of generated settings classes.
Modified:
trunk/ChangeLog
trunk/app/tools/gimpgegltool.c
Modified: trunk/app/tools/gimpgegltool.c
==============================================================================
--- trunk/app/tools/gimpgegltool.c (original)
+++ trunk/app/tools/gimpgegltool.c Mon Feb 18 15:52:01 2008
@@ -458,11 +458,21 @@
return NULL;
}
+static GValue *
+gimp_gegl_tool_config_value_new (GParamSpec *pspec)
+{
+ GValue *value = g_slice_new0 (GValue);
+
+ g_value_init (value, pspec->value_type);
+
+ return value;
+}
+
static void
gimp_gegl_tool_config_value_free (GValue *value)
{
g_value_unset (value);
- g_free (value);
+ g_slice_free (GValue, value);
}
static GHashTable *
@@ -484,25 +494,32 @@
return properties;
}
-static void
-gimp_gegl_tool_config_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+static GValue *
+gimp_gegl_tool_config_value_get (GObject *object,
+ GParamSpec *pspec)
{
GHashTable *properties = gimp_gegl_tool_config_get_properties (object);
- GValue *val;
+ GValue *value;
- val = g_hash_table_lookup (properties, pspec->name);
+ value = g_hash_table_lookup (properties, pspec->name);
- if (! val)
+ if (! value)
{
- val = g_new0 (GValue, 1);
- g_hash_table_insert (properties, g_strdup (pspec->name), val);
-
- g_value_init (val, pspec->value_type);
+ value = gimp_gegl_tool_config_value_new (pspec);
+ g_hash_table_insert (properties, g_strdup (pspec->name), value);
}
+ return value;
+}
+
+static void
+gimp_gegl_tool_config_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GValue *val = gimp_gegl_tool_config_value_get (object, pspec);
+
g_value_copy (value, val);
}
@@ -512,19 +529,7 @@
GValue *value,
GParamSpec *pspec)
{
- GHashTable *properties = gimp_gegl_tool_config_get_properties (object);
- GValue *val;
-
- val = g_hash_table_lookup (properties, pspec->name);
-
- if (! val)
- {
- val = g_new0 (GValue, 1);
- g_hash_table_insert (properties, g_strdup (pspec->name), val);
-
- g_value_init (val, pspec->value_type);
- g_param_value_set_default (pspec, val);
- }
+ GValue *val = gimp_gegl_tool_config_value_get (object, pspec);
g_value_copy (val, value);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]