Author: kelnos
Date: 2008-05-13 03:17:16 +0000 (Tue, 13 May 2008)
New Revision: 26955

Modified:
   xfconf/trunk/common/xfconf-dbus.xml
   xfconf/trunk/common/xfconf-marshal.list
   xfconf/trunk/xfconf/xfconf-channel.c
   xfconf/trunk/xfconfd/xfconf-daemon.c
Log:
add PropertyRemoved signal to dbus interface and hook it up everywhere


Modified: xfconf/trunk/common/xfconf-dbus.xml
===================================================================
--- xfconf/trunk/common/xfconf-dbus.xml 2008-05-13 03:17:04 UTC (rev 26954)
+++ xfconf/trunk/common/xfconf-dbus.xml 2008-05-13 03:17:16 UTC (rev 26955)
@@ -102,6 +102,7 @@
              
              @channel: A channel/application/namespace name.
              @property: A property name.
+             @value: The new value.
              
              Emitted when a property changes.
         -->
@@ -110,6 +111,20 @@
             <arg name="property" type="s"/>
             <arg name="value" type="v"/>
         </signal>
+
+        <!--
+             void org.xfce.Xfconf.PropertyRemoved(String channel,
+                                                  String property)
+
+             @channel: A channel/application/namespace name.
+             @property: A property name.
+
+             Emitted when a property is removed.
+        -->
+        <signal name="PropertyRemoved">
+            <arg name="channel" type="s"/>
+            <arg name="property" type="s"/>
+        </signal>
     </interface>
     
     <interface name="org.xfce.Xfconf.GUI">

Modified: xfconf/trunk/common/xfconf-marshal.list
===================================================================
--- xfconf/trunk/common/xfconf-marshal.list     2008-05-13 03:17:04 UTC (rev 
26954)
+++ xfconf/trunk/common/xfconf-marshal.list     2008-05-13 03:17:16 UTC (rev 
26955)
@@ -1,2 +1,3 @@
 VOID:STRING,STRING,BOXED
 VOID:STRING,BOXED
+VOID:STRING,STRING

Modified: xfconf/trunk/xfconf/xfconf-channel.c
===================================================================
--- xfconf/trunk/xfconf/xfconf-channel.c        2008-05-13 03:17:04 UTC (rev 
26954)
+++ xfconf/trunk/xfconf/xfconf-channel.c        2008-05-13 03:17:16 UTC (rev 
26955)
@@ -107,7 +107,12 @@
                                             const gchar *property,
                                             const GValue *value,
                                             gpointer user_data);
+static void xfconf_channel_property_removed(DBusGProxy *proxy,
+                                            const gchar *channel_name,
+                                            const gchar *property,
+                                            gpointer user_data);
 
+
 static guint signals[N_SIGS] = { 0, };
 
 
@@ -170,6 +175,9 @@
     dbus_g_proxy_connect_signal(proxy, "PropertyChanged",
                                 G_CALLBACK(xfconf_channel_property_changed),
                                 instance, NULL);
+    dbus_g_proxy_connect_signal(proxy, "PropertyRemoved",
+                                G_CALLBACK(xfconf_channel_property_removed),
+                                instance, NULL);
 }
 
 static void
@@ -230,8 +238,6 @@
                                 const GValue *value,
                                 gpointer user_data)
 {
-    /* FIXME: optimise this by keeping track of all channels in a big hashtable
-     * and using only a single instance of this callback for the class */
     XfconfChannel *channel = XFCONF_CHANNEL(user_data);
 
     if(strcmp(channel_name, channel->channel_name))
@@ -241,8 +247,23 @@
                   g_quark_from_string(property), property, value);
 }
 
+static void
+xfconf_channel_property_removed(DBusGProxy *proxy,
+                                const gchar *channel_name,
+                                const gchar *property,
+                                gpointer user_data)
+{
+    XfconfChannel *channel = XFCONF_CHANNEL(user_data);
+    GValue value = { 0, };
 
+    if(strcmp(channel_name, channel->channel_name))
+        return;
 
+    g_signal_emit(G_OBJECT(channel), signals[SIG_PROPERTY_CHANGED],
+                  g_quark_from_string(property), property, value);
+}
+
+
 static gboolean
 xfconf_channel_get_internal(XfconfChannel *channel,
                             const gchar *property,

Modified: xfconf/trunk/xfconfd/xfconf-daemon.c
===================================================================
--- xfconf/trunk/xfconfd/xfconf-daemon.c        2008-05-13 03:17:04 UTC (rev 
26954)
+++ xfconf/trunk/xfconfd/xfconf-daemon.c        2008-05-13 03:17:16 UTC (rev 
26955)
@@ -84,6 +84,7 @@
 enum
 {
     SIG_PROPERTY_CHANGED = 0,
+    SIG_PROPERTY_REMOVED,
     N_SIGS,
 };
 
@@ -115,7 +116,17 @@
                                                  3, G_TYPE_STRING,
                                                  G_TYPE_STRING,
                                                  G_TYPE_VALUE);
-    
+
+    signals[SIG_PROPERTY_REMOVED] = g_signal_new("property-removed",
+                                                 XFCONF_TYPE_DAEMON,
+                                                 G_SIGNAL_RUN_LAST,
+                                                 0,
+                                                 NULL, NULL,
+                                                 
xfconf_marshal_VOID__STRING_STRING,
+                                                 G_TYPE_NONE,
+                                                 2, G_TYPE_STRING,
+                                                 G_TYPE_STRING);
+
     dbus_g_object_type_install_info(G_TYPE_FROM_CLASS(klass),
                                     &dbus_glib_xfconf_object_info);
     dbus_g_error_domain_register(XFCONF_ERROR, "org.xfce.Xfconf.Error",
@@ -164,11 +175,14 @@
     xfconf_backend_get(pdata->backend, pdata->channel, pdata->property,
                        &value, NULL);
 
-    g_signal_emit(G_OBJECT(pdata->xfconfd), signals[SIG_PROPERTY_CHANGED],
-                  0, pdata->channel, pdata->property, &value);
-
-    if(G_VALUE_TYPE(&value))
+    if(G_VALUE_TYPE(&value)) {
+        g_signal_emit(G_OBJECT(pdata->xfconfd), signals[SIG_PROPERTY_CHANGED],
+                      0, pdata->channel, pdata->property, &value);
         g_value_unset(&value);
+    } else {
+        g_signal_emit(G_OBJECT(pdata->xfconfd), signals[SIG_PROPERTY_REMOVED],
+                      0, pdata->channel, pdata->property);
+    }
 
     g_object_unref(G_OBJECT(pdata->backend));
     g_free(pdata->channel);

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to