GNOME Bugzilla – Bug 598002
Can't hide gnome-games items under Games menu.
Last modified: 2021-05-25 12:45:56 UTC
- Run alacarte main menu editor - Select Games menu - Uncheck all Games menu items - Close alacarte Expected: - Games menu is removed from Applications menu Actual: - Games menu is still visible with gnome-games items listed. "Logic" sub-menu is removed correctly. This is on Ubuntu 9.10 Beta.
This seems to be a bug in gnome-menus, not alacarte.
Created attachment 151398 [details] Simple-ish test case This is a fairly small program + menu file which demonstrates the bug.
Your test is broken: you exclude something from "Games and cake"/Cards, while the entry is in Games/Cards. My guess is that the issue is caused by menu inlining. Can you add "<DefaultLayout inline="false" />" to you ~/.config/menus/applications.menu and see if this still happens? In more details: if items are inlined, then alacarte puts <Excluded> tags in the parent menu instead of the submenu that is getting inlined. If alacarte was putting it in the right place, it would just work. Except that I'm unsure it can put it in the right place because it doesn't about it. (An alternative would be to process Excluded again after items are inlined, but I'm not sure it's the right thing to do: if the submenu stops getting inlined, then the items will magically appear again).
Gah, that's what I get for simplifying stuff late at night :) I've got a day off today, so I'm planning on poking around here to fix the actual bug. (and yes, I believe the bug is to do with the menu inlining, in the less simplified form that I started from, removing the inlining section from the menu file made the problem go away).
I have a patch ready for gnome-menus, you'll need it. But then we need to modify alacarte too to use it. Let me attach what I have for gnome-menus.
Created attachment 151437 [details] [review] Add gmenu_tree_item_get_real_path_list() API The patch adds an API to gnome-menu to get the real path to an item (this item included). You can use it from python with "item.real_path". Now alacarte would need to be changed. A quick look makes me think that it's all in MenuEditor.py, and those methods need to use the new API: setVisible deleteMenu deleteSeparator
(note that I fixed a few bugs in git while doing this, so you might need those fixes too)
Ok, so thinking about it some more, maybe it should be an alacarte bug, and its exclusion should look like this: <Menu> <Name>Games</Name> <Menu> <Name>Cards</Name> <Exclude> <Filename>sol.desktop</Filename> </Exclude> </Menu> </Menu> Rather than like this: <Menu> <Name>Games</Name> <Exclude> <Filename>sol.desktop</Filename> </Exclude> </Menu> The fact that the layout of the menu makes the entry go into the parent menu probably shouldn't change the semantics of the Exclude tags, otherwise if enough card games were installed to force this menu to un-inline the menu, then suddenly it will become un-hidden. I'm going to go down that path for a bit and see if it actually makes sense.
Created attachment 151443 [details] Updated test case This is the fixed test case (hopefully no more mentions of cake). It also behaves as expected.
Created attachment 151446 [details] [review] Use real_path in alacarte This is a patch for alacarte which changes the __getPath() function to always use real_path. This touches more functions than you suggested, but I think it is correct (since this function is always used to get a path in the xml tree, so we should use the real_path in all these spots). However, it appears that the gmenu_tree_item_get_real_path_list() api in gnome-menus doesn't work properly, so this still doesn't fix the problem.
(In reply to comment #10) > However, it appears that the gmenu_tree_item_get_real_path_list() api in > gnome-menus doesn't work properly, so this still doesn't fix the problem. Can you elaborate? (a quick look at the patch makes me think it's not enough: some alacarte code calls __getPath() on a node that is obtained with get_parent(), and so it's already too late)
(In reply to comment #11) > (In reply to comment #10) > > However, it appears that the gmenu_tree_item_get_real_path_list() api in > > gnome-menus doesn't work properly, so this still doesn't fix the problem. > > Can you elaborate? Sorry, I'm guessing it won't end up being a bug in that function. At the moment, I'm calling ".real_path" on the entry representing AisleRiot Solitaire for my computer, which should be in the "Cards" directory and just getting "Applications/Games" as the real_path. Some other items work fine (e.g. Xmoto, gives me "Applications/Games/Sports"). My understanding is that starting from an Entry object, I should always be able to get the real_path correctly, regardless of which parent directory gave me the object, hence I figured that something was broken at the C level. I'm going to keep on poking around with it though, and hopefully get either a simple test case or a patch. > > (a quick look at the patch makes me think it's not enough: some alacarte code > calls __getPath() on a node that is obtained with get_parent(), and so it's > already too late) Thanks. I figured I'd get the visibility bit working first, and then go around and unbreak all the bits I'd broken :)
> Sorry, I'm guessing it won't end up being a bug in that function. At the > moment, I'm calling ".real_path" on the entry representing AisleRiot Solitaire > for my computer, which should be in the "Cards" directory and just getting > "Applications/Games" as the real_path. Some other items work fine (e.g. Xmoto, > gives me "Applications/Games/Sports"). > So, it seems it was just that I had a broken set of .menu and .desktop files. Cleaning that up has fixed everything. In the process of testing everything to see what I've broken, I seem to have uncovered a few other bugs in unrelated bits of code. The plan from here for me is to: 1) Fix this patch so it doesn't break anything that isn't already broken. 2) Make some test cases which show the other bits which seem broken For your interest, the other bugs that exist are thing like: - Hiding too many items in Games/Arcade, so that the menu should be inlined causes the submenu to be hidden. - Creating menus, then reverting creates menus called alacarte-made-n which can't be deleted through alacarte - Moving menus into inlined submenus eats the top level of the menu being moved I'll give better details on reproducing these though.
(In reply to comment #13) > 1) Fix this patch so it doesn't break anything that isn't already broken. > 2) Make some test cases which show the other bits which seem broken Cool, thanks! > For your interest, the other bugs that exist are thing like: > - Hiding too many items in Games/Arcade, so that the menu should be inlined > causes the submenu to be hidden. Looks like a bug in gnome-menus; it might be hard to debug if you're not used to gnome-menus. But a simple test case might help me. > - Creating menus, then reverting creates menus called alacarte-made-n which > can't be deleted through alacarte That's a bug in a alacarte. > - Moving menus into inlined submenus eats the top level of the menu being moved Yeah, that's one hard part :-) Bug in alacarte, that might require some fixing in gnome-menus.
Sorry about disappearing. I recently lost internet connection at home, which led to a significant reduction in productivity. From what I can tell, this issue is now fixed (running the latest ubuntu lucid prerelease, and checking the ubuntu diffs for alacarte and gnome-menu to ensure they don't do anything tricky)
I'm using Ubuntu Lucid and this is still an issue for me. I have Chess, World of Goo, RiLi and Xmoto. If I uncheck any or all of them, they still appear in the games menu.
*** Bug 621712 has been marked as a duplicate of this bug. ***
This bug is still present in ubuntu Maverick. Is there anything I can do to help making this bug progress ? Thanks. Marc
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new enhancement request ticket at https://gitlab.gnome.org/GNOME/gnome-menus/-/issues/ Thank you for your understanding and your help.