diff options
author | Allison Ryan Lortie <desrt@desrt.ca> | 2015-12-16 10:04:13 -0500 |
---|---|---|
committer | Allison Ryan Lortie <desrt@desrt.ca> | 2015-12-16 11:31:01 -0500 |
commit | 4594876cd2b3c80a827cfe1526e0779b72777cc2 (patch) | |
tree | 6212c8e1895940feb0c4030d1fa0e7cdd12acae1 /client/dconf-client.c | |
parent | a4139891fa874197e945fe409698e16a5ba35ae3 (diff) | |
download | dconf-4594876cd2b3c80a827cfe1526e0779b72777cc2.tar.gz |
engine: add DCONF_READ_DEFAULT_VALUE flag
Add a flag that allows checking the default value without constructing a
read_through queue. Make use of this new flag to simplify code in a
couple of places.
https://bugzilla.gnome.org/show_bug.cgi?id=759128
Diffstat (limited to 'client/dconf-client.c')
-rw-r--r-- | client/dconf-client.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/client/dconf-client.c b/client/dconf-client.c index e614256..0742748 100644 --- a/client/dconf-client.c +++ b/client/dconf-client.c @@ -245,34 +245,6 @@ dconf_client_read (DConfClient *client, return dconf_engine_read (client->engine, DCONF_READ_FLAGS_NONE, NULL, key); } -/* This provides a "read through" queue that resets all of the keys. - * This is a good way to get the default value for a key. - * - * We cache the value of this queue in a static instead of generating - * and freeing it each time. - */ -static GQueue * -dconf_client_get_reset_queue (void) -{ - static GQueue *reset_queue; - - if (g_once_init_enter (&reset_queue)) - { - DConfChangeset *reset_all; - GQueue *tmp; - - reset_all = dconf_changeset_new (); - dconf_changeset_set (reset_all, "/", NULL); - dconf_changeset_seal (reset_all); - - tmp = g_queue_new (); - g_queue_push_tail (tmp, reset_all); - g_once_init_leave (&reset_queue, tmp); - } - - return reset_queue; -} - /** * dconf_client_read_default: * @client: a #DConfClient @@ -296,7 +268,7 @@ dconf_client_read_default (DConfClient *client, { g_return_val_if_fail (DCONF_IS_CLIENT (client), NULL); - return dconf_engine_read (client->engine, DCONF_READ_FLAGS_NONE, dconf_client_get_reset_queue (), key); + return dconf_engine_read (client->engine, DCONF_READ_DEFAULT_VALUE, NULL, key); } /** |