summaryrefslogtreecommitdiff
path: root/xfconfd
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2010-01-25 12:00:24 +0100
committerNick Schermer <nick@xfce.org>2010-01-25 12:00:24 +0100
commitbcf988e8ed2e0d1da7c1eed511715285b8ecaadc (patch)
treefbe6f8834eb2056433d0081957e295c4d3066d50 /xfconfd
parent8db12014fac325eb887822e38df3a02d6de2bea2 (diff)
downloadxfconf-bcf988e8ed2e0d1da7c1eed511715285b8ecaadc.tar.gz
Remove dangling nodes from the tree after a recursive remove.
This should prevent flooding xml files with type="empty" nodes. See bug #5923.
Diffstat (limited to 'xfconfd')
-rw-r--r--xfconfd/xfconf-backend-perchannel-xml.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/xfconfd/xfconf-backend-perchannel-xml.c b/xfconfd/xfconf-backend-perchannel-xml.c
index d764e58..0e329e4 100644
--- a/xfconfd/xfconf-backend-perchannel-xml.c
+++ b/xfconfd/xfconf-backend-perchannel-xml.c
@@ -563,6 +563,24 @@ nodes_do_prop_reset(GNode *node,
}
static gboolean
+nodes_clean_up (GNode *node,
+ gpointer data)
+{
+ XfconfProperty *prop = node->data;
+
+ /* clean up dangling nodes in tree without system defaults */
+ if(!node->children
+ && !G_VALUE_TYPE (&prop->value)
+ && !G_VALUE_TYPE (&prop->system_value)
+ && !prop->locked) {
+ g_node_unlink(node);
+ xfconf_proptree_destroy(node);
+ }
+
+ return FALSE;
+}
+
+static gboolean
do_reset_channel(XfconfBackend *backend,
const gchar *channel_name,
GNode *properties,
@@ -664,7 +682,9 @@ xfconf_backend_perchannel_xml_reset(XfconfBackend *backend,
g_node_traverse(top, G_POST_ORDER, G_TRAVERSE_ALL, -1,
nodes_do_prop_reset, &pdata);
- /* FIXME: clean up dangling nodes in tree without system defaults */
+ /* clean up dangling nodes in tree without system defaults */
+ g_node_traverse(top, G_POST_ORDER, G_TRAVERSE_ALL, -1,
+ nodes_clean_up, NULL);
} else {
/* remove the entire channel */
return do_reset_channel(backend, channel_name,