[gnome-chess/chess-telepathy-networking-support-664946-rebase: 10/64] [glchess] Remove redundant settings from preferences dialog



commit 385203d541d2593cd2f88f1bd6fc7b776fc9ee40
Author: Chandni Verma <chandniverma2112 gmail com>
Date:   Wed Aug 8 12:57:58 2012 +0530

    [glchess] Remove redundant settings from preferences dialog

 data/preferences.ui  |  412 ++++----------------------------------------------
 src/gnome-chess.vala |   60 --------
 2 files changed, 27 insertions(+), 445 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index 830bc5c..34277f5 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkDialog" id="preferences">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes" comments="Title for preferences dialog">Preferences</property>
@@ -13,6 +13,7 @@
       <object class="GtkBox" id="dialog-vbox1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="visible">True</property>
@@ -21,6 +22,7 @@
             <child>
               <object class="GtkButton" id="closebutton1">
                 <property name="label">gtk-close</property>
+                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
@@ -43,266 +45,21 @@
           </packing>
         </child>
         <child>
-          <object class="GtkNotebook" id="notebook1">
+          <object class="GtkBox" id="box1">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="border_width">5</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
             <child>
-              <object class="GtkTable" id="game_table1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="border_width">10</property>
-                <property name="n_rows">6</property>
-                <property name="n_columns">2</property>
-                <property name="column_spacing">5</property>
-                <property name="row_spacing">5</property>
-                <child>
-                  <object class="GtkLabel" id="side_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Preferences Dialog: Label before player side (white/black) combo box">Play as:</property>
-                  </object>
-                  <packing>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="opposing_player_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Preferences Dialog: Label before opposing player combo box">Opposing Player:</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Preferences Dialog: Label before promotion type combo box">Difficulty:</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBox" id="side_combo">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="model">side_model</property>
-                    <signal name="changed" handler="side_combo_changed_cb" swapped="no"/>
-                    <child>
-                      <object class="GtkCellRendererText" id="side_cellrenderer"/>
-                      <attributes>
-                        <attribute name="text">0</attribute>
-                      </attributes>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="y_options">GTK_FILL</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBox" id="opponent_combo">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="model">opponent_model</property>
-                    <signal name="changed" handler="opponent_combo_changed_cb" swapped="no"/>
-                    <child>
-                      <object class="GtkCellRendererText" id="opponent_cellrenderer"/>
-                      <attributes>
-                        <attribute name="text">0</attribute>
-                      </attributes>
-                    </child>
-                  </object>
-                  <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">GTK_FILL</property>
-                    <property name="y_options">GTK_FILL</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBox" id="difficulty_combo">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="model">difficulty_model</property>
-                    <signal name="changed" handler="difficulty_combo_changed_cb" swapped="no"/>
-                    <child>
-                      <object class="GtkCellRendererText" id="difficulty_cellrenderer"/>
-                      <attributes>
-                        <attribute name="text">0</attribute>
-                      </attributes>
-                    </child>
-                  </object>
-                  <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">GTK_FILL</property>
-                    <property name="y_options">GTK_FILL</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkAlignment" id="custom_duration_box">
-                    <property name="can_focus">False</property>
-                    <property name="left_padding">18</property>
-                    <child>
-                      <object class="GtkHBox" id="hbox22">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
-                        <child>
-                          <object class="GtkSpinButton" id="custom_duration_spin">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="invisible_char">â</property>
-                            <property name="adjustment">duration_adjustment</property>
-                            <property name="climb_rate">1</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkComboBox" id="custom_duration_units_combo">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="model">custom_duration_units_model</property>
-                            <signal name="changed" handler="duration_units_changed_cb" swapped="no"/>
-                            <child>
-                              <object class="GtkCellRendererText" id="custom_duration_units_cellrenderer"/>
-                              <attributes>
-                                <attribute name="text">0</attribute>
-                              </attributes>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options">GTK_FILL</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label3">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="New Game Dialog: Label before game timer settings">Game Duration:</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">duration_combo</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBox" id="duration_combo">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="model">duration_model</property>
-                    <signal name="changed" handler="duration_combo_changed_cb" swapped="no"/>
-                    <child>
-                      <object class="GtkCellRendererText" id="duration_cellrenderer"/>
-                      <attributes>
-                        <attribute name="text">0</attribute>
-                      </attributes>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                    <property name="y_options">GTK_FILL</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkHBox" id="hbox2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">5</property>
-                    <child>
-                      <object class="GtkImage" id="image1">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="stock">gtk-dialog-info</property>
-                        <property name="icon-size">6</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label4">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes" comments="Preferences dialog: Label to notify user that the settings are applied for the next game">Changes will take effect for the next game.</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">5</property>
-                    <property name="bottom_attach">6</property>
-                    <property name="y_options">GTK_FILL</property>
-                  </packing>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-              </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label1">
+              <object class="GtkLabel" id="view_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes" comments="Preferences Dialog: Tab title for game preferences">Game</property>
+                <property name="label" translatable="yes" comments="Preferences Dialog: Title of appearance options tab">_Appearance</property>
+                <property name="use_underline">True</property>
               </object>
               <packing>
-                <property name="tab_fill">False</property>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
@@ -321,11 +78,13 @@
                     <child>
                       <object class="GtkCheckButton" id="show_3d_check">
                         <property name="label" translatable="yes" comments="Preferences Dialog: Check box for selecting if 3D view is available">3_D Chess View</property>
+                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
                         <signal name="toggled" handler="show_3d_toggle_cb" swapped="no"/>
                       </object>
@@ -354,12 +113,14 @@
                         <child>
                           <object class="GtkCheckButton" id="show_3d_smooth_check">
                             <property name="label" translatable="yes" comments="Preferences Dialog: Check box for selecting if the 3D view is smoothed (anti-aliased)">_Smooth Display</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="sensitive">False</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
                             <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
@@ -422,11 +183,13 @@
                     <child>
                       <object class="GtkCheckButton" id="show_toolbar_check">
                         <property name="label" translatable="yes" comments="Preferences Dialog: Check box for selecting if toolbar is visible">Show _Toolbar</property>
+                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
@@ -438,11 +201,13 @@
                     <child>
                       <object class="GtkCheckButton" id="show_history_check">
                         <property name="label" translatable="yes" comments="Preferences Dialog: Check box for selecting if history browser is visible">Show _History</property>
+                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
@@ -454,11 +219,13 @@
                     <child>
                       <object class="GtkCheckButton" id="show_move_hints_check">
                         <property name="label" translatable="yes" comments="Preferences Dialog: Check box for selecting if move hints are visible">_Move Hints</property>
+                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
@@ -470,11 +237,13 @@
                     <child>
                       <object class="GtkCheckButton" id="show_numbering_check">
                         <property name="label" translatable="yes" comments="Preferences Dialog: Check box for selecting if board numbering is visible">_Board Numbering</property>
+                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
@@ -559,26 +328,16 @@
                 </child>
               </object>
               <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
-            <child type="tab">
-              <object class="GtkLabel" id="view_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes" comments="Preferences Dialog: Title of appearance options tab">_Appearance</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="position">1</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
@@ -587,109 +346,6 @@
       <action-widget response="-7">closebutton1</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkListStore" id="side_model">
-    <columns>
-      <!-- column-name label -->
-      <column type="gchararray"/>
-      <!-- column-name play-as-white -->
-      <column type="gboolean"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes" context="chess-player" comments="Preferences Dialog: Combo box entry for playing as white">White</col>
-        <col id="1">True</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" context="chess-player" comments="Preferences Dialog: Combo box entry for playing as black">Black</col>
-        <col id="1">False</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkListStore" id="custom_duration_units_model">
-    <columns>
-      <!-- column-name label -->
-      <column type="gchararray"/>
-      <!-- column-name multiplier -->
-      <column type="gint"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0">seconds</col>
-        <col id="1">1</col>
-      </row>
-      <row>
-        <col id="0">minutes</col>
-        <col id="1">60</col>
-      </row>
-      <row>
-        <col id="0">hours</col>
-        <col id="1">3600</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkListStore" id="difficulty_model">
-    <columns>
-      <!-- column-name label -->
-      <column type="gchararray"/>
-      <!-- column-name difficulty -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes" context="difficulty" comments="Preferences Dialog: Combo box entry for easy game difficulty">Easy</col>
-        <col id="1">easy</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" context="difficulty" comments="Preferences Dialog: Combo box entry for normal game difficulty">Normal</col>
-        <col id="1">normal</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" context="difficulty" comments="Preferences Dialog: Combo box entry for hard game difficulty">Hard</col>
-        <col id="1">hard</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkAdjustment" id="duration_adjustment">
-    <property name="lower">1</property>
-    <property name="upper">86400</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-    <signal name="value-changed" handler="duration_changed_cb" swapped="no"/>
-  </object>
-  <object class="GtkListStore" id="duration_model">
-    <columns>
-      <!-- column-name label -->
-      <column type="gchararray"/>
-      <!-- column-name duration -->
-      <column type="gint"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes" comments="Preferences Dialog: Combo box entry for no game timer">No limit</col>
-        <col id="1">0</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" comments="Preferences Dialog: Combo box entry for game timer of one minute">One minute</col>
-        <col id="1">60</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" comments="Preferences Dialog: Combo box entry for game timer of five minutes">Five minutes</col>
-        <col id="1">300</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" comments="Preferences Dialog: Combo box entry for game timer of thirty minutes">30 minutes</col>
-        <col id="1">1800</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" comments="Preferences Dialog: Combo box entry for game timer of one hour">One hour</col>
-        <col id="1">3600</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" comments="Preferences Dialog: Combo box entry for custom game timer">Custom</col>
-        <col id="1">-1</col>
-      </row>
-    </data>
-  </object>
   <object class="GtkListStore" id="move_format_model">
     <columns>
       <!-- column-name label -->
@@ -716,20 +372,6 @@
       </row>
     </data>
   </object>
-  <object class="GtkListStore" id="opponent_model">
-    <columns>
-      <!-- column-name label -->
-      <column type="gchararray"/>
-      <!-- column-name opposing-player -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes" context="chess-opponent" comments="Preferences Dialog: Combo box entry for human opponent">Human</col>
-        <col id="1">human</col>
-      </row>
-    </data>
-  </object>
   <object class="GtkListStore" id="orientation_model">
     <columns>
       <!-- column-name label -->
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index c85340f..7cbeb2a 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -1622,33 +1622,6 @@ public class Application : Gtk.Application
         settings.bind ("show-3d-smooth", preferences_builder.get_object ("show_3d_smooth_check"),
                        "active", SettingsBindFlags.DEFAULT);
 
-        var side_combo = (Gtk.ComboBox) preferences_builder.get_object ("side_combo");
-        side_combo.set_active (settings.get_boolean ("play-as-white") ? 0 : 1);
-
-        var ai_combo = (Gtk.ComboBox) preferences_builder.get_object ("opponent_combo");
-        var ai_model = (Gtk.ListStore) ai_combo.model;
-        var opponent_name = settings.get_string ("opponent");
-        if (opponent_name == "human")
-            ai_combo.set_active (0);
-        foreach (var p in ai_profiles)
-        {
-            Gtk.TreeIter iter;
-            ai_model.append (out iter);
-            ai_model.set (iter, 0, p.name, 1, p.name, -1);
-            if (p.name == opponent_name || (opponent_name == "" && ai_combo.get_active () == -1))
-                ai_combo.set_active_iter (iter);
-        }
-        settings.bind ("show-history", ai_combo, "visible", SettingsBindFlags.SET);
-
-        var difficulty_combo = (Gtk.ComboBox) preferences_builder.get_object ("difficulty_combo");
-        set_combo (difficulty_combo, 1, settings.get_string ("difficulty"));
-
-        duration_combo = (Gtk.ComboBox) preferences_builder.get_object ("duration_combo");
-        duration_adjustment = (Gtk.Adjustment) preferences_builder.get_object ("duration_adjustment");
-        custom_duration_box = (Gtk.Container) preferences_builder.get_object ("custom_duration_box");
-        custom_duration_units_combo = (Gtk.ComboBox) preferences_builder.get_object ("custom_duration_units_combo");
-        set_duration (settings.get_int ("duration"));
-
         var orientation_combo = (Gtk.ComboBox) preferences_builder.get_object ("orientation_combo");
         set_combo (orientation_combo, 1, settings.get_string ("board-side"));
 
@@ -1691,39 +1664,6 @@ public class Application : Gtk.Application
         return value;
     }
 
-    [CCode (cname = "G_MODULE_EXPORT side_combo_changed_cb", instance_pos = -1)]
-    public void side_combo_changed_cb (Gtk.ComboBox combo)
-    {
-        Gtk.TreeIter iter;
-        if (!combo.get_active_iter (out iter))
-            return;
-        bool play_as_white;
-        combo.model.get (iter, 1, out play_as_white, -1);
-        settings.set_boolean ("play-as-white", play_as_white);
-    }
-
-    [CCode (cname = "G_MODULE_EXPORT opponent_combo_changed_cb", instance_pos = -1)]
-    public void opponent_combo_changed_cb (Gtk.ComboBox combo)
-    {
-        Gtk.TreeIter iter;
-        if (!combo.get_active_iter (out iter))
-            return;
-        string opponent;
-        combo.model.get (iter, 1, out opponent, -1);
-        settings.set_string ("opponent", opponent);
-    }
-
-    [CCode (cname = "G_MODULE_EXPORT difficulty_combo_changed_cb", instance_pos = -1)]
-    public void difficulty_combo_changed_cb (Gtk.ComboBox combo)
-    {
-        Gtk.TreeIter iter;
-        if (!combo.get_active_iter (out iter))
-            return;
-        string difficulty;
-        combo.model.get (iter, 1, out difficulty, -1);
-        settings.set_string ("difficulty", difficulty);
-    }
-
     private void set_duration (int duration, bool simplify = true)
     {
         var model = custom_duration_units_combo.model;



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