diff --git a/src/chess-clock.vala b/src/chess-clock.vala index 7fb70c3..7487a58 100644 --- a/src/chess-clock.vala +++ b/src/chess-clock.vala @@ -81,7 +81,7 @@ public class ChessClock : Object private bool is_active { - get { return expire_timeout_id != 0; } + get { return timer != null && expire_timeout_id != 0; } } public void start () diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala index b7183fe..453c4ff 100644 --- a/src/gnome-chess.vala +++ b/src/gnome-chess.vala @@ -495,7 +495,6 @@ public class Application : Gtk.Application scene.game = game; info_bar.hide (); save_button.sensitive = false; - pause_button.sensitive = (game.clock != null); update_history_panel (); update_control_buttons (); @@ -564,7 +563,14 @@ public class Application : Gtk.Application game.start (); if (moves.length > 0 && game.clock != null) + { game.clock.start (); + pause_button.sensitive = true; + } + else + { + pause_button.sensitive = false; + } if (game.result != ChessResult.IN_PROGRESS) game_end_cb (game); @@ -673,6 +679,9 @@ public class Application : Gtk.Application private void game_turn_cb (ChessGame game, ChessPlayer player) { + if (game.clock != null) + pause_button.sensitive = true; + if (game.is_started && opponent_engine != null && player == opponent) opponent_engine.request_move (); }