[gnome-chess/chess-telepathy-networking-support-664946-rebase: 39/64] [glchess-game-window] Assign model to history_combo in code



commit 1dfd32bda2168379ae36a65c481c35dd7c82ba58
Author: Chandni Verma <chandniverma2112 gmail com>
Date:   Sat Sep 8 03:03:04 2012 +0530

    [glchess-game-window] Assign model to history_combo in code

 data/gnome-chess-game-window.ui  |    9 ---------
 src/gnome-chess-application.vala |    5 +++++
 2 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/data/gnome-chess-game-window.ui b/data/gnome-chess-game-window.ui
index 3829f57..f4271f6 100644
--- a/data/gnome-chess-game-window.ui
+++ b/data/gnome-chess-game-window.ui
@@ -7,14 +7,6 @@
     <property name="stock">gtk-help</property>
     <property name="icon-size">1</property>
   </object>
-  <object class="GtkListStore" id="history_model">
-    <columns>
-      <!-- column-name label -->
-      <column type="gchararray"/>
-      <!-- column-name move-number -->
-      <column type="gint"/>
-    </columns>
-  </object>
   <object class="GtkImage" id="undo_move_image">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -429,7 +421,6 @@
                   <object class="GtkComboBox" id="history_combo">
                     <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>
diff --git a/src/gnome-chess-application.vala b/src/gnome-chess-application.vala
index 33362d9..a6b7e04 100644
--- a/src/gnome-chess-application.vala
+++ b/src/gnome-chess-application.vala
@@ -146,7 +146,12 @@ public class Application : Gtk.Application
         prev_move_button = (Gtk.Widget) builder.get_object ("prev_move_button");
         next_move_button = (Gtk.Widget) builder.get_object ("next_move_button");
         last_move_button = (Gtk.Widget) builder.get_object ("last_move_button");
+
         history_combo = (Gtk.ComboBox) builder.get_object ("history_combo");
+        /* Assign a model here instead of loading from ui */
+        var history_model = new Gtk.ListStore (2, typeof (string), typeof (int));
+        history_combo.set_model (history_model);
+
         white_time_label = (Gtk.Widget) builder.get_object ("white_time_label");
         black_time_label = (Gtk.Widget) builder.get_object ("black_time_label");
         settings.bind ("show-toolbar", builder.get_object ("toolbar"), "visible", SettingsBindFlags.DEFAULT);



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