[gnome-mines/gnome-3-12] Never pause the game before it has begun
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mines/gnome-3-12] Never pause the game before it has begun
- Date: Tue, 15 Apr 2014 23:40:20 +0000 (UTC)
commit 8b0811f219fe3fa20b4a2ab246bebec55e7ee080
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 26660bc..f9232cb 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -357,7 +357,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]