[Xfce4-commits] [xfce/xfconf] 05/10: Implement write_tree GSettings interface method.
noreply at xfce.org
noreply at xfce.org
Sun Oct 21 12:05:12 CEST 2018
This is an automated email from the git hooks/post-receive script.
a l i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfconf.
commit 6923a97ed7354cc5f0536d2e6f8c09d8c3add2f8
Author: Ali Abdallah <ali at xfce.org>
Date: Sat Jul 14 00:30:58 2018 +0200
Implement write_tree GSettings interface method.
---
gsettings-backend/xfconf-gsettings-backend.c | 57 ++++++++++++++++++++++++----
1 file changed, 50 insertions(+), 7 deletions(-)
diff --git a/gsettings-backend/xfconf-gsettings-backend.c b/gsettings-backend/xfconf-gsettings-backend.c
index 1218c79..ff7d664 100644
--- a/gsettings-backend/xfconf-gsettings-backend.c
+++ b/gsettings-backend/xfconf-gsettings-backend.c
@@ -37,6 +37,8 @@ struct _XfconfGsettingsBackend
GHashTable *changed_prop;
GHashTable *subscribed_prop;
+
+ gint nhandled_tree_node;
};
G_DEFINE_TYPE (XfconfGsettingsBackend, xfconf_gsettings_backend, G_TYPE_SETTINGS_BACKEND);
@@ -142,10 +144,11 @@ xfconf_gsettings_backend_get_writable (GSettingsBackend *backend,
}
static gboolean
-xfconf_gsettings_backend_write (GSettingsBackend *backend,
- const gchar *key,
- GVariant *variant,
- gpointer origin_tag)
+xfconf_gsettings_backend_write_full (GSettingsBackend *backend,
+ const gchar *key,
+ GVariant *variant,
+ gboolean add_sig_changed,
+ gpointer origin_tag)
{
XfconfGsettingsBackend *self;
GValue *value;
@@ -156,10 +159,11 @@ xfconf_gsettings_backend_write (GSettingsBackend *backend,
value = xfconf_gvariant_to_gvalue (variant);
if (value) {
- g_hash_table_replace (self->changed_prop, g_strdup(key), origin_tag);
+ if (add_sig_changed)
+ g_hash_table_replace (self->changed_prop, g_strdup(key), origin_tag);
ret_val = xfconf_channel_set_property (self->channel, key, value);
- if (ret_val == FALSE)
+ if (ret_val == FALSE && add_sig_changed)
g_hash_table_remove (self->changed_prop, key);
g_value_unset (value);
@@ -169,11 +173,48 @@ xfconf_gsettings_backend_write (GSettingsBackend *backend,
}
static gboolean
+xfconf_gsettings_backend_write (GSettingsBackend *backend,
+ const gchar *key,
+ GVariant *variant,
+ gpointer origin_tag)
+{
+ return xfconf_gsettings_backend_write_full (backend, key, variant, TRUE, origin_tag);
+}
+
+static gboolean
+xfconf_gsettings_backend_tree_traverse (const gchar *key,
+ GVariant *variant,
+ XfconfGsettingsBackend *self)
+{
+
+ if (!xfconf_gsettings_backend_write_full ((GSettingsBackend*)self, key, variant, FALSE, NULL))
+ return TRUE;
+
+ self->nhandled_tree_node++;
+
+ return FALSE;
+}
+
+static gboolean
xfconf_gsettings_backend_write_tree (GSettingsBackend *backend,
GTree *tree,
gpointer origin_tag)
{
- return TRUE;
+ XfconfGsettingsBackend *self;
+
+ self = XFCONF_GSETTINGS_BACKEND(backend);
+
+ self->nhandled_tree_node = 0;
+
+ g_tree_foreach (tree, (GTraverseFunc) xfconf_gsettings_backend_tree_traverse, self);
+
+ /* If we manage to handle all Tree nodes, send the changed signal */
+ if (self->nhandled_tree_node == g_tree_nnodes (tree)) {
+ g_settings_backend_changed_tree (backend, tree, origin_tag);
+ return TRUE;
+ }
+
+ return FALSE;
}
static void
@@ -227,6 +268,8 @@ xfconf_gsettings_backend_init (XfconfGsettingsBackend *self)
{
const gchar *prg_name;
+ self->nhandled_tree_node = 0;
+
prg_name = g_get_prgname();
self->channel = xfconf_channel_new (prg_name);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list