Author: kelnos
Date: 2008-05-12 00:17:09 +0000 (Mon, 12 May 2008)
New Revision: 26947

Modified:
   xfconf/trunk/xfconfd/xfconf-daemon.c
Log:
don't emit PropertyChanged before returning from a get/set/etc. handler


Modified: xfconf/trunk/xfconfd/xfconf-daemon.c
===================================================================
--- xfconf/trunk/xfconfd/xfconf-daemon.c        2008-05-11 22:06:19 UTC (rev 
26946)
+++ xfconf/trunk/xfconfd/xfconf-daemon.c        2008-05-12 00:17:09 UTC (rev 
26947)
@@ -147,24 +147,52 @@
     G_OBJECT_CLASS(xfconf_daemon_parent_class)->finalize(obj);
 }
 
+typedef struct
+{
+    XfconfDaemon *xfconfd;
+    XfconfBackend *backend;
+    gchar *channel;
+    gchar *property;
+} XfconfPropChangedData;
 
+static gboolean
+xfconf_daemon_emit_property_changed_idled(gpointer data)
+{
+    XfconfPropChangedData *pdata = data;
+    GValue value = { 0, };
 
+    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))
+        g_value_unset(&value);
+
+    g_object_unref(G_OBJECT(pdata->backend));
+    g_free(pdata->channel);
+    g_free(pdata->property);
+    g_object_unref(G_OBJECT(pdata->xfconfd));
+    g_slice_free(XfconfPropChangedData, pdata);
+
+    return FALSE;
+}
+
 static void
 xfconf_daemon_backend_property_changed(XfconfBackend *backend,
                                        const gchar *channel,
                                        const gchar *property,
                                        gpointer user_data)
 {
-    XfconfDaemon *xfconfd = user_data;
-    GValue value = { 0, };
+    XfconfPropChangedData *pdata = g_slice_new0(XfconfPropChangedData);
 
-    xfconf_backend_get(backend, channel, property, &value, NULL);
+    pdata->xfconfd = g_object_ref(G_OBJECT(user_data));
+    pdata->backend = g_object_ref(G_OBJECT(backend));
+    pdata->channel = g_strdup(channel);
+    pdata->property = g_strdup(property);
 
-    g_signal_emit(G_OBJECT(xfconfd), signals[SIG_PROPERTY_CHANGED], 0,
-                  channel, property, &value);
-
-    if(G_VALUE_TYPE(&value))
-        g_value_unset(&value);
+    g_idle_add(xfconf_daemon_emit_property_changed_idled, pdata);
 }
 
 static gboolean

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

Reply via email to