Author: kelnos
Date: 2008-04-21 08:33:15 +0000 (Mon, 21 Apr 2008)
New Revision: 26876

Modified:
   xfconf/trunk/common/xfconf-dbus.xml
   xfconf/trunk/common/xfconf-marshal.list
   xfconf/trunk/xfconf/xfconf-binding.c
   xfconf/trunk/xfconf/xfconf-channel.c
   xfconf/trunk/xfconf/xfconf.c
   xfconf/trunk/xfconfd/xfconf-daemon.c
Log:
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


Modified: xfconf/trunk/common/xfconf-dbus.xml
===================================================================
--- xfconf/trunk/common/xfconf-dbus.xml 2008-04-21 01:02:51 UTC (rev 26875)
+++ xfconf/trunk/common/xfconf-dbus.xml 2008-04-21 08:33:15 UTC (rev 26876)
@@ -108,6 +108,7 @@
         <signal name="PropertyChanged">
             <arg name="channel" type="s"/>
             <arg name="property" type="s"/>
+            <arg name="value" type="v"/>
         </signal>
     </interface>
     

Modified: xfconf/trunk/common/xfconf-marshal.list
===================================================================
--- xfconf/trunk/common/xfconf-marshal.list     2008-04-21 01:02:51 UTC (rev 
26875)
+++ xfconf/trunk/common/xfconf-marshal.list     2008-04-21 08:33:15 UTC (rev 
26876)
@@ -1 +1,2 @@
-VOID:STRING,STRING
+VOID:STRING,STRING,BOXED
+VOID:STRING,BOXED

Modified: xfconf/trunk/xfconf/xfconf-binding.c
===================================================================
--- xfconf/trunk/xfconf/xfconf-binding.c        2008-04-21 01:02:51 UTC (rev 
26875)
+++ xfconf/trunk/xfconf/xfconf-binding.c        2008-04-21 08:33:15 UTC (rev 
26876)
@@ -45,6 +45,7 @@
                                               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 @@
 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, };
+    GValue dst_val = { 0, };
 
-    if(!xfconf_channel_get_property(channel, property, &src_val))
-        return;
-
     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 @@
                                           binding);
     }
 
-    g_value_unset(&src_val);
     g_value_unset(&dst_val);
 }
 
@@ -194,6 +192,7 @@
     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 @@
                                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);
+    }
 }
 
 /**

Modified: xfconf/trunk/xfconf/xfconf-channel.c
===================================================================
--- xfconf/trunk/xfconf/xfconf-channel.c        2008-04-21 01:02:51 UTC (rev 
26875)
+++ xfconf/trunk/xfconf/xfconf-channel.c        2008-04-21 08:33:15 UTC (rev 
26876)
@@ -74,7 +74,8 @@
 
     /*< 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_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 @@
                                                                  
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 @@
                                                         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 @@
 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 @@
         return;
 
     g_signal_emit(G_OBJECT(channel), signals[SIG_PROPERTY_CHANGED],
-                  g_quark_from_string(property), property);
+                  g_quark_from_string(property), property, value);
 }
 
 

Modified: xfconf/trunk/xfconf/xfconf.c
===================================================================
--- xfconf/trunk/xfconf/xfconf.c        2008-04-21 01:02:51 UTC (rev 26875)
+++ xfconf/trunk/xfconf/xfconf.c        2008-04-21 08:33:15 UTC (rev 26876)
@@ -125,13 +125,14 @@
                                            "/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,

Modified: xfconf/trunk/xfconfd/xfconf-daemon.c
===================================================================
--- xfconf/trunk/xfconfd/xfconf-daemon.c        2008-04-21 01:02:51 UTC (rev 
26875)
+++ xfconf/trunk/xfconfd/xfconf-daemon.c        2008-04-21 08:33:15 UTC (rev 
26876)
@@ -110,10 +110,11 @@
                                                  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 @@
                                        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

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to