summaryrefslogtreecommitdiff
path: root/client/dconf-client.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-07-10 13:58:03 -0400
committerRyan Lortie <desrt@desrt.ca>2012-07-10 13:58:03 -0400
commit4860be9319e971da6a21fe9f0e83a86b2581314e (patch)
tree9fcc99e56072ae39005814f35b5c5babc44f7659 /client/dconf-client.c
parent2f86e0288643ec2024bc8f32a5c287b88e82d7ab (diff)
downloaddconf-4860be9319e971da6a21fe9f0e83a86b2581314e.tar.gz
Reimplement sync() functionality
Add dconf_engine_sync() that does the same thing as the code in the GSettings backend used to do, in a cleaner way. Update the GSettings backend to use the new call. Add a new call to DConfClient wrapping the engine call as well.
Diffstat (limited to 'client/dconf-client.c')
-rw-r--r--client/dconf-client.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/client/dconf-client.c b/client/dconf-client.c
index fad445c..7a2a96c 100644
--- a/client/dconf-client.c
+++ b/client/dconf-client.c
@@ -305,7 +305,9 @@ dconf_client_is_writable (DConfClient *client,
*
* This call merely queues up the write and returns immediately, without
* blocking. The only errors that can be detected or reported at this
- * point are attempts to write to read-only keys.
+ * point are attempts to write to read-only keys. If the application
+ * exits immediately after this function returns then the queued call
+ * may never be sent; see dconf_client_sync().
*
* A local copy of the written value is kept so that calls to
* dconf_client_read() that occur before the service actually makes the
@@ -393,7 +395,9 @@ dconf_client_write_sync (DConfClient *client,
*
* This call merely queues up the write and returns immediately, without
* blocking. The only errors that can be detected or reported at this
- * point are attempts to write to read-only keys.
+ * point are attempts to write to read-only keys. If the application
+ * exits immediately after this function returns then the queued call
+ * may never be sent; see dconf_client_sync().
*
* A local copy of the written value is kept so that calls to
* dconf_client_read() that occur before the service actually makes the
@@ -546,3 +550,21 @@ dconf_client_unwatch_sync (DConfClient *client,
dconf_engine_unwatch_sync (client->engine, path);
}
+
+/**
+ * dconf_client_sync:
+ * @client: a #DConfClient
+ *
+ * Blocks until all outstanding "fast" change or write operations have
+ * been submitted to the service.
+ *
+ * Applications should generally call this before exiting on any
+ * #DConfClient that they wrote to.
+ **/
+void
+dconf_client_sync (DConfClient *client)
+{
+ g_return_if_fail (DCONF_IS_CLIENT (client));
+
+ dconf_engine_sync (client->engine);
+}