[caribou] Use glade to make the combo box



commit 6738e515c99e11a97726bc4294f9e7d8ba63aa4e
Author: Ben Konrath <ben bagu org>
Date:   Mon Feb 22 11:54:38 2010 -0600

    Use glade to make the combo box

 src/caribou/caribou-prefs.ui |   13 +++++++++++++
 src/caribou/keyboard.py      |    9 +--------
 2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/caribou/caribou-prefs.ui b/src/caribou/caribou-prefs.ui
index c025447..40d100e 100644
--- a/src/caribou/caribou-prefs.ui
+++ b/src/caribou/caribou-prefs.ui
@@ -36,9 +36,16 @@
                     <child>
                       <object class="GtkComboBox" id="combobox_layout">
                         <property name="visible">True</property>
+                        <property name="model">liststore1</property>
                         <accessibility>
                           <relation type="labelled-by" target="label_layout"/>
                         </accessibility>
+                        <child>
+                          <object class="GtkCellRendererCombo" id="cellrenderertext1"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
@@ -220,4 +227,10 @@
       <action-widget response="0">button_close</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkListStore" id="liststore1">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
 </interface>
diff --git a/src/caribou/keyboard.py b/src/caribou/keyboard.py
index 6329adb..e4999c8 100644
--- a/src/caribou/keyboard.py
+++ b/src/caribou/keyboard.py
@@ -47,13 +47,6 @@ class KeyboardPreferences:
 
         layout_combo = builder.get_object("combobox_layout")
         layout_combo.connect("changed", self._on_layout_changed, client)
-        # we can't use gtk.combo_box_new_text() with glade
-        # we have to manually set up a simple combobox
-        liststore = gtk.ListStore(gobject.TYPE_STRING)
-        layout_combo.set_model(liststore)
-        cell = gtk.CellRendererText()
-        layout_combo.pack_start(cell, True)
-        layout_combo.add_attribute(cell, 'text', 0)
 
         for kbddef in keyboards.kbds:
             layout_combo.append_text(kbddef)
@@ -190,7 +183,7 @@ class CaribouKeyboard(gtk.Frame):
         self.show_all()
 
     def get_layout(self):
-        return self._kbd_name()
+        return self._kbd_name
 
 
 



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