[Xfce4-commits] <xfconf:master> Remove dangling nodes from the tree after a recursive remove.

Nick Schermer noreply at xfce.org
Mon Jan 25 12:04:03 CET 2010


Updating branch refs/heads/master
         to bcf988e8ed2e0d1da7c1eed511715285b8ecaadc (commit)
       from 8db12014fac325eb887822e38df3a02d6de2bea2 (commit)

commit bcf988e8ed2e0d1da7c1eed511715285b8ecaadc
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Jan 25 12:00:24 2010 +0100

    Remove dangling nodes from the tree after a recursive remove.
    
    This should prevent flooding xml files with type="empty" nodes.
    See bug #5923.

 xfconfd/xfconf-backend-perchannel-xml.c |   22 +++++++++++++++++++++-
 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,



More information about the Xfce4-commits mailing list