GNOME Bugzilla – Bug 666816
Last modified: 2014-02-15 21:07:06 UTC
Created attachment 265816 [details] [review]
initial try at gtkapplication switch
It breaks screen resizing/fullscreening/quiting but I think those need to be redone anyway to finish this.
If anyone else wants to hack on this before UI freeze, let me know and I'll commit it to master.. I think we should be able to have it working at least as before by the freeze date.
FYI: this is near the top of my to-do list. We'll probably need to create a NibblesApplication GObject that inherits from GtkApplication. At least, I've never seen anyone create a plain GtkApplication before, so I don't know if that will work.
It'd probably be better to keep this in Bugzilla until it's ready.
Created attachment 266328 [details]
current patch to switch to gtk application
Making good progress..
I'm ignoring the lack or resizing by the clutter object right now
Pause works, but unpause doesn't
Fullscreen doesn't currently work, but AppMenu plumbing is up (and it worked via F11 before I tried to make a menu item)
Sensitivity needs to be re-added so you can't launch preferences when running a game, etc.
I'm thinking about committing as soon as I fix 2/4 of the above so that work on GtkHeaderBar can proceed easier.. I'm guessing we don't want to release it with no menu and no HeaderBar?
I'd prefer if we not break anything when we land this!
I do want to add an application menu for 3.12, and we need GtkApplication for that, but it's the difference between being two years late and two and a half years late: not a huge deal. Breaking resizing or unpause would be a huge deal. :) (A headerbar would be a nice bonus, but one thing at a time: GtkApplication needs to come first so that we can remove the menu bar.)
I do not care about fullscreen, though: like the other games, Nibbles looks terrible in fullscreen, and I'd prefer we remove features that make the game look terrible. I've removed fullscreen from half the other games already. Of course, whether we do that for Nibbles is up to you.
Committed in: https://git.gnome.org/browse/gnome-nibbles/commit/?id=f54f2b22fb5ad43838a6dafdcc1f993d23ebdac2
GtkApplication Port w/ AppMenu
The Pause button now causes the game to pause
Fullscreen has been removed
Removing mouse pointer on the clutter instance was also removed
Pause works fully as does resize (or as well as it did on GtkAspectFrame, but may revert to GamesGridFrames ~ unrelated to this bug)
AppMenu items don't show sensitivity to the situation, yet.. this is the only user facing open issue.
A couple thoughts:
* We need to rename Pause to Resume if the game is currently paused. Unfortunately I don't think this is possible with a menu built with GtkBuilder. :S  shows how to handle this.
* You left a couple TODO lines in main()
> AppMenu items don't show sensitivity to the situation, yet.. this is the only
> user facing open issue.
You can use g_action_map_lookup_action() to access the GAction, cast it to a GSimpleAction (any action added with GActionEntry is a GSimpleAction), and then use g_simple_action_set_enabled().  is a Vala example; not sure how much that will help you.
>* We need to rename Pause to Resume if the game is currently paused.
I was going to ask if you didn't like having it be a switch on/off.. but could that really be dependent on themes? I just tried on another machine and it doesn't show up at all :/
>>> AppMenu items don't show sensitivity to the situation, yet..
Thanks for the suggestion, it did help fixed in https://git.gnome.org/browse/gnome-nibbles/commit/?id=260dd25dfcac0b84e36b574abf3bb2879fe0cfbc
>* You left a couple TODO lines in main()
The other TODOs were fixed.
(In reply to comment #7)
> I was going to ask if you didn't like having it be a switch on/off.. but could
> that really be dependent on themes? I just tried on another machine and it
> doesn't show up at all :/
Could you post screenshots of what you're seeing? Sometimes the app menu behaves a bit differently from other menus.... I don't see anything wrong with your code, but I've never tried to do this before, either.
Long-term, we actually don't want Pause/Resume in the app menu at all: ideally there would be a single button for Pause, Resume, and New Game inside the window itself. (See e.g. the latest versions of Mines or Quadrapassel.) It would go on the bottom-right, underneath the scoreboard, which would be removed from the status bar. (This is just my brainstorming how to make Nibbles match the other newly-redesigned games: there's plenty of other ways we could do this.) But if you don't have time to redesign everything again in the next two weeks before freeze :) then it'd be simplest to just build the menu like I did in Mines.
Created attachment 267856 [details]
There's a few different possibilities for where the app menu might be shown:
1) Shell shows app menu
--- GNOME: the screenshot above, no toggle button here :(
--- Unity, OS X: the leftmost menu on the global menu bar (for Nibbles, the only menu)
2) Window shows app menu (Windows, MATE, Cinnamon, KDE, Xfce, etc.)
--- Apps with header bars: leftmost item in the header bar. (Thanks to your work removing the menu bar, Nibbles is now ready for a header bar.)
--- Apps without header bars: again the leftmost menu in the menu bar. The menu bar will be shown only for this menu, and it will be ugly.
--- We could also manually override this (but we don't want to)
Created attachment 267913 [details]
My AppMenu on Gnome Shell
Created attachment 267914 [details]
AppMenu on Unity
Attached what shows up in the AppMenu on Unity/Gnome Shell.
We might be looking at a regression in GNOME Shell. Between 3.8 (is that the version you're using?) and 3.10 the toggle buttons in other app menus (Rhythmbox, Packages) changed to check marks, but both of those app menus are using GSettingsAction rather than GSimpleAction so we're not quite in the same situation....
Anyway, that's really worth creating a separate bug: Nibbles now does use GtkApplication, so this one is fixed IMO.
Opened a new bug here to track the Pause issue: https://bugzilla.gnome.org/show_bug.cgi?id=724439
Closing this one