summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorAllison Ryan Lortie <desrt@desrt.ca>2015-12-16 10:04:13 -0500
committerAllison Ryan Lortie <desrt@desrt.ca>2015-12-16 11:31:01 -0500
commit4594876cd2b3c80a827cfe1526e0779b72777cc2 (patch)
tree6212c8e1895940feb0c4030d1fa0e7cdd12acae1 /engine
parenta4139891fa874197e945fe409698e16a5ba35ae3 (diff)
downloaddconf-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 'engine')
-rw-r--r--engine/dconf-engine.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
index ebd8ede..7a621c2 100644
--- a/engine/dconf-engine.c
+++ b/engine/dconf-engine.c
@@ -484,6 +484,12 @@ dconf_engine_read (DConfEngine *engine,
* visible (because of a lock). This includes any pending value
* that is in the read_through or pending queues.
*
+ * If DCONF_READ_DEFAULT_VALUE is given then we skip the writable
+ * database and the queues (including read_through, which is
+ * meaningless in this case) and skip directly to the non-writable
+ * databases. This is defined as the value that the user would see
+ * if they were to have just done a reset for that key.
+ *
* With respect to read_through and queued changed:
*
* We only consider read_through and queued changes in the event
@@ -575,8 +581,16 @@ dconf_engine_read (DConfEngine *engine,
{
gboolean found_key = FALSE;
+ /* If the user has requested the default value only, then ensure
+ * that we "find" a NULL value here. This is equivalent to the
+ * user having reset the key, which is the definition of this
+ * flag.
+ */
+ if (flags & DCONF_READ_DEFAULT_VALUE)
+ found_key = TRUE;
+
/* Step 2. Check read_through. */
- if (read_through)
+ if (!found_key && read_through)
found_key = dconf_engine_find_key_in_queue (read_through, key, &value);
/* Step 3. Check queued changes if we didn't find it in read_through.