! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
After removing property it still is visible in the xml file.
Status:
RESOLVED: FIXED

Comments

Description Nick Schermer editbugs 2009-10-28 16:37:17 CET
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?
Comment 1 Brian J. Tarricone (not reading bugmail) 2009-10-28 17:15:58 CET
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.
Comment 2 Nick Schermer editbugs 2009-10-30 12:19:36 CET
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.
Comment 3 Nick Schermer editbugs 2009-10-30 13:47:52 CET
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
Comment 4 Nick Schermer editbugs 2009-10-30 20:57:54 CET
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?
Comment 5 Nick Schermer editbugs 2010-01-25 11:06:53 CET
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.

Bug #5923

Reported by:
Nick Schermer
Reported on: 2009-10-28
Last modified on: 2010-01-25

People

Assignee:
Brian J. Tarricone (not reading bugmail)
CC List:
0 users

Version

Version:
Unspecified

Attachments

Additional information