Commit 9594c231 authored by John Stowers's avatar John Stowers

Refactor and add interface tweaks

parent 64d25f0a
from gi.repository import Gtk
from gtweak.tweakmodel import TweakGroup
from gtweak.widgets import GSettingsSwitchTweak
TWEAK_GROUPS = (
TweakGroup(
"Interface",
GSettingsSwitchTweak("org.gnome.desktop.interface", "menus-have-icons"),
GSettingsSwitchTweak("org.gnome.desktop.interface", "buttons-have-icons")),
)
from gi.repository import Gtk
from gtweak.gsettings import GSettingsSetting
from gtweak.tweakmodel import Tweak, TweakGroup
from gtweak.widgets import GSettingsSwitch
class GSettingsSwitchTweak(Tweak):
def __init__(self, schema_name, key_name):
settings = GSettingsSetting(schema_name)
Tweak.__init__(self, settings.schema_get_summary(key_name), settings.schema_get_description(key_name))
self.widget = GSettingsSwitch(settings, key_name)
from gtweak.tweakmodel import TweakGroup
from gtweak.widgets import GSettingsSwitchTweak
TWEAK_GROUPS = (
TweakGroup(
......
......@@ -4,12 +4,6 @@ from gtweak.gconf import GConfSetting
from gtweak.tweakmodel import Tweak, TweakGroup
from gtweak.widgets import build_label_beside_widget, build_combo_box_text
#class GSettingsSwitchTweak(Tweak):
# def __init__(self, schema_name, key_name):
# settings = GSettingsSetting(schema_name)
# Tweak.__init__(self, settings.schema_get_summary(key_name), settings.schema_get_description(key_name))
# self.widget = TweakSwitch(settings, key_name)
class ShowWindowButtons(Tweak):
def __init__(self):
Tweak.__init__(self, "Window buttons", "Should the maximize and minimize buttons be shown")
......
from gi.repository import Gtk, Gio
from gtweak.tweakmodel import Tweak
from gtweak.gsettings import GSettingsSetting
def build_label_beside_widget(txt, widget, hbox=None):
if not hbox:
hbox = Gtk.HBox()
......@@ -33,10 +36,15 @@ class GSettingsSwitch(Gtk.HBox):
self._settings = settings
self._sw = Gtk.Switch()
build_label_beside_widget(self._settings.schema_get_summary(key), self._sw, self)
self._settings.bind(key, self._sw, "active", Gio.SettingsBindFlags.DEFAULT)
build_label_beside_widget(self._settings.schema_get_summary(key), self._sw, self)
self.show_all()
class GSettingsSwitchTweak(Tweak):
def __init__(self, schema_name, key_name):
settings = GSettingsSetting(schema_name)
Tweak.__init__(self, settings.schema_get_summary(key_name), settings.schema_get_description(key_name))
self.widget = GSettingsSwitch(settings, key_name)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment