GNOME Bugzilla – Bug 737051
Pause the game when viewing preferences
Last modified: 2015-02-28 01:49:10 UTC
The game should automatically pause when the preferences dialog is displayed.
Created attachment 297653 [details] [review] Pause game when viewing preferences
Created attachment 297654 [details] [review] Pause game when viewing preferences
Created attachment 297703 [details] [review] Pause game when viewing preferences Fix crash occurring when user tries to open the preferences dialog before starting a new game.
Review of attachment 297703 [details] [review]: Ah, but now if I pause the game before opening the preferences dialog, it will unpause when I open it and pause when I close it! So you'll need to check the current state before toggling it. ::: src/main.c @@ +185,3 @@ gpointer user_data) { + if (g_action_get_enabled ((GAction*) pause_action)) The normal style in GNOME code is to leave a space between the type and the pointer, like this: (GAction *)
Created attachment 297709 [details] [review] Pause game when viewing preferences Oops
Review of attachment 297709 [details] [review]: I think this is the same as your previous patch ^^
Created attachment 297734 [details] [review] Pause game when viewing preferences Oops again. This patch should now cover all cases.
Review of attachment 297734 [details] [review]: OK, this is definitely better, but I'd prefer that if the game is paused before the preferences dialog is opened, closing the preferences dialog should not unpause the game. It would also be nice to disable the pause action while the preferences dialog is open. ::: src/main.c @@ +187,3 @@ + GVariant *state; + + state = g_action_get_state (G_ACTION (pause_action)); This is annotated with (transfer-full) [1] so you have to free the result with g_variant_unref(). [1] https://developer.gnome.org/gio/stable/GAction.html#g-action-get-state ::: src/preferences.c @@ +49,3 @@ + GVariant *state; + + state = g_action_get_state (G_ACTION (pause_action)); Same here
Created attachment 298139 [details] [review] Pause game when viewing preferences or scores Went with a different approach.
OK, this works well. The dummy_id looks racy but that a preexisting issue. Attachment 298139 [details] pushed as 35e8c48 - Pause game when viewing preferences or scores