gnome-games r7254 - in trunk/glchess: . glade src/lib src/lib/gtkui



Author: andreasr
Date: Sun Jan 20 20:35:01 2008
New Revision: 7254
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7254&view=rev

Log:
Add preferece dialog and reorganize menus. Reported by Robert Ancell in bug #443447. Patch by me.


Added:
   trunk/glchess/glade/preferences.glade
Modified:
   trunk/glchess/ChangeLog
   trunk/glchess/glade/Makefile.am
   trunk/glchess/glade/glchess.glade
   trunk/glchess/src/lib/defaults.py.in
   trunk/glchess/src/lib/gtkui/dialogs.py
   trunk/glchess/src/lib/gtkui/gtkui.py

Modified: trunk/glchess/glade/Makefile.am
==============================================================================
--- trunk/glchess/glade/Makefile.am	(original)
+++ trunk/glchess/glade/Makefile.am	Sun Jan 20 20:35:01 2008
@@ -7,6 +7,7 @@
 	log.glade		\
 	new_game.glade		\
 	network_game.glade	\
+	preferences.glade	\
 	save_game.glade
 
 EXTRA_DIST = $(ui_DATA)

Modified: trunk/glchess/glade/glchess.glade
==============================================================================
--- trunk/glchess/glade/glchess.glade	(original)
+++ trunk/glchess/glade/glchess.glade	Sun Jan 20 20:35:01 2008
@@ -54,6 +54,40 @@
 		  </child>
 
 		  <child>
+		    <widget class="GtkImageMenuItem" id="open1">
+		      <property name="visible">True</property>
+		      <property name="label">gtk-open</property>
+		      <property name="use_stock">True</property>
+		      <signal name="activate" handler="_on_open_game_button_clicked" last_modification_time="Fri, 17 Feb 2006 22:41:34 GMT"/>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkImageMenuItem" id="menu_save_item">
+		      <property name="visible">True</property>
+		      <property name="sensitive">False</property>
+		      <property name="label">gtk-save</property>
+		      <property name="use_stock">True</property>
+		      <signal name="activate" handler="_on_save_game_button_clicked" last_modification_time="Fri, 17 Feb 2006 22:49:13 GMT"/>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkImageMenuItem" id="menu_save_as_item">
+		      <property name="visible">True</property>
+		      <property name="label">gtk-save-as</property>
+		      <property name="use_stock">True</property>
+		      <signal name="activate" handler="_on_save_as_game_button_clicked" last_modification_time="Thu, 23 Nov 2006 05:02:45 GMT"/>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkSeparatorMenuItem" id="separator1">
+		      <property name="visible">True</property>
+		    </widget>
+		  </child>
+
+		  <child>
 		    <widget class="GtkImageMenuItem" id="menu_play_online_item">
 		      <property name="visible">True</property>
 		      <property name="label" translatable="yes">Network _Game</property>
@@ -62,7 +96,7 @@
 		      <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image75">
+			<widget class="GtkImage" id="image109">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-network</property>
 			  <property name="icon_size">1</property>
@@ -76,30 +110,50 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkImageMenuItem" id="open1">
+		    <widget class="GtkSeparatorMenuItem" id="separator2">
 		      <property name="visible">True</property>
-		      <property name="label">gtk-open</property>
-		      <property name="use_stock">True</property>
-		      <signal name="activate" handler="_on_open_game_button_clicked" last_modification_time="Fri, 17 Feb 2006 22:41:34 GMT"/>
 		    </widget>
 		  </child>
 
 		  <child>
-		    <widget class="GtkImageMenuItem" id="menu_save_item">
+		    <widget class="GtkImageMenuItem" id="menu_resign">
 		      <property name="visible">True</property>
-		      <property name="sensitive">False</property>
-		      <property name="label">gtk-save</property>
-		      <property name="use_stock">True</property>
-		      <signal name="activate" handler="_on_save_game_button_clicked" last_modification_time="Fri, 17 Feb 2006 22:49:13 GMT"/>
+		      <property name="label" translatable="yes">_Resign</property>
+		      <property name="use_underline">True</property>
+		      <signal name="activate" handler="_on_resign_clicked" last_modification_time="Sun, 20 Jan 2008 19:45:39 GMT"/>
+
+		      <child internal-child="image">
+			<widget class="GtkImage" id="image110">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-dialog-warning</property>
+			  <property name="icon_size">1</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+		      </child>
 		    </widget>
 		  </child>
 
 		  <child>
-		    <widget class="GtkImageMenuItem" id="menu_save_as_item">
+		    <widget class="GtkImageMenuItem" id="menu_claim_draw">
 		      <property name="visible">True</property>
-		      <property name="label">gtk-save-as</property>
-		      <property name="use_stock">True</property>
-		      <signal name="activate" handler="_on_save_as_game_button_clicked" last_modification_time="Thu, 23 Nov 2006 05:02:45 GMT"/>
+		      <property name="label" translatable="yes">Claim _Draw</property>
+		      <property name="use_underline">True</property>
+		      <signal name="activate" handler="_on_claim_draw_clicked" last_modification_time="Sun, 20 Jan 2008 19:45:39 GMT"/>
+
+		      <child internal-child="image">
+			<widget class="GtkImage" id="image111">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-delete</property>
+			  <property name="icon_size">1</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+		      </child>
 		    </widget>
 		  </child>
 
@@ -140,7 +194,7 @@
 		      <accelerator key="F11" modifiers="0" signal="activate"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image76">
+			<widget class="GtkImage" id="image112">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-fullscreen</property>
 			  <property name="icon_size">1</property>
@@ -161,7 +215,7 @@
 		      <accelerator key="F11" modifiers="0" signal="activate"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image77">
+			<widget class="GtkImage" id="image113">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-leave-fullscreen</property>
 			  <property name="icon_size">1</property>
@@ -177,7 +231,7 @@
 		  <child>
 		    <widget class="GtkCheckMenuItem" id="menu_view_3d">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_3D</property>
+		      <property name="label" translatable="yes">3_D Chess View</property>
 		      <property name="use_underline">True</property>
 		      <property name="active">False</property>
 		      <signal name="activate" handler="_on_toggle_3d_clicked" last_modification_time="Thu, 14 Sep 2006 19:40:59 GMT"/>
@@ -185,55 +239,6 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkCheckMenuItem" id="menu_view_toolbar">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Toolbar</property>
-		      <property name="use_underline">True</property>
-		      <property name="active">True</property>
-		      <signal name="activate" handler="_on_show_toolbar_clicked" last_modification_time="Tue, 09 May 2006 20:08:09 GMT"/>
-		    </widget>
-		  </child>
-
-		  <child>
-		    <widget class="GtkCheckMenuItem" id="menu_view_history">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_History</property>
-		      <property name="use_underline">True</property>
-		      <property name="active">False</property>
-		      <signal name="activate" handler="_on_show_history_clicked" last_modification_time="Tue, 09 May 2006 20:08:09 GMT"/>
-		    </widget>
-		  </child>
-
-		  <child>
-		    <widget class="GtkCheckMenuItem" id="menu_view_move_hints">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Move _Hints</property>
-		      <property name="use_underline">True</property>
-		      <property name="active">False</property>
-		      <signal name="activate" handler="_on_toggle_move_hints_clicked" last_modification_time="Fri, 23 Feb 2007 14:02:01 GMT"/>
-		    </widget>
-		  </child>
-
-		  <child>
-		    <widget class="GtkCheckMenuItem" id="menu_view_comment">
-		      <property name="label" translatable="yes">Move _Comments</property>
-		      <property name="use_underline">True</property>
-		      <property name="active">False</property>
-		      <signal name="activate" handler="_on_menu_view_comment_clicked" last_modification_time="Sat, 12 May 2007 09:24:10 GMT"/>
-		    </widget>
-		  </child>
-
-		  <child>
-		    <widget class="GtkCheckMenuItem" id="menu_view_numbering">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Board _Numbering</property>
-		      <property name="use_underline">True</property>
-		      <property name="active">False</property>
-		      <signal name="activate" handler="_on_menu_view_numbering_clicked" last_modification_time="Wed, 16 May 2007 12:34:49 GMT"/>
-		    </widget>
-		  </child>
-
-		  <child>
 		    <widget class="GtkCheckMenuItem" id="menu_view_logs">
 		      <property name="visible">True</property>
 		      <property name="label" translatable="yes">Show _Logs</property>
@@ -242,154 +247,31 @@
 		      <signal name="activate" handler="_on_show_logs_clicked" last_modification_time="Sat, 01 Sep 2007 15:42:25 GMT"/>
 		    </widget>
 		  </child>
-
-		  <child>
-		    <widget class="GtkMenuItem" id="chess_board1">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Chess _Board</property>
-		      <property name="use_underline">True</property>
-		      <signal name="activate" handler="on_chess_board1_activate" last_modification_time="Sun, 18 Mar 2007 02:42:01 GMT"/>
-
-		      <child>
-			<widget class="GtkMenu" id="chess_board1_menu">
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="menu_side_white">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_White Side</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">False</property>
-			      <signal name="activate" handler="_on_board_view_changed" last_modification_time="Sun, 18 Mar 2007 02:42:01 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="menu_side_black">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Black Side</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">False</property>
-			      <property name="group">menu_side_white</property>
-			      <signal name="activate" handler="_on_board_view_changed" last_modification_time="Sun, 18 Mar 2007 02:42:01 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="menu_side_human">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Human Side</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">True</property>
-			      <property name="group">menu_side_white</property>
-			      <signal name="activate" handler="_on_board_view_changed" last_modification_time="Sun, 18 Mar 2007 02:42:01 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="menu_side_current">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Current Player</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">False</property>
-			      <property name="group">menu_side_white</property>
-			      <signal name="activate" handler="_on_board_view_changed" last_modification_time="Sun, 18 Mar 2007 02:42:01 GMT"/>
-			    </widget>
-			  </child>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
-
-		  <child>
-		    <widget class="GtkMenuItem" id="move_format1">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Move Format</property>
-		      <property name="use_underline">True</property>
-		      <signal name="activate" handler="on_move_format1_activate" last_modification_time="Sat, 10 Feb 2007 03:04:46 GMT"/>
-
-		      <child>
-			<widget class="GtkMenu" id="move_format1_menu">
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="menu_movef_human">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Human</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">True</property>
-			      <signal name="activate" handler="_on_menu_movef_human_activate" last_modification_time="Sat, 10 Feb 2007 03:06:49 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="menu_movef_lan">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Long Algebraic</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">False</property>
-			      <property name="group">menu_movef_human</property>
-			      <signal name="activate" handler="_on_menu_movef_lan_activate" last_modification_time="Sat, 10 Feb 2007 03:06:49 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="menu_movef_san">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Standard Algebraic</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">False</property>
-			      <property name="group">menu_movef_human</property>
-			      <signal name="activate" handler="_on_menu_movef_san_activate" last_modification_time="Sat, 10 Feb 2007 03:06:49 GMT"/>
-			    </widget>
-			  </child>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
 		</widget>
 	      </child>
 	    </widget>
 	  </child>
 
 	  <child>
-	    <widget class="GtkMenuItem" id="chess1">
+	    <widget class="GtkMenuItem" id="settings">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Chess</property>
+	      <property name="label" translatable="yes">_Settings</property>
 	      <property name="use_underline">True</property>
 
 	      <child>
-		<widget class="GtkMenu" id="chess1_menu">
-
-		  <child>
-		    <widget class="GtkImageMenuItem" id="undo_move1">
-		      <property name="label" translatable="yes">_Undo Move</property>
-		      <property name="use_underline">True</property>
-		      <signal name="activate" handler="_on_undo_move_clicked" last_modification_time="Sat, 06 Oct 2007 13:03:05 GMT"/>
-
-		      <child internal-child="image">
-			<widget class="GtkImage" id="image78">
-			  <property name="visible">True</property>
-			  <property name="stock">gtk-undo</property>
-			  <property name="icon_size">1</property>
-			  <property name="xalign">0.5</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">0</property>
-			  <property name="ypad">0</property>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
+		<widget class="GtkMenu" id="settings_menu">
 
 		  <child>
-		    <widget class="GtkImageMenuItem" id="menu_resign">
+		    <widget class="GtkImageMenuItem" id="preferences">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Resign</property>
+		      <property name="label" translatable="yes">_Preferences</property>
 		      <property name="use_underline">True</property>
-		      <signal name="activate" handler="_on_resign_clicked" last_modification_time="Sat, 06 Oct 2007 13:01:50 GMT"/>
+		      <signal name="activate" handler="_on_preferences_clicked" last_modification_time="Sun, 20 Jan 2008 17:28:02 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image79">
+			<widget class="GtkImage" id="image114">
 			  <property name="visible">True</property>
-			  <property name="stock">gtk-dialog-warning</property>
+			  <property name="stock">gtk-preferences</property>
 			  <property name="icon_size">1</property>
 			  <property name="xalign">0.5</property>
 			  <property name="yalign">0.5</property>
@@ -399,71 +281,6 @@
 		      </child>
 		    </widget>
 		  </child>
-
-		  <child>
-		    <widget class="GtkMenuItem" id="menu_claim_draw">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Claim _Draw</property>
-		      <property name="use_underline">True</property>
-		      <signal name="activate" handler="_on_claim_draw_clicked" last_modification_time="Sat, 06 Oct 2007 14:21:24 GMT"/>
-		    </widget>
-		  </child>
-
-		  <child>
-		    <widget class="GtkMenuItem" id="promotion_type1">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Promotion Type</property>
-		      <property name="use_underline">True</property>
-
-		      <child>
-			<widget class="GtkMenu" id="promotion_type1_menu">
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="promotion_queen_radio">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Queen</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">True</property>
-			      <signal name="activate" handler="_on_promotion_type_changed" last_modification_time="Tue, 13 Feb 2007 13:28:13 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="promotion_knight_radio">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Knight</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">False</property>
-			      <property name="group">promotion_queen_radio</property>
-			      <signal name="activate" handler="_on_promotion_type_changed" last_modification_time="Tue, 13 Feb 2007 13:28:13 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="promotion_rook_radio">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Rook</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">False</property>
-			      <property name="group">promotion_queen_radio</property>
-			      <signal name="activate" handler="_on_promotion_type_changed" last_modification_time="Tue, 13 Feb 2007 13:28:13 GMT"/>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkRadioMenuItem" id="promotion_bishop_radio">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Bishop</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">False</property>
-			      <property name="group">promotion_queen_radio</property>
-			      <signal name="activate" handler="_on_promotion_type_changed" last_modification_time="Tue, 13 Feb 2007 13:28:13 GMT"/>
-			    </widget>
-			  </child>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
 		</widget>
 	      </child>
 	    </widget>
@@ -485,7 +302,7 @@
 		      <signal name="activate" handler="_on_help_clicked" last_modification_time="Fri, 11 Aug 2006 12:43:28 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image80">
+			<widget class="GtkImage" id="image115">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-help</property>
 			  <property name="icon_size">1</property>
@@ -579,33 +396,6 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkToolButton" id="preferences_button">
-	      <property name="stock_id">gtk-preferences</property>
-	      <property name="visible_horizontal">True</property>
-	      <property name="visible_vertical">True</property>
-	      <property name="is_important">False</property>
-	      <signal name="clicked" handler="_on_preferences_button_clicked" last_modification_time="Sun, 15 Jan 2006 18:21:44 GMT"/>
-	    </widget>
-	    <packing>
-	      <property name="expand">False</property>
-	      <property name="homogeneous">True</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkSeparatorToolItem" id="separatortoolitem1">
-	      <property name="visible">True</property>
-	      <property name="draw">True</property>
-	      <property name="visible_horizontal">True</property>
-	      <property name="visible_vertical">True</property>
-	    </widget>
-	    <packing>
-	      <property name="expand">False</property>
-	      <property name="homogeneous">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
 	    <widget class="GtkToolButton" id="save_game_button">
 	      <property name="visible">True</property>
 	      <property name="sensitive">False</property>

Added: trunk/glchess/glade/preferences.glade
==============================================================================
--- (empty file)
+++ trunk/glchess/glade/preferences.glade	Sun Jan 20 20:35:01 2008
@@ -0,0 +1,397 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="preferences">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Preferences</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">True</property>
+  <property name="resizable">False</property>
+  <property name="destroy_with_parent">True</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog-action_area1">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+	  <child>
+	    <widget class="GtkButton" id="closebutton1">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-close</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-7</property>
+	      <signal name="clicked" handler="_on_response" last_modification_time="Sun, 20 Jan 2008 17:40:42 GMT"/>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkNotebook" id="notebook1">
+	  <property name="visible">True</property>
+	  <property name="can_focus">True</property>
+	  <property name="show_tabs">True</property>
+	  <property name="show_border">True</property>
+	  <property name="tab_pos">GTK_POS_TOP</property>
+	  <property name="scrollable">False</property>
+	  <property name="enable_popup">False</property>
+
+	  <child>
+	    <widget class="GtkTable" id="game_table">
+	      <property name="border_width">10</property>
+	      <property name="visible">True</property>
+	      <property name="n_rows">3</property>
+	      <property name="n_columns">2</property>
+	      <property name="homogeneous">True</property>
+	      <property name="row_spacing">5</property>
+	      <property name="column_spacing">5</property>
+
+	      <child>
+		<widget class="GtkLabel" id="board_label">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Board Orientation:</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">1</property>
+		  <property name="top_attach">0</property>
+		  <property name="bottom_attach">1</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options"></property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="format_label">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Move Format:</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">1</property>
+		  <property name="top_attach">1</property>
+		  <property name="bottom_attach">2</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options"></property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label5">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Promotion Type:</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">1</property>
+		  <property name="top_attach">2</property>
+		  <property name="bottom_attach">3</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options"></property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkComboBox" id="board_combo">
+		  <property name="visible">True</property>
+		  <property name="items" translatable="yes"></property>
+		  <property name="tooltip" translatable="yes">Choose the orientation of the chess board.</property>
+		  <property name="add_tearoffs">False</property>
+		  <property name="focus_on_click">True</property>
+		  <signal name="changed" handler="on_board_combo_changed" last_modification_time="Sun, 20 Jan 2008 12:51:36 GMT"/>
+		</widget>
+		<packing>
+		  <property name="left_attach">1</property>
+		  <property name="right_attach">2</property>
+		  <property name="top_attach">0</property>
+		  <property name="bottom_attach">1</property>
+		  <property name="y_options">fill</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkComboBox" id="move_format_combo">
+		  <property name="visible">True</property>
+		  <property name="items" translatable="yes"></property>
+		  <property name="tooltip" translatable="yes">Choose the move format for the game history panel.</property>
+		  <property name="add_tearoffs">False</property>
+		  <property name="focus_on_click">True</property>
+		  <signal name="changed" handler="on_move_format_combo_changed" last_modification_time="Sun, 20 Jan 2008 18:45:14 GMT"/>
+		</widget>
+		<packing>
+		  <property name="left_attach">1</property>
+		  <property name="right_attach">2</property>
+		  <property name="top_attach">1</property>
+		  <property name="bottom_attach">2</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options">fill</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkComboBox" id="promotion_type_combo">
+		  <property name="visible">True</property>
+		  <property name="items" translatable="yes"></property>
+		  <property name="tooltip" translatable="yes">Choose the transformation of a pawn that reaches the eighth rank.</property>
+		  <property name="add_tearoffs">False</property>
+		  <property name="focus_on_click">True</property>
+		  <signal name="changed" handler="on_promotion_type_combo_changed" last_modification_time="Sun, 20 Jan 2008 12:52:19 GMT"/>
+		</widget>
+		<packing>
+		  <property name="left_attach">1</property>
+		  <property name="right_attach">2</property>
+		  <property name="top_attach">2</property>
+		  <property name="bottom_attach">3</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options">fill</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="tab_expand">False</property>
+	      <property name="tab_fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="game_label">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">_Game</property>
+	      <property name="use_underline">True</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.469999998808</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="type">tab</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkVBox" id="view_box">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+	      <property name="border_width">10</property>
+
+	      <child>
+		<widget class="GtkCheckButton" id="show_3d">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">3_D Chess View</property>
+		  <property name="tooltip" translatable="yes">View the chess board by default in 2D mode, or optionally in 3D mode using OpenGL.</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		  <signal name="toggled" handler="on_3d_view_activate" last_modification_time="Sun, 20 Jan 2008 19:36:35 GMT"/>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="show_toolbar">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Show _Toolbar</property>
+		  <property name="tooltip" translatable="yes">Show or hide the toolbar</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		  <signal name="toggled" handler="on_show_toolbar_activate" last_modification_time="Sun, 20 Jan 2008 19:35:47 GMT"/>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="show_history">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Show _History</property>
+		  <property name="tooltip" translatable="yes">Show or hide the game history panel</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		  <signal name="toggled" handler="on_show_history_activate" last_modification_time="Sun, 20 Jan 2008 19:36:41 GMT"/>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="show_move_hints">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">_Move Hints</property>
+		  <property name="tooltip" translatable="yes">Shows hints during chess games</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		  <signal name="toggled" handler="on_move_hints_activate" last_modification_time="Sun, 20 Jan 2008 19:36:46 GMT"/>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="show_numbering">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">_Board Numbering</property>
+		  <property name="tooltip" translatable="yes">Show or hide numbering on the chess board</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		  <signal name="toggled" handler="on_board_numbering_activate" last_modification_time="Sun, 20 Jan 2008 19:36:51 GMT"/>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="tab_expand">False</property>
+	      <property name="tab_fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="view_label">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">_View</property>
+	      <property name="use_underline">True</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="type">tab</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>

Modified: trunk/glchess/src/lib/defaults.py.in
==============================================================================
--- trunk/glchess/src/lib/defaults.py.in	(original)
+++ trunk/glchess/src/lib/defaults.py.in	Sun Jan 20 20:35:01 2008
@@ -48,7 +48,8 @@
 DESCRIPTION   = _('The 2D/3D chess game for GNOME. \n\nglChess is a part of GNOME Games.')
 WEBSITE       = 'http://www.gnome.org/projects/gnome-games/'
 WEBSITE_LABEL = _('GNOME Games web site')
-AUTHORS       = ['Robert Ancell <bob27 users sourceforge net>']
+AUTHORS       = ['Robert Ancell <bob27 users sourceforge net>\n'
+		 'Andreas RÃsdal <andreasr gnome org>']
 ARTISTS       = ['John-Paul Gignac (3D Models)', 'Max Froumentin (2D Models)', 'Hylke Bons <h bons student rug nl> (icon)']
 
 # The GPL license string will be translated, and the game name inserted.

Modified: trunk/glchess/src/lib/gtkui/dialogs.py
==============================================================================
--- trunk/glchess/src/lib/gtkui/dialogs.py	(original)
+++ trunk/glchess/src/lib/gtkui/dialogs.py	Sun Jan 20 20:35:01 2008
@@ -557,3 +557,146 @@
 
         dialog.destroy()
 
+
+class GtkPreferencesDialog:
+    """
+    """    
+    # The main UI and the ???
+    __mainUI = None
+    __gui = None
+
+    __customName = False
+    __checking = False
+    
+    def __init__(self, mainUI, aiModel, game = None):
+        """Constructor for the preferences dialog.
+        
+        'mainUI' is the main UI.
+        'aiModel' is the AI models to use.
+        'game' is the game properties to use (ui.Game).
+        """
+        self.__mainUI = mainUI
+        self.game = game
+
+	# Load the UI
+        self.__gui = gtkui.loadGladeFile('preferences.glade', 'preferences')
+        self.__gui.signal_autoconnect(self)
+
+        # Load preferences for move_format
+        moveFormat = glchess.config.get('move_format')
+	moveModel = gtk.ListStore(str, str)
+        widget = self.__gui.get_widget('move_format_combo')
+        widget.set_model(moveModel)
+        move_formats = [('human', _('Human')),
+                        ('lan', _('Long Algebraic')),
+                        ('san', _('Standard Algebraic'))]
+        for (key, label) in move_formats:
+            iter = moveModel.append()
+            if key == moveFormat:
+              widget.set_active_iter(iter)
+            moveModel.set(iter, 0, label, 1, key)
+
+       # Load preferences for board orientation
+        boardView = glchess.config.get('board_view')
+	boardModel = gtk.ListStore(str, str)
+        widget = self.__gui.get_widget('board_combo')
+        widget.set_model(boardModel)
+        view_list = [('white', _('White Side')),
+                     ('black', _('Black Side')),
+                     ('human', _('Human Side')),
+		     ('current', _('Current Player'))]
+        for (key, label) in view_list:
+            iter = boardModel.append()
+            if key == boardView:
+              widget.set_active_iter(iter)
+            boardModel.set(iter, 0, label, 1, key)
+
+        # Load preferences for promotion type
+        promotionType = glchess.config.get('promotion_type')
+	promotionModel = gtk.ListStore(str, str)
+        widget = self.__gui.get_widget('promotion_type_combo')
+        widget.set_model(promotionModel)
+        promotion_list = [('queen', _('Queen')),
+                     ('knight', _('Knight')),
+                     ('rook', _('Rook')),
+		     ('bishop', _('Bishop'))]
+        for (key, label) in promotion_list:
+            iter = promotionModel.append()
+            if key == promotionType:
+              widget.set_active_iter(iter)
+            promotionModel.set(iter, 0, label, 1, key)
+
+	# Load preferences for View settings.
+        pref = glchess.config.get('show_3d')
+        widget = self.__gui.get_widget('show_3d')
+	widget.set_active(pref)
+
+        pref = glchess.config.get('show_toolbar')
+        widget = self.__gui.get_widget('show_toolbar')
+	widget.set_active(pref)
+
+        pref = glchess.config.get('show_history')
+        widget = self.__gui.get_widget('show_history')
+	widget.set_active(pref)
+
+        pref = glchess.config.get('show_move_hints')
+        widget = self.__gui.get_widget('show_move_hints')
+	widget.set_active(pref)
+
+        pref = glchess.config.get('show_numbering')
+        widget = self.__gui.get_widget('show_numbering')
+	widget.set_active(pref)
+
+	self.__gui.get_widget('preferences').show()
+
+
+    def _on_response(self, dialog):
+        """Gtk+ callback"""
+	self.__gui.get_widget('preferences').destroy()
+
+    def on_move_format_combo_changed(self, widget):
+        """Gtk+ callback"""
+        model = widget.get_model()
+        iter = widget.get_active_iter()
+        data = model.get(iter, 1)
+	if data[0] is not None:
+	  glchess.config.set('move_format', data[0])
+
+    def on_board_combo_changed(self, widget):
+        """Gtk+ callback"""
+        model = widget.get_model()
+        iter = widget.get_active_iter()
+        data = model.get(iter, 1)
+	if data[0] is not None:
+	  glchess.config.set('board_view', data[0])
+
+    def on_promotion_type_combo_changed(self, widget):
+        """Gtk+ callback"""
+        model = widget.get_model()
+        iter = widget.get_active_iter()
+        data = model.get(iter, 1)
+	if data[0] is not None:
+	  glchess.config.set('promotion_type', data[0])
+
+    def on_3d_view_activate(self, widget):
+        """Gtk+ callback"""
+	glchess.config.set('show_3d', widget.get_active())
+
+    def on_show_toolbar_activate(self, widget):
+        """Gtk+ callback"""
+	glchess.config.set('show_toolbar', widget.get_active())
+
+    def on_show_history_activate(self, widget):
+        """Gtk+ callback"""
+	glchess.config.set('show_history', widget.get_active())
+
+
+    def on_move_hints_activate(self, widget):
+        """Gtk+ callback"""
+	glchess.config.set('show_move_hints', widget.get_active())
+
+
+    def on_board_numbering_activate(self, widget):
+        """Gtk+ callback"""
+	glchess.config.set('show_numbering', widget.get_active())
+

Modified: trunk/glchess/src/lib/gtkui/gtkui.py
==============================================================================
--- trunk/glchess/src/lib/gtkui/gtkui.py	(original)
+++ trunk/glchess/src/lib/gtkui/gtkui.py	Sun Jan 20 20:35:01 2008
@@ -223,22 +223,6 @@
         # Workaround as Glade 2 always overrides the system style for toolbars
         self.__getWidget('toolbar').unset_style()
         
-        # Create mappings between the promotion radio buttons and the promotion types
-        self.__promotionTypeByRadio = {}
-        self.__promotionRadioByType = {}
-        for piece in ['queen', 'knight', 'rook', 'bishop']:
-            widget = self.__getWidget('promotion_%s_radio' % piece)
-            self.__promotionTypeByRadio[widget] = piece
-            self.__promotionRadioByType[piece] = widget
-
-        # Create mappings between the board view radio buttons and the config names
-        self.__boardViewRadioByType = {}
-        self.__boardViewTypeByRadio = {}
-        for name in ['white', 'black', 'human', 'current']:
-            widget = self.__getWidget('menu_side_%s' % name)
-            self.__boardViewTypeByRadio[widget] = name
-            self.__boardViewRadioByType[name] = widget
-
         # Create the model for the player types
         self.__playerModel = gtk.ListStore(str, str, str)
         iconTheme = gtk.icon_theme_get_default()
@@ -541,12 +525,9 @@
         # Show/hide the toolbar
         if name == 'show_toolbar':
             toolbar = self.__getWidget('toolbar')
-            menu = self.__getWidget('menu_view_toolbar')
             if value is True:
-                menu.set_active(True)
                 toolbar.show()
             else:
-                menu.set_active(False)
                 toolbar.hide()
                 
         elif name == 'enable_networking':
@@ -562,12 +543,9 @@
         # Show/hide the history
         elif name == 'show_history':
             box = self.__getWidget('navigation_box')
-            menu = self.__getWidget('menu_view_history')
             if value is True:
-                menu.set_active(True)
                 box.show()
             else:
-                menu.set_active(False)
                 box.hide()
                 
         # Maximised mode
@@ -608,40 +586,23 @@
             self.view.viewWidget.setRenderGL(self.__renderGL)
                 
         elif name == 'show_comments':
-            menuItem = self.__getWidget('menu_view_comment')
-            menuItem.set_active(value)
             self.view.setShowComments(value)
 
         elif name == 'show_move_hints':
-            menuItem = self.__getWidget('menu_view_move_hints')
-            menuItem.set_active(value)
             self.view.feedback.showMoveHints(value)
 
         elif name == 'show_numbering':
-            menuItem = self.__getWidget('menu_view_numbering')
-            menuItem.set_active(value)
             self.view.feedback.showBoardNumbering(value)
 
         elif name == 'move_format':
-            self._gui.get_widget('menu_movef_%s' % value).set_active(True)
             self.view.setMoveFormat(value)
                 
         elif name == 'promotion_type':
-            try:
-                radio = self.__promotionRadioByType[value]
-            except KeyError:
-                glchess.config.default('promotion_type')
-            else:
-                radio.set_active(True)
-                
+            pass
+    
         elif name == 'board_view':
-            try:
-                radio = self.__boardViewRadioByType[value]
-            except KeyError:
-                glchess.config.default('board_view')
-            else:
-                radio.set_active(True)
-                
+            pass
+
         else:
             assert(False), 'Unknown config item: %s' % name
 
@@ -873,8 +834,8 @@
         self.__getWidget('navigation_box').set_sensitive(enable)
         
         enable = enable and self.view.gameResult is None
-        for widget in ('menu_resign', 'resign_button', 'menu_claim_draw'):
-            self.__getWidget(widget).set_sensitive(enable)
+        '''FIXME! for widget in ('menu_resign', 'resign_button', 'menu_claim_draw'):
+            self.__getWidget(widget).set_sensitive(enable)'''
 
     def _on_new_game_button_clicked(self, widget):
         """Gtk+ callback"""
@@ -908,6 +869,10 @@
         """Gtk+ callback"""
         self.view.feedback.claimDraw()
 
+    def _on_preferences_clicked(self, widget):
+        """Gtk+ callback"""
+        dialogs.GtkPreferencesDialog(self, self.__playerModel)
+
     def _on_help_clicked(self, widget):
         """Gtk+ callback"""
         try:



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