From 4594876cd2b3c80a827cfe1526e0779b72777cc2 Mon Sep 17 00:00:00 2001 From: Allison Ryan Lortie Date: Wed, 16 Dec 2015 10:04:13 -0500 Subject: 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 --- engine/dconf-engine.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'engine') 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. -- cgit v1.2.1