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 737051 - Pause the game when viewing preferences
Pause the game when viewing preferences
Status: RESOLVED FIXED
Product: gnome-nibbles
Classification: Applications
Component: general
3.13.x
Other Linux
: Normal normal
: ---
Assigned To: Iulian Radu
gnome-nibbles-maint
Depends on:
Blocks:
 
 
Reported: 2014-09-20 22:10 UTC by Michael Catanzaro
Modified: 2015-02-28 01:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Pause game when viewing preferences (1.89 KB, patch)
2015-02-23 15:05 UTC, Iulian Radu
none Details | Review
Pause game when viewing preferences (1.88 KB, patch)
2015-02-23 15:07 UTC, Iulian Radu
none Details | Review
Pause game when viewing preferences (2.00 KB, patch)
2015-02-23 19:13 UTC, Iulian Radu
reviewed Details | Review
Pause game when viewing preferences (2.01 KB, patch)
2015-02-23 19:29 UTC, Iulian Radu
reviewed Details | Review
Pause game when viewing preferences (2.25 KB, patch)
2015-02-24 08:25 UTC, Iulian Radu
none Details | Review
Pause game when viewing preferences or scores (3.37 KB, patch)
2015-02-27 21:49 UTC, Iulian Radu
none Details | Review

Description Michael Catanzaro 2014-09-20 22:10:57 UTC
The game should automatically pause when the preferences dialog is displayed.
Comment 1 Iulian Radu 2015-02-23 15:05:22 UTC
Created attachment 297653 [details] [review]
Pause game when viewing preferences
Comment 2 Iulian Radu 2015-02-23 15:07:50 UTC
Created attachment 297654 [details] [review]
Pause game when viewing preferences
Comment 3 Iulian Radu 2015-02-23 19:13:08 UTC
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.
Comment 4 Michael Catanzaro 2015-02-23 19:21:22 UTC
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 *)
Comment 5 Iulian Radu 2015-02-23 19:29:05 UTC
Created attachment 297709 [details] [review]
Pause game when viewing preferences

Oops
Comment 6 Michael Catanzaro 2015-02-23 21:35:52 UTC
Review of attachment 297709 [details] [review]:

I think this is the same as your previous patch ^^
Comment 7 Iulian Radu 2015-02-24 08:25:21 UTC
Created attachment 297734 [details] [review]
Pause game when viewing preferences

Oops again. This patch should now cover all cases.
Comment 8 Michael Catanzaro 2015-02-24 16:52:20 UTC
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
Comment 9 Iulian Radu 2015-02-27 21:49:00 UTC
Created attachment 298139 [details] [review]
Pause game when viewing preferences or scores

Went with a different approach.
Comment 10 Michael Catanzaro 2015-02-28 01:49:10 UTC
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