[gnome-mines] Never pause the game before it has begun
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mines] Never pause the game before it has begun
- Date: Tue, 15 Apr 2014 23:40:02 +0000 (UTC)
commit ad69a8b1bdc8345d0d04b4deacd2f1b5e7190e69
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Tue Apr 15 18:34:09 2014 -0500
Never pause the game before it has begun
Clicking outside the window incorrectly results in the New Game button
being replaced with the Play button, which both pauses and resumes the
game. Oops.
https://bugzilla.gnome.org/show_bug.cgi?id=728305
src/gnome-mines.vala | 2 +-
src/minefield.vala | 5 +++++
2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 5f77e6e..d00ebe3 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -358,7 +358,7 @@ public class Mines : Gtk.Application
private bool window_focus_out_event_cb (Gdk.EventFocus event)
{
- if (minefield != null)
+ if (minefield != null && minefield.is_clock_started ())
minefield.paused = true;
return false;
diff --git a/src/minefield.vala b/src/minefield.vala
index 505c7aa..edf5396 100644
--- a/src/minefield.vala
+++ b/src/minefield.vala
@@ -146,6 +146,11 @@ public class Minefield
this.height = height;
this.n_mines = n_mines;
}
+
+ public bool is_clock_started ()
+ {
+ return elapsed > 0;
+ }
public bool has_mine (uint x, uint y)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]