[gnome-chess/chess-telepathy-networking-support-664946-rebase: 1/64] [Chess Screen] UI changes and control functions



commit ef392befcdaf5ea723b7e953f992549a733ab97a
Author: Chandni Verma <chandniverma2112 gmail com>
Date:   Thu Mar 22 06:59:16 2012 +0530

    [Chess Screen] UI changes and control functions

 data/gnome-chess.ui  | 1508 ++++++++++++++++++++++++++++++++++++++------------
 src/gnome-chess.vala |  254 +++++++++-
 2 files changed, 1393 insertions(+), 369 deletions(-)
---
diff --git a/data/gnome-chess.ui b/data/gnome-chess.ui
index 2f1bcb4..150b031 100644
--- a/data/gnome-chess.ui
+++ b/data/gnome-chess.ui
@@ -1,8 +1,77 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
+  <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkAccelGroup" id="accelgroup"/>
+  <object class="GtkRadioAction" id="radioaction_black">
+    <property name="group">radioaction_white</property>
+    <signal name="activate" handler="color_selection_changed_cb" swapped="no"/>
+  </object>
+  <object class="GtkRadioAction" id="radioaction_difficult">
+    <property name="group">radioaction_easy</property>
+    <signal name="activate" handler="difficulty_changed_cb" swapped="no"/>
+  </object>
+  <object class="GtkRadioAction" id="radioaction_easy">
+    <signal name="activate" handler="difficulty_changed_cb" swapped="no"/>
+  </object>
+  <object class="GtkRadioAction" id="radioaction_new_game">
+    <property name="group">radioaction_previous_game</property>
+    <signal name="activate" handler="game_selected_cb" swapped="no"/>
+  </object>
+  <object class="GtkRadioAction" id="radioaction_normal">
+    <property name="group">radioaction_easy</property>
+    <signal name="activate" handler="difficulty_changed_cb" swapped="no"/>
+  </object>
+  <object class="GtkRadioAction" id="radioaction_opponent_local_player">
+    <property name="group">radioaction_opponent_robot</property>
+    <signal name="activate" handler="opponent_changed_cb" swapped="no"/>
+  </object>
+  <object class="GtkRadioAction" id="radioaction_opponent_remote_player">
+    <property name="group">radioaction_opponent_robot</property>
+    <signal name="activate" handler="opponent_changed_cb" swapped="no"/>
+  </object>
+  <object class="GtkRadioAction" id="radioaction_opponent_robot">
+    <signal name="activate" handler="opponent_changed_cb" swapped="no"/>
+  </object>
+  <object class="GtkRadioAction" id="radioaction_previous_game">
+    <signal name="activate" handler="game_selected_cb" swapped="no"/>
+  </object>
+  <object class="GtkRadioAction" id="radioaction_white">
+    <signal name="activate" handler="color_selection_changed_cb" swapped="no"/>
+  </object>
+  <object class="GtkListStore" id="game_duration_model">
+    <columns>
+      <!-- column-name duration_text -->
+      <column type="gchararray"/>
+      <!-- column-name duration_in_seconds -->
+      <column type="gint"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">No limit</col>
+        <col id="1">0</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">One minute</col>
+        <col id="1">60</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Five minutes</col>
+        <col id="1">300</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Thirty minutes</col>
+        <col id="1">1800</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">One hour</col>
+        <col id="1">3600</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Custom</col>
+        <col id="1">-1</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkWindow" id="gnome_chess_app">
     <property name="can_focus">False</property>
     <property name="title">Chess</property>
@@ -14,344 +83,1111 @@
     <signal name="configure-event" handler="gnome_chess_app_configure_event_cb" swapped="no"/>
     <signal name="delete-event" handler="gnome_chess_app_delete_event_cb" swapped="no"/>
     <child>
-      <object class="GtkVBox" id="main_vbox">
+      <object class="GtkGrid" id="grid_screen">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="n_rows">1</property>
+        <property name="n_columns">2</property>
         <child>
-          <object class="GtkMenuBar" id="menubar">
+          <object class="GtkGrid" id="grid_welcome">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="margin_left">12</property>
+            <property name="margin_right">12</property>
+            <property name="margin_top">6</property>
+            <property name="margin_bottom">6</property>
+            <property name="orientation">vertical</property>
+            <property name="n_rows">9</property>
             <child>
-              <object class="GtkMenuItem" id="game_menu_item">
+              <object class="GtkGrid" id="grid_select_game">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="use_action_appearance">False</property>
-                <property name="label" translatable="yes" comments="Game menu name">_Game</property>
-                <property name="use_underline">True</property>
-                <child type="submenu">
-                  <object class="GtkMenu" id="game_menu">
+                <property name="margin_bottom">30</property>
+                <property name="orientation">vertical</property>
+                <property name="row_spacing">12</property>
+                <property name="n_columns">1</property>
+                <child>
+                  <object class="GtkLabel" id="label_welcome">
+                    <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <child>
-                      <object class="GtkImageMenuItem" id="new_menu_item">
-                        <property name="label">gtk-new</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                        <property name="accel_group">accelgroup</property>
-                        <signal name="activate" handler="new_game_cb" swapped="no"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="open_menu_item">
-                        <property name="label">gtk-open</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                        <property name="accel_group">accelgroup</property>
-                        <signal name="activate" handler="open_game_cb" swapped="no"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="menu_save_item">
-                        <property name="label">gtk-save</property>
-                        <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                        <property name="accel_group">accelgroup</property>
-                        <signal name="activate" handler="save_game_cb" swapped="no"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="menu_save_as_item">
-                        <property name="label">gtk-save-as</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                        <property name="accel_group">accelgroup</property>
-                        <signal name="activate" handler="save_game_as_cb" swapped="no"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkSeparatorMenuItem" id="separator1">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="undo_move_item">
-                        <property name="label" translatable="yes" comments="Undo move menu item">_Undo Move</property>
-                        <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="image">undo_move_image</property>
-                        <property name="use_stock">False</property>
-                        <property name="accel_group">accelgroup</property>
-                        <accelerator key="Z" signal="activate" modifiers="GDK_CONTROL_MASK"/>
-                        <signal name="activate" handler="undo_move_cb" swapped="no"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="resign_item">
-                        <property name="label" translatable="yes" comments="Save menu item">_Resign</property>
-                        <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="image">warning_image</property>
-                        <property name="use_stock">False</property>
-                        <property name="accel_group">accelgroup</property>
-                        <signal name="activate" handler="resign_cb" swapped="no"/>
-                      </object>
+                    <property name="margin_bottom">20</property>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">Welcome back!</property>
+                    <property name="track_visited_links">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_continue_previous">
+                    <property name="label" translatable="yes">_Continue with previous game</property>
+                    <property name="width_request">400</property>
+                    <property name="height_request">50</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_left">70</property>
+                    <property name="margin_right">70</property>
+                    <property name="hexpand">True</property>
+                    <property name="related_action">radioaction_previous_game</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_new_game">
+                    <property name="label" translatable="yes">_New game</property>
+                    <property name="width_request">400</property>
+                    <property name="height_request">50</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_left">70</property>
+                    <property name="margin_right">70</property>
+                    <property name="hexpand">True</property>
+                    <property name="related_action">radioaction_new_game</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid_select_opponent">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_bottom">30</property>
+                <property name="row_spacing">12</property>
+                <property name="n_rows">4</property>
+                <property name="n_columns">1</property>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_robot">
+                    <property name="label" translatable="yes">R_obot</property>
+                    <property name="width_request">400</property>
+                    <property name="height_request">50</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_left">70</property>
+                    <property name="margin_right">70</property>
+                    <property name="hexpand">True</property>
+                    <property name="related_action">radioaction_opponent_robot</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_local_player">
+                    <property name="label" translatable="yes">_Local Player</property>
+                    <property name="width_request">400</property>
+                    <property name="height_request">50</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_left">70</property>
+                    <property name="margin_right">70</property>
+                    <property name="hexpand">True</property>
+                    <property name="related_action">radioaction_opponent_local_player</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label_select_opponent">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">Select Opponent</property>
+                    <property name="track_visited_links">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_remote_player">
+                    <property name="label" translatable="yes">_Remote Player</property>
+                    <property name="width_request">400</property>
+                    <property name="height_request">50</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_left">70</property>
+                    <property name="margin_right">70</property>
+                    <property name="hexpand">True</property>
+                    <property name="related_action">radioaction_opponent_remote_player</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid_select_remote_player">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_bottom">20</property>
+                <property name="row_spacing">12</property>
+                <property name="column_spacing">6</property>
+                <property name="column_homogeneous">True</property>
+                <property name="n_rows">4</property>
+                <property name="n_columns">2</property>
+                <child>
+                  <object class="GtkLabel" id="label_select_remote_player">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">Select Remote Player</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">2</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkTreeView" id="treeview_player_list">
+                    <property name="height_request">120</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="margin_left">50</property>
+                    <property name="margin_right">50</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="model">player_list_model</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="treeview-selection1"/>
                     </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">2</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="button_chat">
+                    <property name="label" translatable="yes">_Chat</property>
+                    <property name="width_request">200</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="halign">center</property>
+                    <property name="hexpand">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="chat_clicked_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">2</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="button_cancel">
+                    <property name="label" translatable="yes">C_ancel</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_left">50</property>
+                    <property name="hexpand">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="remote_player_selection_cancelled_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="button_select_player">
+                    <property name="label" translatable="yes">_Select</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_right">50</property>
+                    <property name="hexpand">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="remote_player_selected_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">4</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid_game_options">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_bottom">10</property>
+                <property name="row_spacing">12</property>
+                <property name="column_spacing">6</property>
+                <property name="column_homogeneous">True</property>
+                <property name="n_rows">5</property>
+                <property name="n_columns">8</property>
+                <child>
+                  <object class="GtkLabel" id="label_game_options">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="label" translatable="yes">Game Options</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">6</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="combobox_game_duration">
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="model">game_duration_model</property>
+                    <signal name="changed" handler="duration_changed_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">6</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="button_start">
+                    <property name="label" translatable="yes">_Start</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_top">20</property>
+                    <property name="hexpand">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="start_game_clicked_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">4</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_white">
+                    <property name="label" translatable="yes">_White</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="related_action">radioaction_white</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="active">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">3</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_black">
+                    <property name="label" translatable="yes">_Black</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="related_action">radioaction_black</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">4</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">3</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_easy">
+                    <property name="label" translatable="yes">_Easy</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="related_action">radioaction_easy</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="active">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">2</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_normal">
+                    <property name="label" translatable="yes">_Normal</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="related_action">radioaction_normal</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">3</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">2</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="togglebutton_difficult">
+                    <property name="label" translatable="yes">_Difficult</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="related_action">radioaction_difficult</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">5</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">2</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="button_preferences">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="halign">end</property>
+                    <property name="valign">end</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="relief">none</property>
+                    <property name="image_position">top</property>
+                    <signal name="clicked" handler="game_options_preferences_clicked_cb" swapped="no"/>
                     <child>
-                      <object class="GtkMenuItem" id="claim_draw_item">
+                      <object class="GtkImage" id="image_preferences">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="label" translatable="yes" comments="Claim draw menu item">Claim _Draw</property>
-                        <property name="use_underline">True</property>
-                        <signal name="activate" handler="claim_draw_cb" swapped="no"/>
+                        <property name="stock">gtk-preferences</property>
                       </object>
                     </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">7</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="button_back">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="halign">start</property>
+                    <property name="valign">end</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="relief">none</property>
+                    <signal name="clicked" handler="game_options_go_back_clicked_cb" swapped="no"/>
                     <child>
-                      <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
+                      <object class="GtkImage" id="image_go_back">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="stock">gtk-go-back</property>
                       </object>
                     </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="quit_item">
-                        <property name="label">gtk-quit</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                        <property name="accel_group">accelgroup</property>
-                        <signal name="activate" handler="quit_cb" swapped="no"/>
-                      </object>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">6</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid_preferences">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_bottom">10</property>
+                <property name="row_spacing">12</property>
+                <property name="column_homogeneous">True</property>
+                <child>
+                  <object class="GtkLabel" id="label_choice_of_robot">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">Choice of Robot</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">3</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkTreeView" id="treeview_robots">
+                    <property name="height_request">120</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="margin_left">50</property>
+                    <property name="margin_right">50</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="model">robot_list_model</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="treeview-selection2"/>
                     </child>
                   </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">3</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="button_preferences_done">
+                    <property name="label" translatable="yes">_Done</property>
+                    <property name="height_request">30</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_top">20</property>
+                    <property name="hexpand">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="preferences_done_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
                 </child>
               </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">8</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
             </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="game_vbox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <child>
-              <object class="GtkMenuItem" id="settings_menu_item">
+              <object class="GtkMenuBar" id="menubar">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="use_action_appearance">False</property>
-                <property name="label" translatable="yes" comments="Settings menu item">_Settings</property>
-                <property name="use_underline">True</property>
-                <child type="submenu">
-                  <object class="GtkMenu" id="settings_menu">
+                <child>
+                  <object class="GtkMenuItem" id="game_menu_item">
+                    <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <child>
-                      <object class="GtkImageMenuItem" id="fullscreen_item">
-                        <property name="label">gtk-fullscreen</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                        <property name="accel_group">accelgroup</property>
-                        <accelerator key="F11" signal="activate"/>
-                        <signal name="activate" handler="toggle_fullscreen_cb" swapped="no"/>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="preferences_item">
-                        <property name="label">gtk-preferences</property>
-                        <property name="visible">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="label" translatable="yes" comments="Game menu name">_Game</property>
+                    <property name="use_underline">True</property>
+                    <child type="submenu">
+                      <object class="GtkMenu" id="game_menu">
                         <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                        <property name="accel_group">accelgroup</property>
-                        <signal name="activate" handler="preferences_cb" swapped="no"/>
+                        <child>
+                          <object class="GtkImageMenuItem" id="new_menu_item">
+                            <property name="label">gtk-new</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                            <property name="accel_group">accelgroup</property>
+                            <signal name="activate" handler="new_game_cb" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkImageMenuItem" id="open_menu_item">
+                            <property name="label">gtk-open</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                            <property name="accel_group">accelgroup</property>
+                            <signal name="activate" handler="open_game_cb" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkImageMenuItem" id="menu_save_item">
+                            <property name="label">gtk-save</property>
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                            <property name="accel_group">accelgroup</property>
+                            <signal name="activate" handler="save_game_cb" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkImageMenuItem" id="menu_save_as_item">
+                            <property name="label">gtk-save-as</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                            <property name="accel_group">accelgroup</property>
+                            <signal name="activate" handler="save_game_as_cb" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkSeparatorMenuItem" id="separator1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkImageMenuItem" id="undo_move_item">
+                            <property name="label" translatable="yes" comments="Undo move menu item">_Undo Move</property>
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="image">undo_move_image</property>
+                            <property name="use_stock">False</property>
+                            <property name="accel_group">accelgroup</property>
+                            <accelerator key="Z" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                            <signal name="activate" handler="undo_move_cb" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkImageMenuItem" id="resign_item">
+                            <property name="label" translatable="yes" comments="Save menu item">_Resign</property>
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="image">warning_image</property>
+                            <property name="use_stock">False</property>
+                            <property name="accel_group">accelgroup</property>
+                            <signal name="activate" handler="resign_cb" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkMenuItem" id="claim_draw_item">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="label" translatable="yes" comments="Claim draw menu item">Claim _Draw</property>
+                            <property name="use_underline">True</property>
+                            <signal name="activate" handler="claim_draw_cb" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkImageMenuItem" id="quit_item">
+                            <property name="label">gtk-quit</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                            <property name="accel_group">accelgroup</property>
+                            <signal name="activate" handler="quit_cb" swapped="no"/>
+                          </object>
+                        </child>
                       </object>
                     </child>
                   </object>
                 </child>
-              </object>
-            </child>
-            <child>
-              <object class="GtkMenuItem" id="help_menu_item">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="use_action_appearance">False</property>
-                <property name="label" translatable="yes" comments="Help menu item">_Help</property>
-                <property name="use_underline">True</property>
-                <child type="submenu">
-                  <object class="GtkMenu" id="help_menu">
+                <child>
+                  <object class="GtkMenuItem" id="settings_menu_item">
+                    <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <child>
-                      <object class="GtkImageMenuItem" id="help_item">
-                        <property name="label" translatable="yes" comments="Help contents menu item">_Contents</property>
-                        <property name="visible">True</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="label" translatable="yes" comments="Settings menu item">_Settings</property>
+                    <property name="use_underline">True</property>
+                    <child type="submenu">
+                      <object class="GtkMenu" id="settings_menu">
                         <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="image">help_image</property>
-                        <property name="use_stock">False</property>
-                        <property name="accel_group">accelgroup</property>
-                        <accelerator key="F1" signal="activate"/>
-                        <signal name="activate" handler="help_cb" swapped="no"/>
+                        <child>
+                          <object class="GtkImageMenuItem" id="fullscreen_item">
+                            <property name="label">gtk-fullscreen</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                            <property name="accel_group">accelgroup</property>
+                            <accelerator key="F11" signal="activate"/>
+                            <signal name="activate" handler="toggle_fullscreen_cb" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkImageMenuItem" id="preferences_item">
+                            <property name="label">gtk-preferences</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                            <property name="accel_group">accelgroup</property>
+                            <signal name="activate" handler="preferences_cb" swapped="no"/>
+                          </object>
+                        </child>
                       </object>
                     </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="about_item">
-                        <property name="label">gtk-about</property>
-                        <property name="visible">True</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkMenuItem" id="help_menu_item">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="label" translatable="yes" comments="Help menu item">_Help</property>
+                    <property name="use_underline">True</property>
+                    <child type="submenu">
+                      <object class="GtkMenu" id="help_menu">
                         <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                        <property name="accel_group">accelgroup</property>
-                        <signal name="activate" handler="about_cb" swapped="no"/>
+                        <child>
+                          <object class="GtkImageMenuItem" id="help_item">
+                            <property name="label" translatable="yes" comments="Help contents menu item">_Contents</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="image">help_image</property>
+                            <property name="use_stock">False</property>
+                            <property name="accel_group">accelgroup</property>
+                            <accelerator key="F1" signal="activate"/>
+                            <signal name="activate" handler="help_cb" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkImageMenuItem" id="about_item">
+                            <property name="label">gtk-about</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                            <property name="accel_group">accelgroup</property>
+                            <signal name="activate" handler="about_cb" swapped="no"/>
+                          </object>
+                        </child>
                       </object>
                     </child>
                   </object>
                 </child>
               </object>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkToolbar" id="toolbar">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <style>
-            	<class name="primary-toolbar"/>
-            </style>
-            <child>
-              <object class="GtkToolButton" id="new_game_button">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="tooltip_text" translatable="yes" comments="Tooltip for start new game toolbar button">Start a new game</property>
-                <property name="use_action_appearance">False</property>
-                <property name="is_important">True</property>
-                <property name="label" translatable="yes" comments="The New Game toolbar button">New Game</property>
-                <property name="use_underline">True</property>
-                <property name="stock_id">gtk-new</property>
-                <signal name="clicked" handler="new_game_cb" swapped="no"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="homogeneous">True</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkToolButton" id="undo_move_button">
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">False</property>
-                <property name="use_action_appearance">False</property>
-                <property name="is_important">True</property>
-                <property name="label" translatable="yes" comments="The undo move toolbar button">Undo Move</property>
-                <property name="use_underline">True</property>
-                <property name="stock_id">gtk-undo</property>
-                <signal name="clicked" handler="undo_move_cb" swapped="no"/>
-              </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="homogeneous">True</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkToolButton" id="resign_button">
+              <object class="GtkToolbar" id="toolbar">
                 <property name="visible">True</property>
-                <property name="sensitive">False</property>
                 <property name="can_focus">False</property>
-                <property name="use_action_appearance">False</property>
-                <property name="is_important">True</property>
-                <property name="label" translatable="yes" comments="The tooltip for the Resign toolbar button">Resign</property>
-                <property name="use_underline">True</property>
-                <property name="stock_id">gtk-dialog-warning</property>
-                <signal name="clicked" handler="resign_cb" swapped="no"/>
+                <child>
+                  <object class="GtkToolButton" id="new_game_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for start new game toolbar button">Start a new game</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="label" translatable="yes" comments="The New Game toolbar button">New Game</property>
+                    <property name="use_underline">True</property>
+                    <property name="stock_id">gtk-new</property>
+                    <signal name="clicked" handler="new_game_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolButton" id="undo_move_button">
+                    <property name="visible">True</property>
+                    <property name="sensitive">False</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="label" translatable="yes" comments="The undo move toolbar button">Undo Move</property>
+                    <property name="use_underline">True</property>
+                    <property name="stock_id">gtk-undo</property>
+                    <signal name="clicked" handler="undo_move_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolButton" id="resign_button">
+                    <property name="visible">True</property>
+                    <property name="sensitive">False</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="is_important">True</property>
+                    <property name="label" translatable="yes" comments="The tooltip for the Resign toolbar button">Resign</property>
+                    <property name="use_underline">True</property>
+                    <property name="stock_id">gtk-dialog-warning</property>
+                    <signal name="clicked" handler="resign_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="homogeneous">True</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
               </packing>
             </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkVBox" id="view_box">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="spacing">3</property>
             <child>
-              <object class="GtkHBox" id="navigation_box">
+              <object class="GtkVBox" id="view_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">6</property>
+                <property name="spacing">3</property>
                 <child>
-                  <object class="GtkHBox" id="left_nav_box">
+                  <object class="GtkHBox" id="navigation_box">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="homogeneous">True</property>
+                    <property name="spacing">6</property>
                     <child>
-                      <object class="GtkButton" id="first_move_button">
+                      <object class="GtkHBox" id="left_nav_box">
                         <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="tooltip_text" translatable="yes" comments="Tooltip on the show first move (i.e. game start) navigation button">Rewind to the game start</property>
-                        <property name="use_action_appearance">False</property>
-                        <signal name="clicked" handler="history_start_clicked_cb" swapped="no"/>
+                        <property name="can_focus">False</property>
+                        <property name="homogeneous">True</property>
                         <child>
-                          <object class="GtkImage" id="first_move_image">
+                          <object class="GtkButton" id="first_move_button">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="stock">gtk-goto-first</property>
-                            <property name="icon-size">1</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="tooltip_text" translatable="yes" comments="Tooltip on the show first move (i.e. game start) navigation button">Rewind to the game start</property>
+                            <property name="use_action_appearance">False</property>
+                            <signal name="clicked" handler="history_start_clicked_cb" swapped="no"/>
+                            <child>
+                              <object class="GtkImage" id="first_move_image">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-goto-first</property>
+                                <property name="icon-size">1</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="prev_move_button">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="tooltip_text" translatable="yes" comments="Tooltip on the show previous move navigation button">Show the previous move</property>
+                            <property name="use_action_appearance">False</property>
+                            <signal name="clicked" handler="history_previous_clicked_cb" swapped="no"/>
+                            <child>
+                              <object class="GtkImage" id="prev_move_image">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-go-back</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="next_move_button">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="tooltip_text" translatable="yes" comments="Tooltip on the show next move navigation button">Show the next move</property>
+                            <property name="use_action_appearance">False</property>
+                            <signal name="clicked" handler="history_next_clicked_cb" swapped="no"/>
+                            <child>
+                              <object class="GtkImage" id="next_move_image">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-go-forward</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="last_move_button">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="tooltip_text" translatable="yes" comments="Tooltip on the show current move navigation button">Show the current move</property>
+                            <property name="use_action_appearance">False</property>
+                            <signal name="clicked" handler="history_latest_clicked_cb" swapped="no"/>
+                            <child>
+                              <object class="GtkImage" id="last_move_image">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-goto-last</property>
+                              </object>
+                            </child>
                           </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">3</property>
+                          </packing>
                         </child>
                       </object>
                       <packing>
-                        <property name="expand">True</property>
+                        <property name="expand">False</property>
                         <property name="fill">True</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="prev_move_button">
+                      <object class="GtkComboBox" id="history_combo">
                         <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="tooltip_text" translatable="yes" comments="Tooltip on the show previous move navigation button">Show the previous move</property>
-                        <property name="use_action_appearance">False</property>
-                        <signal name="clicked" handler="history_previous_clicked_cb" swapped="no"/>
+                        <property name="can_focus">False</property>
+                        <property name="model">history_model</property>
                         <child>
-                          <object class="GtkImage" id="prev_move_image">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="stock">gtk-go-back</property>
-                          </object>
+                          <object class="GtkCellRendererText" id="history_combo_cellrenderer"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
                         </child>
                       </object>
                       <packing>
@@ -361,143 +1197,80 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="next_move_button">
+                      <object class="GtkHBox" id="right_nav_box">
                         <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="tooltip_text" translatable="yes" comments="Tooltip on the show next move navigation button">Show the next move</property>
-                        <property name="use_action_appearance">False</property>
-                        <signal name="clicked" handler="history_next_clicked_cb" swapped="no"/>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">6</property>
+                        <property name="homogeneous">True</property>
                         <child>
-                          <object class="GtkImage" id="next_move_image">
+                          <object class="GtkDrawingArea" id="white_time_label">
+                            <property name="width_request">20</property>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="stock">gtk-go-forward</property>
+                            <signal name="draw" handler="white_time_draw_cb" swapped="no"/>
                           </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
                         </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="last_move_button">
-                        <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="tooltip_text" translatable="yes" comments="Tooltip on the show current move navigation button">Show the current move</property>
-                        <property name="use_action_appearance">False</property>
-                        <signal name="clicked" handler="history_latest_clicked_cb" swapped="no"/>
                         <child>
-                          <object class="GtkImage" id="last_move_image">
+                          <object class="GtkDrawingArea" id="black_time_label">
+                            <property name="width_request">20</property>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="stock">gtk-goto-last</property>
+                            <signal name="draw" handler="black_time_draw_cb" swapped="no"/>
                           </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
                         </child>
                       </object>
                       <packing>
-                        <property name="expand">True</property>
+                        <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">3</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
+                    <property name="pack_type">end</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="history_combo">
+                  <object class="GtkAlignment" id="view_container">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="model">history_model</property>
                     <child>
-                      <object class="GtkCellRendererText" id="history_combo_cellrenderer"/>
-                      <attributes>
-                        <attribute name="text">0</attribute>
-                      </attributes>
+                      <placeholder/>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">True</property>
                     <property name="fill">True</property>
+                    <property name="pack_type">end</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkHBox" id="right_nav_box">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
-                    <property name="homogeneous">True</property>
-                    <child>
-                      <object class="GtkDrawingArea" id="white_time_label">
-                        <property name="width_request">20</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <signal name="draw" handler="white_time_draw_cb" swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkDrawingArea" id="black_time_label">
-                        <property name="width_request">20</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <signal name="draw" handler="black_time_draw_cb" swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="pack_type">end</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkAlignment" id="view_container">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <child>
-                  <placeholder/>
-                </child>
               </object>
               <packing>
                 <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="pack_type">end</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
       </object>
@@ -517,6 +1290,20 @@
       <column type="gint"/>
     </columns>
   </object>
+  <object class="GtkListStore" id="player_list_model">
+    <columns>
+      <!-- column-name remote_player_avatar -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name remote_player_name -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="robot_list_model">
+    <columns>
+      <!-- column-name robot_name -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkImage" id="undo_move_image">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -529,10 +1316,5 @@
     <property name="stock">gtk-dialog-warning</property>
     <property name="icon-size">1</property>
   </object>
-  <object class="GtkSizeGroup" id="nav_bar_sizegroup">
-    <widgets>
-      <widget name="right_nav_box"/>
-      <widget name="left_nav_box"/>
-    </widgets>
-  </object>
+  <object class="GtkSizeGroup" id="nav_bar_sizegroup"/>
 </interface>
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 1e6f5ee..433db19 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -8,6 +8,41 @@ public class Application : Gtk.Application
     private Gtk.Builder builder;
     private Gtk.Builder preferences_builder;
     private Gtk.Window window;
+
+    /* Chess welcome screen widgets */
+    private Gtk.Widget grid_welcome;
+    private Gtk.Widget grid_select_game;
+    private Gtk.Widget grid_select_opponent;
+    private Gtk.Widget grid_select_remote_player;
+    private Gtk.Widget grid_game_options;
+    private Gtk.Widget grid_preferences;
+
+    private Gtk.Action radioaction_previous_game;
+    private Gtk.Action radioaction_new_game;
+
+    private Gtk.Widget togglebutton_robot;
+    private Gtk.Action radioaction_opponent_robot;
+    private Gtk.Action radioaction_opponent_local_player;
+    private Gtk.Action radioaction_opponent_remote_player;
+
+    private Gtk.ListStore player_list_model;
+
+    private Gtk.Widget togglebutton_easy;
+    private Gtk.Widget togglebutton_normal;
+    private Gtk.Widget togglebutton_difficult;
+    private Gtk.Action radioaction_easy;
+    private Gtk.Action radioaction_normal;
+    private Gtk.Action radioaction_difficult;
+    private Gtk.Action radioaction_white;
+    private Gtk.Action radioaction_black;
+    private Gtk.ListStore game_duration_model;
+
+    private Gtk.TreeView treeview_robots;
+    private Gtk.ListStore robot_list_model;
+    private Gtk.Widget done_button;
+
+    /* Chess game screen widgets */
+    private Gtk.Widget game_vbox;
     private Gtk.Widget save_menu;
     private Gtk.Widget save_as_menu;
     private Gtk.MenuItem fullscreen_menu;
@@ -80,6 +115,39 @@ public class Application : Gtk.Application
             warning ("Could not load UI: %s", e.message);
         }
         window = (Gtk.Window) builder.get_object ("gnome_chess_app");
+
+        grid_welcome = (Gtk.Widget) builder.get_object ("grid_welcome");
+        grid_select_game = (Gtk.Widget) builder.get_object ("grid_select_game");
+        grid_select_opponent = (Gtk.Widget) builder.get_object ("grid_select_opponent");
+        grid_select_remote_player = (Gtk.Widget) builder.get_object ("grid_select_remote_player");
+        grid_game_options = (Gtk.Widget) builder.get_object ("grid_game_options");
+        grid_preferences = (Gtk.Widget) builder.get_object ("grid_preferences");
+
+        radioaction_previous_game = (Gtk.Action) builder.get_object ("radioaction_previous_game");
+        radioaction_new_game = (Gtk.Action) builder.get_object ("radioaction_new_game");
+
+        togglebutton_robot = (Gtk.Widget) builder.get_object ("togglebutton_robot");
+        radioaction_opponent_robot = (Gtk.Action) builder.get_object ("radioaction_opponent_robot");
+        radioaction_opponent_local_player = (Gtk.Action) builder.get_object ("radioaction_opponent_local_player");
+        radioaction_opponent_remote_player = (Gtk.Action) builder.get_object ("radioaction_opponent_remote_player");
+
+        player_list_model = (Gtk.ListStore) builder.get_object ("player_list_model");
+
+        togglebutton_easy = (Gtk.Widget) builder.get_object ("togglebutton_easy");
+        togglebutton_normal = (Gtk.Widget) builder.get_object ("togglebutton_normal");
+        togglebutton_difficult = (Gtk.Widget) builder.get_object ("togglebutton_difficult");
+        radioaction_easy = (Gtk.Action) builder.get_object ("radioaction_easy");
+        radioaction_normal = (Gtk.Action) builder.get_object ("radioaction_normal");
+        radioaction_difficult = (Gtk.Action) builder.get_object ("radioaction_difficult");
+        radioaction_white = (Gtk.Action) builder.get_object ("radioaction_white");
+        radioaction_black = (Gtk.Action) builder.get_object ("radioaction_black");
+        game_duration_model = (Gtk.ListStore) builder.get_object ("game_duration_model");
+
+        treeview_robots = (Gtk.TreeView) builder.get_object ("treeview_robots");
+        robot_list_model = (Gtk.ListStore) treeview_robots.model;
+        done_button = (Gtk.Widget) builder.get_object ("button_preferences_done");
+
+        game_vbox = (Gtk.Widget) builder.get_object ("game_vbox");
         save_menu = (Gtk.Widget) builder.get_object ("menu_save_item");
         save_as_menu = (Gtk.Widget) builder.get_object ("menu_save_as_item");
         fullscreen_menu = (Gtk.MenuItem) builder.get_object ("fullscreen_item");
@@ -98,6 +166,7 @@ public class Application : Gtk.Application
         settings.bind ("show-history", builder.get_object ("navigation_box"), "visible", SettingsBindFlags.DEFAULT);
         var view_box = (Gtk.VBox) builder.get_object ("view_box");
         view_container = (Gtk.Container) builder.get_object ("view_container");
+
         builder.connect_signals (this);
 
         add_window (window);
@@ -135,18 +204,30 @@ public class Application : Gtk.Application
         foreach (var profile in ai_profiles)
             message ("Detected AI profile %s in %s", profile.name, profile.path);
 
-        /* Load from history if no game requested */
+        if (ai_profiles == null)
+        {
+            /* TODO: We may optionally allow one to install compatible AI
+             * engines using something like Packagekit, here or elsewhere */
+            togglebutton_robot.hide ();
+            show_robot_opponent_widgets (false);
+        }
+        else
+        {
+            /* TODO: Populate list of robots */
+        }
+
         if (game_file == null)
         {
             var unfinished = history.get_unfinished ();
             if (unfinished != null)
-                game_file = unfinished.data;
+                show_game_selector ();
             else
-                start_new_game ();
+                show_opponent_selector ();
         }
-
-        if (game_file != null)
+        else
         {
+            show_game_vbox ();
+
             try
             {
                 load_game (game_file, false);
@@ -959,6 +1040,167 @@ public class Application : Gtk.Application
         return false;
     }
 
+    private void show_game_selector ()
+    {
+        game_vbox.hide ();
+        grid_welcome.show ();
+
+        grid_select_game.show ();
+        grid_select_opponent.hide ();
+        grid_select_remote_player.hide ();
+        grid_game_options.hide ();
+        grid_preferences.hide ();
+    }
+
+    private void show_opponent_selector ()
+    {
+        game_vbox.hide ();
+        grid_welcome.show ();
+
+        grid_select_game.hide ();
+        grid_select_opponent.show ();
+        grid_select_remote_player.hide ();
+        grid_game_options.hide ();
+        grid_preferences.hide ();
+    }
+
+    private void show_remote_player_selector ()
+    {
+        game_vbox.hide ();
+        grid_welcome.show ();
+
+        grid_select_game.hide ();
+        grid_select_opponent.hide ();
+        grid_select_remote_player.show ();
+        grid_game_options.hide ();
+        grid_preferences.hide ();
+    }
+
+    private void show_game_options ()
+    {
+        game_vbox.hide ();
+        grid_welcome.show ();
+
+        grid_select_game.hide ();
+        grid_select_opponent.hide ();
+        grid_select_remote_player.hide ();
+        grid_game_options.show ();
+        grid_preferences.hide ();
+    }
+
+    private void show_preferences ()
+    {
+        game_vbox.hide ();
+        grid_welcome.show ();
+
+        grid_select_game.hide ();
+        grid_select_opponent.hide ();
+        grid_select_remote_player.hide ();
+        grid_game_options.hide ();
+        grid_preferences.show ();
+    }
+
+    private void show_game_vbox ()
+    {
+        game_vbox.show ();
+        grid_welcome.hide ();
+    }
+
+    [CCode (cname = "G_MODULE_EXPORT game_selected_cb", instance_pos = 1.1)]
+    public void game_selected_cb (Gtk.Action action) throws Error
+    {
+        if (action == radioaction_previous_game)
+        {
+            var unfinished = history.get_unfinished ();
+            var file = unfinished.data;
+            show_game_vbox ();
+            load_game (file, true);
+        }
+        else
+        {
+            show_opponent_selector ();
+        }
+    }
+
+    private void show_robot_opponent_widgets (bool robot_selected)
+    {
+        if (robot_selected)
+        {
+            togglebutton_easy.show ();
+            togglebutton_normal.show ();
+            togglebutton_difficult.show ();
+        }
+        else
+        {
+            togglebutton_easy.hide ();
+            togglebutton_normal.hide ();
+            togglebutton_difficult.hide ();
+        }
+    }
+
+    [CCode (cname = "G_MODULE_EXPORT opponent_changed_cb", instance_pos = -1)]
+    public void opponent_changed_cb (Gtk.Action action)
+    {
+        /* TODO: opponent settings */
+        if (action == radioaction_opponent_robot)
+        {
+            show_robot_opponent_widgets (true);
+            show_game_options ();
+        }
+        else
+        {
+            show_robot_opponent_widgets (false);
+            if (action == radioaction_opponent_local_player)
+            {
+                show_game_options ();
+            }
+            else
+            {
+                show_remote_player_selector ();
+            }
+        }
+    }
+//    [CCode (cname = "G_MODULE_EXPORT chat_clicked_cb", instance_pos = -1)]
+    [CCode (cname = "G_MODULE_EXPORT remote_player_selected_cb", instance_pos = -1)]
+    public void remote_player_selected_cb (Gtk.Button button)
+    {
+        /* TODO: Cache player details */
+        show_game_options ();
+    }
+
+    [CCode (cname = "G_MODULE_EXPORT remote_player_selection_cancelled_cb", instance_pos = -1)]
+    public void remote_player_selection_cancelled_cb (Gtk.Button button)
+    {
+        show_opponent_selector ();
+    }
+//    [CCode (cname = "G_MODULE_EXPORT color_selection_changed_cb", instance_pos = -1)]
+//    [CCode (cname = "G_MODULE_EXPORT difficulty_changed_cb", instance_pos = -1)]
+//    [CCode (cname = "G_MODULE_EXPORT duration_changed_cb", instance_pos = -1)]
+    [CCode (cname = "G_MODULE_EXPORT start_game_clicked_cb", instance_pos = -1)]
+    public void start_game_clicked_cb (Gtk.Button button)
+    {
+        show_game_vbox ();
+        start_new_game ();
+    }
+
+    [CCode (cname = "G_MODULE_EXPORT game_options_preferences_clicked_cb", instance_pos = -1)]
+    public void game_options_preferences_clicked_cb (Gtk.Button button)
+    {
+        show_preferences ();
+    }
+
+    [CCode (cname = "G_MODULE_EXPORT game_options_go_back_clicked_cb", instance_pos = -1)]
+    public void game_options_go_back_clicked_cb (Gtk.Button button)
+    {
+        show_opponent_selector ();
+    }
+
+    [CCode (cname = "G_MODULE_EXPORT preferences_done_cb", instance_pos = -1)]
+    public void preferences_done_cb (Gtk.Button button)
+    {
+        show_game_options ();
+    }
+
     [CCode (cname = "G_MODULE_EXPORT new_game_cb", instance_pos = -1)]
     public void new_game_cb (Gtk.Widget widget)
     {
@@ -987,7 +1229,7 @@ public class Application : Gtk.Application
 
         autosave ();
 
-        start_new_game ();
+        show_opponent_selector ();
     }
 
     [CCode (cname = "G_MODULE_EXPORT resign_cb", instance_pos = -1)]



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