summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Tarricone <brian@tarricone.org>2008-04-21 08:33:15 +0000
committerBrian Tarricone <brian@tarricone.org>2008-04-21 08:33:15 +0000
commit8cb0649fda04ecb233d45f0b7d7195c1db7b111d (patch)
treee5ca860b4d05cf500b6ec3ab4f8e8385b86252a9
parent03f43f6dcedfbacca5f62cbbff168e1980383d11 (diff)
downloadxfconf-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)
-rw-r--r--common/xfconf-dbus.xml1
-rw-r--r--common/xfconf-marshal.list3
-rw-r--r--xfconf/xfconf-binding.c18
-rw-r--r--xfconf/xfconf-channel.c16
-rw-r--r--xfconf/xfconf.c5
-rw-r--r--xfconfd/xfconf-daemon.c16
6 files changed, 36 insertions, 23 deletions
diff --git a/common/xfconf-dbus.xml b/common/xfconf-dbus.xml
index fe8a22d..ed01a44 100644
--- a/common/xfconf-dbus.xml
+++ b/common/xfconf-dbus.xml
@@ -108,6 +108,7 @@
<signal name="PropertyChanged">
<arg name="channel" type="s"/>
<arg name="property" type="s"/>
+ <arg name="value" type="v"/>
</signal>
</interface>
diff --git a/common/xfconf-marshal.list b/common/xfconf-marshal.list
index 72f9937..81409d6 100644
--- a/common/xfconf-marshal.list
+++ b/common/xfconf-marshal.list
@@ -1 +1,2 @@
-VOID:STRING,STRING
+VOID:STRING,STRING,BOXED
+VOID:STRING,BOXED
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);
+ }
}
/**
diff --git a/xfconf/xfconf-channel.c b/xfconf/xfconf-channel.c
index 5d6d2bc..9bc06e4 100644
--- a/xfconf/xfconf-channel.c
+++ b/xfconf/xfconf-channel.c
@@ -74,7 +74,8 @@ typedef struct _XfconfChannelClass
/*< signals >*/
void (*property_changed)(XfconfChannel *channel,
- const gchar *property);
+ const gchar *property,
+ const GValue *value);
} XfconfChannelClass;
enum
@@ -105,6 +106,7 @@ static void xfconf_channel_finalize(GObject *obj);
static void xfconf_channel_property_changed(DBusGProxy *proxy,
const gchar *channel_name,
const gchar *property,
+ const GValue *value,
gpointer user_data);
static guint signals[N_SIGS] = { 0, };
@@ -137,9 +139,10 @@ xfconf_channel_class_init(XfconfChannelClass *klass)
property_changed),
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ xfconf_marshal_VOID__STRING_BOXED,
G_TYPE_NONE,
- 1, G_TYPE_STRING);
+ 2, G_TYPE_STRING,
+ G_TYPE_VALUE);
/**
* XfconfChannel::channel-name:
@@ -153,10 +156,6 @@ xfconf_channel_class_init(XfconfChannelClass *klass)
NULL,
G_PARAM_READWRITE
| G_PARAM_CONSTRUCT_ONLY));
-
- dbus_g_object_register_marshaller(xfconf_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_INVALID);
}
static void
@@ -223,6 +222,7 @@ static void
xfconf_channel_property_changed(DBusGProxy *proxy,
const gchar *channel_name,
const gchar *property,
+ const GValue *value,
gpointer user_data)
{
/* FIXME: optimise this by keeping track of all channels in a big hashtable
@@ -233,7 +233,7 @@ xfconf_channel_property_changed(DBusGProxy *proxy,
return;
g_signal_emit(G_OBJECT(channel), signals[SIG_PROPERTY_CHANGED],
- g_quark_from_string(property), property);
+ g_quark_from_string(property), property, value);
}
diff --git a/xfconf/xfconf.c b/xfconf/xfconf.c
index ec79ce9..7ebdc6e 100644
--- a/xfconf/xfconf.c
+++ b/xfconf/xfconf.c
@@ -125,13 +125,14 @@ xfconf_init(GError **error)
"/org/xfce/Xfconf",
"org.xfce.Xfconf");
- dbus_g_object_register_marshaller((GClosureMarshal)xfconf_marshal_VOID__STRING_STRING,
+ dbus_g_object_register_marshaller((GClosureMarshal)xfconf_marshal_VOID__STRING_STRING_BOXED,
G_TYPE_NONE,
G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_VALUE,
G_TYPE_INVALID);
dbus_g_proxy_add_signal(dbus_proxy, "PropertyChanged",
- G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VALUE,
G_TYPE_INVALID);
gui_dbus_proxy = dbus_g_proxy_new_for_name(dbus_conn,
diff --git a/xfconfd/xfconf-daemon.c b/xfconfd/xfconf-daemon.c
index 3e7cf22..12b5825 100644
--- a/xfconfd/xfconf-daemon.c
+++ b/xfconfd/xfconf-daemon.c
@@ -110,10 +110,11 @@ xfconf_daemon_class_init(XfconfDaemonClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- xfconf_marshal_VOID__STRING_STRING,
+ xfconf_marshal_VOID__STRING_STRING_BOXED,
G_TYPE_NONE,
- 2, G_TYPE_STRING,
- G_TYPE_STRING);
+ 3, G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_VALUE);
dbus_g_object_type_install_info(G_TYPE_FROM_CLASS(klass),
&dbus_glib_xfconf_object_info);
@@ -155,8 +156,15 @@ xfconf_daemon_backend_property_changed(XfconfBackend *backend,
gpointer user_data)
{
XfconfDaemon *xfconfd = user_data;
+ GValue value = { 0, };
+
+ xfconf_backend_get(backend, channel, property, &value, NULL);
+
g_signal_emit(G_OBJECT(xfconfd), signals[SIG_PROPERTY_CHANGED], 0,
- channel, property);
+ channel, property, &value);
+
+ if(G_VALUE_TYPE(&value))
+ g_value_unset(&value);
}
static gboolean