[glib/wip/nacho/registry-writable: 2/4] registrybackend: handle readability of the keys
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/nacho/registry-writable: 2/4] registrybackend: handle readability of the keys
- Date: Thu, 4 Feb 2016 06:57:17 +0000 (UTC)
commit 7bc4c66c98602ba64eab06e56344a9caae1a4273
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Feb 2 13:12:22 2016 +0100
registrybackend: handle readability of the keys
If a key is removed or it cannot be read anymore we should
notify the backend about it so it fallbacks to the default
value.
gio/gregistrysettingsbackend.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c
index 1497c97..3f1cf13 100644
--- a/gio/gregistrysettingsbackend.c
+++ b/gio/gregistrysettingsbackend.c
@@ -1198,6 +1198,21 @@ typedef struct
} RegistryEvent;
static void
+mark_item_keys_as_changed (GNode *node,
+ gpointer data)
+{
+ RegistryCacheItem *item = node->data;
+ RegistryEvent *event = data;
+
+ /* Iterate until we find an item that is a value */
+ if (item->value.type == REG_NONE)
+ g_node_children_foreach (node, G_TRAVERSE_ALL,
+ mark_item_keys_as_changed, data);
+ else
+ g_ptr_array_add (event->items, g_strdup (item->name));
+}
+
+static void
registry_cache_remove_deleted (GNode *node,
gpointer data)
{
@@ -1205,7 +1220,10 @@ registry_cache_remove_deleted (GNode *node,
RegistryEvent *event = data;
if (!item->readable)
- registry_cache_destroy_tree (node, event->self->watch);
+ {
+ mark_item_keys_as_changed (node, data);
+ registry_cache_destroy_tree (node, event->self->watch);
+ }
}
/* Update cache from registry, and optionally report on the changes.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]