[gnome-chess] Add a warning dialog when using Resign
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess] Add a warning dialog when using Resign
- Date: Tue, 8 Apr 2014 01:13:13 +0000 (UTC)
commit 45cf7b0bf55d479efeea2d8f4cd2e3ddf10e342b
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Apr 7 20:11:29 2014 -0500
Add a warning dialog when using Resign
https://bugzilla.gnome.org/show_bug.cgi?id=727788
src/gnome-chess.vala | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index dd0e515..e4f3992 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -1322,10 +1322,36 @@ public class Application : Gtk.Application
public void resign_cb ()
{
- if (human_player != null)
- human_player.resign ();
+ /* Manually since we don't want to show the pause overlay */
+ if (game.clock != null)
+ game.clock.pause ();
+
+ var dialog = new Gtk.MessageDialog (window,
+ Gtk.DialogFlags.MODAL,
+ Gtk.MessageType.QUESTION,
+ Gtk.ButtonsType.NONE,
+ _("Are you sure you want to resign?"));
+ dialog.format_secondary_text (
+ _("This makes sense if you plan to save the game as a record of your loss."));
+ dialog.add_buttons (_("_Keep Playing"), Gtk.ResponseType.REJECT,
+ _("_Resign"), Gtk.ResponseType.ACCEPT,
+ null);
+
+ var response = dialog.run ();
+ dialog.destroy ();
+
+ if (response == Gtk.ResponseType.ACCEPT)
+ {
+ if (human_player != null)
+ human_player.resign ();
+ else
+ game.current_player.resign ();
+ }
else
- game.current_player.resign ();
+ {
+ if (game.clock != null)
+ game.clock.unpause ();
+ }
}
public void claim_draw_cb ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]