When I set an <Exclude> in my ~/.config/menus/applications.menu file they get removed from GNOME's menu layout (like I'm pretty sure they should be). But PyXDG places them in the "Other" category. I believe this has to do with __genmenuOnlyAllocated() running on the full merged menu file while it should run on the merged file first then again on the rest of the user's menu file. Here is my applications.menu, in case it helps: <!DOCTYPE Menu PUBLIC '-//freedesktop//DTD Menu 1.0//EN' 'http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd'> <Menu> <Name>Applications</Name> <MergeFile>/etc/xdg/menus/applications.menu</MergeFile> <Menu> <Name>Internet</Name> <Exclude> <Filename>gnome-btdownload.desktop</Filename> </Exclude> </Menu> </Menu> The gnome-btdownload entry ends up in "Other" using PyXDG and is removed as it should be in the GNOME menus.
Created attachment 2179 [details] [review] small patch
(In reply to comment #1) > Created an attachment (id=2179) [edit] > small patch > This patch makes <Exclude>ed entries that were included earlier stay allocated as the spec says.
Created attachment 2180 [details] [review] small patch If a previous <Include> pattern matched the menu entry, then it sets entry.Add to True. So the correct behavior for <Exclude>, if it finds entry.Add to be True, is to set it to False but to remember that it was allocated along the way.
Created attachment 2181 [details] [review] Corrected patch. A menu entry that is matched by an <Exclude> rule, and was previously matched by an <Include> rule for the same menu, should not be added but should be put into Allocated state immediately so that <Unallocated> won't match it.
Created attachment 2182 [details] [review] actually works bitten by tabs vs spaces in one of those, this one solves that issue
"Actually works" patch is backwards and has irrelevant whitespace changes. I recommend "Corrected patch." :)
already fixed in cvs
and released as pyxdg-0.9
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.