[gnome-builder] egg-settings-sandwich: update keys when layer is added



commit aad2191e8804f8c122abae538c163dbda667b070
Author: Christian Hergert <christian hergert me>
Date:   Sat May 9 18:37:49 2015 -0700

    egg-settings-sandwich: update keys when layer is added
    
    We need to recache all of the setting keys when a new layer is added as
    it could have values modified which were not in the previous layers.

 contrib/egg/egg-settings-sandwich.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/contrib/egg/egg-settings-sandwich.c b/contrib/egg/egg-settings-sandwich.c
index b316aa6..a1aba9c 100644
--- a/contrib/egg/egg-settings-sandwich.c
+++ b/contrib/egg/egg-settings-sandwich.c
@@ -61,8 +61,8 @@ egg_settings_sandwich_get_primary_settings (EggSettingsSandwich *self)
 }
 
 static void
-egg_settings_sandwich_update_cache (EggSettingsSandwich *self,
-                                    const gchar         *key)
+egg_settings_sandwich_cache_key (EggSettingsSandwich *self,
+                                 const gchar         *key)
 {
   GSettings *settings;
   GVariant *value;
@@ -90,6 +90,20 @@ egg_settings_sandwich_update_cache (EggSettingsSandwich *self,
 }
 
 static void
+egg_settings_sandwich_update_cache (EggSettingsSandwich *self)
+{
+  gchar **keys;
+  gsize i;
+
+  g_assert (EGG_IS_SETTINGS_SANDWICH (self));
+
+  keys = g_settings_list_keys (self->memory_settings);
+  for (i = 0; keys [i]; i++)
+    egg_settings_sandwich_cache_key (self, keys [i]);
+  g_strfreev (keys);
+}
+
+static void
 egg_settings_sandwich__settings_changed (EggSettingsSandwich *self,
                                          const gchar         *key,
                                          GSettings           *settings)
@@ -98,7 +112,7 @@ egg_settings_sandwich__settings_changed (EggSettingsSandwich *self,
   g_assert (key != NULL);
   g_assert (G_IS_SETTINGS (settings));
 
-  egg_settings_sandwich_update_cache (self, key);
+  egg_settings_sandwich_cache_key (self, key);
 }
 
 static void
@@ -373,6 +387,8 @@ egg_settings_sandwich_append (EggSettingsSandwich *self,
                            G_CALLBACK (egg_settings_sandwich__settings_changed),
                            self,
                            G_CONNECT_SWAPPED);
+
+  egg_settings_sandwich_update_cache (self);
 }
 
 void


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