After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 598002 - Can't hide gnome-games items under Games menu.
Can't hide gnome-games items under Games menu.
Status: RESOLVED OBSOLETE
Product: gnome-menus
Classification: Core
Component: libgnome-menu
git master
Other Linux
: Normal minor
: ---
Assigned To: gnome-menus dummy account
gnome-menus dummy account
: 621712 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-10-10 14:28 UTC by jmgmun
Modified: 2021-05-25 12:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple-ish test case (3.01 KB, application/x-gzip)
2010-01-14 13:35 UTC, Andy Owen
  Details
Add gmenu_tree_item_get_real_path_list() API (13.90 KB, patch)
2010-01-14 23:52 UTC, Vincent Untz
none Details | Review
Updated test case (2.19 KB, application/x-gzip)
2010-01-15 03:34 UTC, Andy Owen
  Details
Use real_path in alacarte (602 bytes, patch)
2010-01-15 05:12 UTC, Andy Owen
none Details | Review

Description jmgmun 2009-10-10 14:28:47 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.
Comment 1 Andy Owen 2010-01-14 13:34:43 UTC
This seems to be a bug in gnome-menus, not alacarte.
Comment 2 Andy Owen 2010-01-14 13:35:57 UTC
Created attachment 151398 [details]
Simple-ish test case

This is a fairly small program + menu file which demonstrates the bug.
Comment 3 Vincent Untz 2010-01-14 14:42:52 UTC
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).
Comment 4 Andy Owen 2010-01-14 23:28:50 UTC
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).
Comment 5 Vincent Untz 2010-01-14 23:47:47 UTC
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.
Comment 6 Vincent Untz 2010-01-14 23:52:55 UTC
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
Comment 7 Vincent Untz 2010-01-14 23:53:42 UTC
(note that I fixed a few bugs in git while doing this, so you might need those fixes too)
Comment 8 Andy Owen 2010-01-15 03:32:10 UTC
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.
Comment 9 Andy Owen 2010-01-15 03:34:47 UTC
Created attachment 151443 [details]
Updated test case

This is the fixed test case (hopefully no more mentions of cake). It also behaves as expected.
Comment 10 Andy Owen 2010-01-15 05:12:04 UTC
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.
Comment 11 Vincent Untz 2010-01-15 10:17:43 UTC
(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)
Comment 12 Andy Owen 2010-01-17 12:43:24 UTC
(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 :)
Comment 13 Andy Owen 2010-01-18 13:16:06 UTC
> 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.
Comment 14 Vincent Untz 2010-01-18 13:33:19 UTC
(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.
Comment 15 Andy Owen 2010-04-06 11:29:45 UTC
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)
Comment 16 jarlathreidy 2010-05-15 00:30:16 UTC
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.
Comment 17 Vincent Untz 2010-06-22 02:40:00 UTC
*** Bug 621712 has been marked as a duplicate of this bug. ***
Comment 18 Marc Gariepy 2010-12-20 19:04:20 UTC
This bug is still present in ubuntu Maverick.

Is there anything I can do to help making this bug progress ?

Thanks.

Marc
Comment 19 André Klapper 2021-05-25 12:45:56 UTC
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.