diff options
author | Brian Tarricone <brian@tarricone.org> | 2008-04-21 08:33:15 +0000 |
---|---|---|
committer | Brian Tarricone <brian@tarricone.org> | 2008-04-21 08:33:15 +0000 |
commit | 8cb0649fda04ecb233d45f0b7d7195c1db7b111d (patch) | |
tree | e5ca860b4d05cf500b6ec3ab4f8e8385b86252a9 /xfconf/xfconf-binding.c | |
parent | 03f43f6dcedfbacca5f62cbbff168e1980383d11 (diff) | |
download | xfconf-8cb0649fda04ecb233d45f0b7d7195c1db7b111d.tar.gz |
add property value to PropertyChanged/XfconfChannel::property-changed signal
it seems like every time i get a property-changed signal, the first thing
i do is go and fetch the property. always sending the value over the wire
in the signal will generally save us a round-trip when handling property
changes. the downside is that the value always gets sent out on any prop
change, regardless if anyone cares about that particular property or not
(Old svn revision: 26876)
Diffstat (limited to 'xfconf/xfconf-binding.c')
-rw-r--r-- | xfconf/xfconf-binding.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/xfconf/xfconf-binding.c b/xfconf/xfconf-binding.c index c1f7d54..e484e7e 100644 --- a/xfconf/xfconf-binding.c +++ b/xfconf/xfconf-binding.c @@ -45,6 +45,7 @@ static void xfconf_g_binding_object_destroyed(gpointer data, GObject *where_the_object_was); static void xfconf_g_binding_channel_property_changed(XfconfChannel *channel, const gchar *property, + const GValue *value, gpointer user_data); static void xfconf_g_binding_object_property_changed(GObject *object, GParamSpec *pspec, @@ -110,17 +111,15 @@ xfconf_g_binding_object_destroyed(gpointer data, static void xfconf_g_binding_channel_property_changed(XfconfChannel *channel, const gchar *property, + const GValue *value, gpointer user_data) { XfconfGBinding *binding = user_data; - GValue src_val = { 0, }, dst_val = { 0, }; - - if(!xfconf_channel_get_property(channel, property, &src_val)) - return; + GValue dst_val = { 0, }; g_value_init(&dst_val, binding->object_property_type); - if(g_value_transform(&src_val, &dst_val)) { + if(g_value_transform(value, &dst_val)) { g_signal_handlers_block_by_func(binding->object, G_CALLBACK(xfconf_g_binding_object_property_changed), binding); @@ -131,7 +130,6 @@ xfconf_g_binding_channel_property_changed(XfconfChannel *channel, binding); } - g_value_unset(&src_val); g_value_unset(&dst_val); } @@ -194,6 +192,7 @@ xfconf_g_property_bind(XfconfChannel *channel, GParamSpec *pspec; gchar buf[1024]; GList *bindings; + GValue value = { 0, }; g_return_if_fail(XFCONF_IS_CHANNEL(channel) && xfconf_property && *xfconf_property @@ -263,8 +262,11 @@ xfconf_g_property_bind(XfconfChannel *channel, bindings, (GDestroyNotify)g_list_free); } - xfconf_g_binding_channel_property_changed(channel, xfconf_property, - binding); + if(xfconf_channel_get_property(channel, xfconf_property, &value)) { + xfconf_g_binding_channel_property_changed(channel, xfconf_property, + &value, binding); + g_value_unset(&value); + } } /** |