[gnome-games] Gnomine: the timer is not stopped at the end
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] Gnomine: the timer is not stopped at the end
- Date: Mon, 27 Aug 2012 21:33:06 +0000 (UTC)
commit 42bba7dbd66902875dde5ea5514051bc4111af8c
Author: Matthieu Baerts <matttbe gmail com>
Date: Mon Aug 27 12:03:01 2012 +0200
Gnomine: the timer is not stopped at the end
The new timer is not stopped at the end of the game.
If we click on 'New Game' when we are playing, the timer continue
and there is this warning if we accept to quit the game:
GLib-CRITICAL **: g_timer_continue: assertion `timer->active == FALSE' failed
In this situation, I guess it's maybe better to pause the game by using
'toggle_pause_cb ()'
https://bugzilla.gnome.org/show_bug.cgi?id=682778
gnomine/src/gnomine.vala | 4 ++++
gnomine/src/minefield.vala | 1 +
2 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gnomine/src/gnomine.vala b/gnomine/src/gnomine.vala
index 4846a64..556bfa5 100644
--- a/gnomine/src/gnomine.vala
+++ b/gnomine/src/gnomine.vala
@@ -502,6 +502,7 @@ public class GnoMine : Gtk.Application
{
if (minefield != null && minefield.n_cleared > 0 && !minefield.exploded && !minefield.is_complete)
{
+ toggle_pause_cb ();
var dialog = new Gtk.MessageDialog (window, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE, "%s", _("Do you want to start a new game?"));
dialog.secondary_text = (_("If you start a new game, your current progress will be lost."));
dialog.add_buttons (_("Keep Current Game"), Gtk.ResponseType.DELETE_EVENT,
@@ -510,7 +511,10 @@ public class GnoMine : Gtk.Application
var result = dialog.run ();
dialog.destroy ();
if (result != Gtk.ResponseType.ACCEPT)
+ {
+ toggle_pause_cb ();
return false;
+ }
}
return true;
}
diff --git a/gnomine/src/minefield.vala b/gnomine/src/minefield.vala
index b2573d9..6356974 100644
--- a/gnomine/src/minefield.vala
+++ b/gnomine/src/minefield.vala
@@ -183,6 +183,7 @@ public class Minefield
/* Mark unmarked mines when won */
if (is_complete)
{
+ stop_clock ();
for (var tx = 0; tx < width; tx++)
for (var ty = 0; ty < height; ty++)
if (has_mine (tx, ty))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]