[gnome-chess] Use headerbar title to indicate player to move
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess] Use headerbar title to indicate player to move
- Date: Tue, 7 Jan 2014 03:15:51 +0000 (UTC)
commit 1ba2b8fb46d8e5ef81baa08ae163d28b358dc1bb
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Jan 6 21:13:47 2014 -0600
Use headerbar title to indicate player to move
https://bugzilla.gnome.org/show_bug.cgi?id=443449
src/gnome-chess.vala | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 78c02c9..d7bf6e4 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -558,6 +558,8 @@ public class Application : Gtk.Application
if (game.result != ChessResult.IN_PROGRESS)
game_end_cb (game);
+ update_headerbar_title ();
+
white_time_label.queue_draw ();
black_time_label.queue_draw ();
}
@@ -941,6 +943,7 @@ public class Application : Gtk.Application
enable_window_action (SAVE_GAME_AS_ACTION_NAME);
update_history_panel ();
update_action_status ();
+ update_headerbar_title ();
if (opponent_engine != null)
opponent_engine.report_move (move);
@@ -1012,6 +1015,28 @@ public class Application : Gtk.Application
disable_window_action (UNDO_MOVE_ACTION_NAME);
}
+ private void update_headerbar_title ()
+ {
+ if (game.current_player.color == Color.WHITE)
+ {
+ if (human_player == null || human_player.color == Color.WHITE)
+ /* Window title on White's turn if White is human */
+ headerbar.set_title (_("White to Move"));
+ else
+ /* Window title on White's turn if White is a computer */
+ headerbar.set_title (_("White is Thinking…"));
+ }
+ else
+ {
+ if (human_player == null || human_player.color == Color.BLACK)
+ /* Window title on Black's turn if Black is human */
+ headerbar.set_title (_("Black to Move"));
+ else
+ /* Window title on Black's turn if Black is a computer */
+ headerbar.set_title (_("Black is Thinking…"));
+ }
+ }
+
private void add_accelerators ()
{
add_accelerator ("<Control>N", "win." + NEW_GAME_ACTION_NAME, null);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]