[dconf/dconf-0.14] gsettings/: support correct read of default values



commit 3f6a05f49539b2c751e14466078822b0c72daee4
Author: Ryan Lortie <desrt desrt ca>
Date:   Tue Oct 2 13:29:16 2012 -0400

    gsettings/: support correct read of default values
    
    The existing code had a /* XXX */ for properly dealing with the case of
    the user requesting the default value.  We should probably implement
    this...
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685316

 gsettings/dconfsettingsbackend.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gsettings/dconfsettingsbackend.c b/gsettings/dconfsettingsbackend.c
index 1725d16..c8273f9 100644
--- a/gsettings/dconfsettingsbackend.c
+++ b/gsettings/dconfsettingsbackend.c
@@ -44,10 +44,23 @@ dconf_settings_backend_read (GSettingsBackend   *backend,
                              gboolean            default_value)
 {
   DConfSettingsBackend *dcsb = (DConfSettingsBackend *) backend;
+  GVariant *value;
 
-  /* XXX default value */
+  if (default_value)
+    {
+      GQueue *read_through;
+
+      /* Mark the key as having been reset when trying to do the read... */
+      read_through = g_queue_new ();
+      g_queue_push_tail (read_through, dconf_changeset_new_write (key, NULL));
+      value = dconf_engine_read (dcsb->engine, read_through, key);
+      g_queue_free_full (read_through, (GDestroyNotify) dconf_changeset_unref);
+    }
+
+  else
+    value = dconf_engine_read (dcsb->engine, NULL, key);
 
-  return dconf_engine_read (dcsb->engine, NULL, key);
+  return value;
 }
 
 static gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]