summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2010-02-26 14:08:18 +0100
committerNick Schermer <nick@xfce.org>2010-02-26 14:11:40 +0100
commita561ecbd2da53f281d9dc959f474d12536f03fc6 (patch)
tree252aca611fb2cd356c934317bf42097f7809d0ea /common
parent423f666a8931e6b053c63f37057ef87e8ba208d0 (diff)
downloadxfce4-panel-a561ecbd2da53f281d9dc959f474d12536f03fc6.tar.gz
Implement property saving in the bindings.
If saving is enabled, the bindings won't restore the value found in the channel, but instead notify to property on the object so it gets stored.
Diffstat (limited to 'common')
-rw-r--r--common/panel-xfconf.c11
-rw-r--r--common/panel-xfconf.h3
2 files changed, 11 insertions, 3 deletions
diff --git a/common/panel-xfconf.c b/common/panel-xfconf.c
index b2920b95..7df31dbc 100644
--- a/common/panel-xfconf.c
+++ b/common/panel-xfconf.c
@@ -193,7 +193,8 @@ void
panel_properties_bind (XfconfChannel *channel,
GObject *object,
const gchar *property_base,
- const PanelProperty *properties)
+ const PanelProperty *properties,
+ gboolean save_properties)
{
const PanelProperty *prop;
const GValue *value;
@@ -207,7 +208,9 @@ panel_properties_bind (XfconfChannel *channel,
panel_return_if_fail (properties != NULL);
/* get or ref the hash table */
- if (shared_hash_table != NULL)
+ if (save_properties)
+ hash_table = NULL;
+ else if (shared_hash_table != NULL)
hash_table = g_hash_table_ref (shared_hash_table);
else
hash_table = xfconf_channel_get_properties (channel, property_base);
@@ -244,6 +247,10 @@ panel_properties_bind (XfconfChannel *channel,
G_CALLBACK (panel_properties_object_notify), binding,
panel_properties_object_disconnect, 0);
+ /* emit the property so it gets saved */
+ if (save_properties)
+ g_object_notify (G_OBJECT (object), prop->property);
+
/* monitor channel changes */
g_snprintf (buf, sizeof (buf), "property-changed::%s", binding->channel_prop);
g_object_weak_ref (G_OBJECT (channel), panel_properties_channel_destroyed, binding);
diff --git a/common/panel-xfconf.h b/common/panel-xfconf.h
index db58f2f5..6d756604 100644
--- a/common/panel-xfconf.h
+++ b/common/panel-xfconf.h
@@ -34,7 +34,8 @@ XfconfChannel *panel_properties_get_channel (void);
void panel_properties_bind (XfconfChannel *channel,
GObject *object,
const gchar *property_base,
- const PanelProperty *properties);
+ const PanelProperty *properties,
+ gboolean save_properties);
void panel_properties_unbind (GObject *object);