diff options
author | Ryan Lortie <desrt@desrt.ca> | 2012-07-10 13:58:03 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2012-07-10 13:58:03 -0400 |
commit | 4860be9319e971da6a21fe9f0e83a86b2581314e (patch) | |
tree | 9fcc99e56072ae39005814f35b5c5babc44f7659 /client | |
parent | 2f86e0288643ec2024bc8f32a5c287b88e82d7ab (diff) | |
download | dconf-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')
-rw-r--r-- | client/dconf-client.c | 26 | ||||
-rw-r--r-- | client/dconf-client.h | 2 |
2 files changed, 26 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); +} diff --git a/client/dconf-client.h b/client/dconf-client.h index d09fdbd..3a606c2 100644 --- a/client/dconf-client.h +++ b/client/dconf-client.h @@ -78,6 +78,8 @@ void dconf_client_unwatch_fast (DConfCl void dconf_client_unwatch_sync (DConfClient *client, const gchar *path); +void dconf_client_sync (DConfClient *client); + G_END_DECLS #endif /* __dconf_client_h__ */ |