[caribou/introspection: 4/10] GTK 3 adjustments



commit d7f1239d4ce825a9d30a3eb19dfe3fe7db742cb8
Author: Eitan Isaacson <eitan monotonous org>
Date:   Wed Dec 29 17:01:50 2010 -0800

    GTK 3 adjustments

 caribou/ui/preferences_window.py |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/caribou/ui/preferences_window.py b/caribou/ui/preferences_window.py
index 69ce8b1..0158ffb 100644
--- a/caribou/ui/preferences_window.py
+++ b/caribou/ui/preferences_window.py
@@ -145,8 +145,8 @@ class PreferencesWindow(Gtk.Dialog):
                 for string, localized in setting.allowed:
                     radios.append(Gtk.RadioButton.new_with_label(
                             [], localized))
-                for radio in radios:
-                    radio.set_group(radios)
+                for radio in radios[1:]:
+                    radio.join_group(radios[0])
 
                 hid = setting.connect(
                     'value-changed',
@@ -171,13 +171,11 @@ class PreferencesWindow(Gtk.Dialog):
                         r += 1
 
             elif setting.entry_type == ENTRY_COMBO or setting.allowed:
-                control = Gtk.ComboBox.new_text()
+                control = Gtk.ComboBoxText.new()
                 for option in setting.allowed:
-                    control.append_text(option[1])
-                control.set_active(
-                    [a for a, b in setting.allowed].index(setting.value))
-                value_changed_cb = lambda s, v, w: w.set_active(
-                    [a for a, b in s.allowed].index(v))
+                    control.append(option[0], option[1])
+                control.set_active_id(setting.value)
+                value_changed_cb = lambda s, v, w: w.set_active_id(v)
                 control_changed_cb = self._combo_changed_cb
                 control_changed_signal = 'changed'
             else:
@@ -247,7 +245,7 @@ class PreferencesWindow(Gtk.Dialog):
         self._update_setting(setting, entry.get_text(), handler_id)
 
     def _combo_changed_cb(self, combo, setting, handler_id):
-        self._update_setting(setting, setting.allowed[combo.get_active()][0],
+        self._update_setting(setting, combo.get_active_id(),
                              handler_id)
 
 if __name__ == "__main__":



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