[gnome-tweak-tool] convert tweaks to gtk widgets



commit 73067b11bf8bb153a82f1aafdbfd21fd035c1510
Author: John Stowers <john stowers gmail com>
Date:   Sun Aug 4 23:32:49 2013 +0200

    convert tweaks to gtk widgets

 gtweak/tweaks/tweak_legacy.py |    5 +++--
 gtweak/tweaks/tweak_test.py   |   21 +++++++++++++--------
 2 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_legacy.py b/gtweak/tweaks/tweak_legacy.py
index bd9af6e..4ae9f3e 100644
--- a/gtweak/tweaks/tweak_legacy.py
+++ b/gtweak/tweaks/tweak_legacy.py
@@ -28,12 +28,13 @@ from gtweak.gsettings import GSettingsSetting, GSettingsMissingError, GSettingsF
 _shell = GnomeShellFactory().get_shell()
 _shell_loaded = _shell is not None
 
-class _XkbOption(Tweak):
+class _XkbOption(Gtk.Box, Tweak):
     def __init__(self, group_id, parent_settings, xkb_info, **options):
         try:
             desc = xkb_info.description_for_group(group_id)
         except AttributeError:
             desc = group_id
+        Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
         Tweak.__init__(self, desc, desc, **options)
 
         self._group_id = group_id
@@ -61,7 +62,7 @@ class _XkbOption(Tweak):
         self._combo.add_attribute(renderer, "text", 1)
         self._combo_changed_handler_id = self._combo.connect("changed", self._on_combo_changed)
 
-        self.widget = build_label_beside_widget(self.name, self._combo)
+        build_label_beside_widget(self.name, self._combo, hbox=self)
         self.widget_for_size_group = self._combo
 
         self.reload()
diff --git a/gtweak/tweaks/tweak_test.py b/gtweak/tweaks/tweak_test.py
index df6075b..afcb0c2 100644
--- a/gtweak/tweaks/tweak_test.py
+++ b/gtweak/tweaks/tweak_test.py
@@ -22,26 +22,31 @@ from gi.repository import Gtk
 from gtweak.tweakmodel import Tweak, TweakGroup
 from gtweak.widgets import build_label_beside_widget
 
-class _TestInfoTweak(Tweak):
+class _TestInfoTweak(Gtk.Box, Tweak):
     def __init__(self, name, description, **options):
+        Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
         Tweak.__init__(self, name, description, **options)
 
-        self.widget = build_label_beside_widget(
+        build_label_beside_widget(
                         name,
                         Gtk.Button(options.get("_test_button_name",name)),
                         info=options.get("_tweak_info"),
-                        warning=options.get("_tweak_warning"))
+                        warning=options.get("_tweak_warning"),
+                        hbox=self)
 
-class _TestTweak(Tweak):
+class _TestTweak(Gtk.Box, Tweak):
     def __init__(self, name, description, **options):
+        Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
         Tweak.__init__(self, name, description, **options)
-        self.widget = Gtk.Label("... " + name + " ...")
+        self.add(Gtk.Label("... " + name + " ..."))
 
-class _TestButtonTweak(Tweak):
+class _TestButtonTweak(Gtk.Box, Tweak):
     def __init__(self, name, description, **options):
+        Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
         Tweak.__init__(self, name, description, **options)
-        self.widget = Gtk.Button(name)
-        self.widget.connect("clicked", self._on_click)
+        widget = Gtk.Button(name)
+        widget.connect("clicked", self._on_click)
+        self.add(widget)
         self._need_action = options.get("_need_action")
         self._action_error = options.get("_action_error")
         self._need_logout = options.get("_need_logout")


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