I have the following code in the panel to cleanup xfconf properties after a plugin is removed from the panel: g_snprintf (buf, sizeof (buf), "/panels/plugin-%d", unique_id); if (xfconf_channel_has_property (application->xfconf, buf)) xfconf_channel_reset_property (application->xfconf, buf, TRUE); g_assert (!xfconf_channel_has_property (application->xfconf, buf)); And it runs without problems, the assert is not triggered, so from an api point of view the property is removed, but when i look in the xml file, the line still exists (although it contains nothing): <property name="plugin-3" type="empty"/> Is this on purpose? Shouldn't it be removed completely from xml file?
Hmm, that used to work... the only time it should create an 'empty' element is if there are still leaf nodes below the one removed.
I think something is wrong (or i use it incorrectly) with xfconf_channel_has_property. Because if the property is an empty element it seems to return false, even if the node has children. So in my code xfconf_channel_reset_property never called. xfconf_channel_reset_property seems to crash or report and error when a property is not found.
The empty xml entries are still there, when i reset a group with recursing, i still see things like this in my xml: <channel name="xfce4-panel" version="1.0"> <property name="panels" type="uint" value="1"> [...] <property name="panel-1" type="empty"> <property name="position" type="empty"/> <property name="size" type="empty"/> <property name="locked" type="empty"/> <property name="plugin-ids" type="empty"/> </property> [...] </property> </channel> Even after I run xfconf-query -c xfce4-panel -Rr -p /panels/panel-1
So, after a bit of testing and bug fixing in the panel i have the following problems with xfconf: * The empty elements remain in the xml file. * xfconf_channel_reset_property() shows a critical (Couldn't find current cache item based on pending call (libxfconf bug?)), when the property does not exist (interesting note: this does not happen if there is an 'empty' element 'left' in the config). I think it should be silent if there is no property, but that's your decision. * To prevent the critical above i used to add xfconf_channel_has_property() but it turned out this does not work (return false) if you check for for example /panel/panel-1 in the xml above because that property has no value, only children. Do you want separate bugs for the other issues, or are they intentional?
I've fixed the FIXME for cleaning up dangling nodes in rev bcf988e, this properly removes the type="empty" nodes from the xml file. The critical warning has been converted in a debug message to prevent crashes in applications, so that should all be fine now. So doing a recursive reset properly works now, no warnings (also when the property does not exist) and no remaining bits in the xml file.