[gnome-chess] Remove the Claim Draw menu item



commit dfb23c124eb9c6c6e5f724e6a8dc97cb0994f793
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Apr 7 18:42:05 2014 -0500

    Remove the Claim Draw menu item
    
    Instead, we should prompt the player when he has the option of claiming
    a draw. This will come in the next commit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727345

 data/menu.ui         |    4 ----
 src/gnome-chess.vala |   48 ------------------------------------------------
 2 files changed, 0 insertions(+), 52 deletions(-)
---
diff --git a/data/menu.ui b/data/menu.ui
index cf1ec74..66a8659 100644
--- a/data/menu.ui
+++ b/data/menu.ui
@@ -34,10 +34,6 @@
     </section>
     <section>
       <item>
-        <attribute name="label" translatable="yes">Claim Draw</attribute>
-        <attribute name="action">win.claim-draw</attribute>
-      </item>
-      <item>
         <attribute name="label" translatable="yes">Resign</attribute>
         <attribute name="action">win.resign</attribute>
       </item>
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index e4f3992..e7ae075 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -69,7 +69,6 @@ public class Application : Gtk.Application
     private const string SAVE_GAME_ACTION_NAME = "save";
     private const string SAVE_GAME_AS_ACTION_NAME = "save-as";
     private const string UNDO_MOVE_ACTION_NAME = "undo";
-    private const string CLAIM_DRAW_ACTION_NAME = "claim-draw";
     private const string RESIGN_ACTION_NAME = "resign";
     private const string PAUSE_RESUME_ACTION_NAME = "pause-resume";
 
@@ -80,7 +79,6 @@ public class Application : Gtk.Application
         { SAVE_GAME_ACTION_NAME, save_game_cb },
         { SAVE_GAME_AS_ACTION_NAME, save_game_as_cb },
         { UNDO_MOVE_ACTION_NAME, undo_move_cb },
-        { CLAIM_DRAW_ACTION_NAME, claim_draw_cb },
         { RESIGN_ACTION_NAME, resign_cb },
         { PAUSE_RESUME_ACTION_NAME, pause_resume_cb },
     };
@@ -1025,12 +1023,6 @@ public class Application : Gtk.Application
         else
             disable_window_action (RESIGN_ACTION_NAME);
 
-        /* Claim draw only allowed on your own turn */
-        if (can_resign && game.current_player != opponent)
-            enable_window_action (CLAIM_DRAW_ACTION_NAME);
-        else
-            disable_window_action (CLAIM_DRAW_ACTION_NAME);
-
         /* Can undo once the human player has made a move */
         var can_undo = game.n_moves > 0 && !game.is_paused;
         if (opponent != null && opponent.color == Color.WHITE)
@@ -1113,7 +1105,6 @@ public class Application : Gtk.Application
     {
         disable_window_action (RESIGN_ACTION_NAME);
         disable_window_action (UNDO_MOVE_ACTION_NAME);
-        disable_window_action (CLAIM_DRAW_ACTION_NAME);
         disable_window_action (PAUSE_RESUME_ACTION_NAME);
 
         game_needs_saving = false;
@@ -1354,45 +1345,6 @@ public class Application : Gtk.Application
         }
     }
 
-    public void claim_draw_cb ()
-    {
-        if (!game.current_player.claim_draw ())
-        {
-            game.pause ();
-
-            var dialog = new Gtk.MessageDialog (window,
-                                                Gtk.DialogFlags.MODAL,
-                                                Gtk.MessageType.INFO,
-                                                Gtk.ButtonsType.CLOSE,
-                                                _("You cannot currently claim a draw."));
-
-            var repetitions = game.state_repeated_times (game.current_state);
-            var moves = game.current_state.halfmove_clock / 2;
-
-            warn_if_fail (repetitions == 1 || repetitions == 2);
-
-            /* Dialog that appears when Claim Draw is used but a draw cannot be claimed */
-            dialog.format_secondary_text ("• " + (repetitions == 1 ?
-                                                      _("It is the first time this board position has 
occurred") :
-                                                      _("It is the second time this board position has 
occurred")) + "\n"
-                                            + "• " + ngettext ("%d move has passed without a capture or pawn 
advancement",
-                                                               "%d moves have passed without a capture or 
pawn advancement",
-                                                               moves) + "\n\n"
-                                            + _("You can claim a draw when either:") + "\n\n"
-                                            + "• " + _("Any board position has occurred three times") + "\n"
-                                            + "• " + _("50 moves have passed without a capture or pawn 
advancement") + "\n\n"
-                                            + _("(Board position is affected by the ability to castle or 
capture en passant.)") + "\n\n"
-                                            + _("The game is automatically a draw if:") + "\n\n"
-                                            + "• " + _("The current player cannot move (stalemate)") + "\n"
-                                            + "• " + _("Neither player can checkmate (insufficient 
material)"),
-                                          moves);
-
-            dialog.run ();
-            dialog.destroy ();
-            game.unpause ();
-        }
-    }
-
     public void undo_move_cb ()
     {
         if (opponent != null)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]