GNOME Bugzilla – Bug 724439
Pause app menu entry does not display a toggle
Last modified: 2014-04-01 23:31:42 UTC
Created attachment 269231 [details] How it should look Some environments show an off slider for the Pause button. Others do not, which makes it seem less responsive. Either we should: * Move it to the header bar as an icon when we make that. * Make it change to resume [see https://bugzilla.gnome.org/show_bug.cgi?id=666816 for details] * Force the slider to always appear somehow
Created attachment 269232 [details] how it shouldn't look
(In reply to comment #0) > * Make it change to resume [see > https://bugzilla.gnome.org/show_bug.cgi?id=666816 for details] I gave this a try, but apparently you can only set the app menu once... this is a little frustrating... nonfunctional patch attached, in case you spot something I'm doing wrong (don't think so) (In reply to comment #0) > Created an attachment (id=269231) [details] > * Move it to the header bar as an icon when we make that. It'd really be better to have this in the window; we don't want to use the header bar for game controls unless absolutely necessary.
Created attachment 269234 [details] [review] Rebuild the app menu when the paused state changes This allows us to change the Pause/Resume label as needed. DO NOT PUSH - THIS PATCH DOES NOT WORK!
I haven't been able to figure out why this doesn't work... :/
Created attachment 269305 [details] rhythmbox in 3.10 Maybe it's expected that we can only set the app menu once? I'm not sure.... But I do not think it's expected that GNOME Shell displays the boolean state in 3.8 but not 3.10. GMenuModel guarantees: "While a wide variety of stateful actions is possible, the following is the minimum that is expected to be supported by all users of exported menu information: an action with no parameter type and no state an action with no parameter type and boolean state an action with string parameter type and string state" And I know from Calculator that string parameter type, string state still works fine. It looks like no parameter, boolean state broke between 3.8 and 3.10, unless there's something wrong on the Nibbles end (I don't think so?). But in this bug report, you say you do NOT want to see a toggle box. What exactly is the behavior you are expecting here -- does Unity show a check box next to that menu item when the game is paused? GNOME 3.8 uses toggles, but 3.10 uses checkboxes, if that looks better to you. (Rhythmbox uses GSettingsAction, not GSimpleAction, which is why Rhythmbox's app menu isn't broken.) [1] https://developer.gnome.org/gio/stable/GMenuModel.html
Sorry... I *do* want it to display a Toggle Box or a Checkbox, (I have no big preference which.
Let's make a simple test program to demonstrate the issue, then file a bug against gnome-shell: the shell developers will let us know if it's their fault, ours, or another component's. I'll be happy to do this if you don't want to, but no promises how soon I'll get to it.
FYI we're not alone here: this is broken in the Sudoku Vala port, as well.
Pushing to gnome-shell as it affects multiple apps.
Do you have a simple test application?
Not yet, still working on it... but since it affected multiple apps, I thought it made sense to at least make you aware of it..
(In reply to comment #10) > Do you have a simple test application? Coming right up
Er, in my simple test application, it works. :) Still trying to figure out what Nibbles and Sudoku are doing wrong, but let's ping-pong this back in the meantime.
Created attachment 272343 [details] Test application to demonstrate properly-functioning boolean menu item A mutilated version of Application4 from the GTK+ tutorial, with the on_toggle_toggled() function copied straight from Nibbles. Compile: gcc exampleapp.c `pkg-config --cflags --libs glib-2.0` `pkg-config --cflags --libs gtk+-3.0`
Bleh, the only difference is that Nibbles has a callback connected to the action's change-state signal, but my test app doesn't: "If no handler is connected to this signal then the default behaviour is to call g_simple_action_set_state() to set the state to the requested value. If you connect a signal handler then no default action is taken. If the state should change then you must call g_simple_action_set_state() from the handler." We got unlucky by comparing with Sudoku, since I bet it made the same mistake. (P.S. I still think a toggle item is not really a good long-term way to implement Pause.)
Created attachment 272351 [details] [review] Properly change the state of the pause action We were failing to change the state of the pause action on state change requests, so the Pause item in the app menu was forever set to false. FYI: to push this before 3.12 requires emailing release-team@gnome.org and waiting for two approvals. Should be easy to get for a one-line patch. Or you could just wait until after 3.12 is released to push.
Damn.. sorry about all this.. :/ >(P.S. I still think a toggle item is not really a good long-term way to implement Pause.) Yea... I'm thinking that one of the first things I want to fix properly in 3.13.. Would just having a tookbar pause button be much better? I'm thinking this can wait until 3.12.1.. Oh, also confirming the patch works..
(In reply to comment #17) > Damn.. sorry about all this.. :/ > > >(P.S. I still think a toggle item is not really a good long-term way to > implement Pause.) > Yea... I'm thinking that one of the first things I want to fix properly in > 3.13.. Would just having a tookbar pause button be much better? No, I think we really don't want to add a toolbar. The designers don't want the games to have toolbars any more than menu bars. Toolbars aren't fun! Nibbles has few enough buttons that we can put Pause directly in the window, next to a New Game button. Look at how Tetravex (and several other games) does it in 3.12. I also want to move the scoreboard out of the status bar and into the window, similar to what Iagno does in 3.12, but hopefully nicer-looking than that. > I'm thinking this can wait until 3.12.1.. Agreed.
Attachment 272351 [details] pushed as 5fa8b7a - Properly change the state of the pause action