summaryrefslogtreecommitdiff
path: root/gio/gsettings-tool.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2010-05-16 13:03:34 +0200
committerRyan Lortie <desrt@desrt.ca>2010-05-17 07:16:37 -0400
commit849684e540bb714bc60c2bce3a086e5ffb8933c0 (patch)
tree527ff1fe63ee035ecca4ec2174172e57f8b93c50 /gio/gsettings-tool.c
parent8e060adb2cecb7a801d54e3cbdb0c6eb12f56c12 (diff)
GSettings tool: work-around GDBus issue
There is currently no way (near as I can tell) to ensure that a message has been sent when using GDBus. If we exit() before we are sure, then it is very possible that the message isn't sent at all. This behaviour was observed when using the GSettings commandline tool with dconf. A quick and dirty workaround for now.
Diffstat (limited to 'gio/gsettings-tool.c')
-rw-r--r--gio/gsettings-tool.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gio/gsettings-tool.c b/gio/gsettings-tool.c
index 257c9656c..fdaacdc60 100644
--- a/gio/gsettings-tool.c
+++ b/gio/gsettings-tool.c
@@ -215,6 +215,24 @@ handle_set (gint *argc,
ret = 0;
+ /* XXX: workaround for now
+ *
+ * if we exit() so quickly, GDBus may not have had a chance to
+ * actually send the message (since we're using it async).
+ *
+ * GDBusConnection has no API to sync or wait for messages to be sent,
+ * so we send a meaningless message and wait for the reply to ensure
+ * that all messages that came before must have been sent.
+ */
+ {
+ GDBusConnection *session;
+
+ session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ g_dbus_connection_call_sync (session, "org.gtk.DoesNotExist", "/",
+ "org.gtk.DoesNotExist", "Workaround",
+ g_variant_new ("()"), 0, -1, NULL, NULL);
+ }
+
out:
g_option_context_free (context);