Commit cfd6be81 authored by John Stowers's avatar John Stowers

First Cut

parent abff8745
......@@ -10,7 +10,7 @@ from gtweak.gconf import GConfSetting
from gtweak.gsettings import GSettingsSetting
from gtweak.gshellwrapper import GnomeShell
from gtweak.tweakmodel import Tweak, TweakGroup
from gtweak.widgets import build_label_beside_widget, build_combo_box_text, build_horizontal_sizegroup
from gtweak.widgets import GSettingsComboEnumTweak, build_label_beside_widget, build_combo_box_text, build_horizontal_sizegroup
class ShowWindowButtons(Tweak):
def __init__(self, **options):
......@@ -144,11 +144,14 @@ class ThemeInstaller(Tweak):
self._settings.set_value(ThemeInstaller.THEME_GSETTINGS_NAME, "")
self._shell_reload_theme()
sg = build_horizontal_sizegroup()
TWEAK_GROUPS = (
TweakGroup(
"Shell",
ShowWindowButtons(size_group=sg),
ThemeInstaller(size_group=sg)),
ThemeInstaller(size_group=sg),
GSettingsComboEnumTweak("org.gnome.settings-daemon.plugins.power", "lid-close-battery-action", size_group=sg)),
)
......@@ -37,6 +37,8 @@ def build_horizontal_sizegroup():
class _GSettingsTweak(Tweak):
def __init__(self, schema_name, key_name, **options):
self.schema_name = schema_name
self.key_name = key_name
self.settings = GSettingsSetting(schema_name)
Tweak.__init__(self,
self.settings.schema_get_summary(key_name),
......@@ -73,3 +75,30 @@ class GSettingsRangeTweak(_GSettingsTweak):
self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
self.widget_for_size_group = w
class GSettingsComboEnumTweak(_GSettingsTweak):
def __init__(self, schema_name, key_name, **options):
_GSettingsTweak.__init__(self, schema_name, key_name, **options)
_type, values = self.settings.get_range(key_name)
value = self.settings.get_string(key_name)
self.settings.connect('changed::'+self.key_name, self._on_setting_changed)
w = build_combo_box_text(value, *[(v,v) for v in values])
w.connect('changed', self._on_combo_changed)
self.combo = w
self.widget = build_label_beside_widget(self.settings.schema_get_summary(key_name), w)
self.widget_for_size_group = w
def _values_are_different(self, combo):
#to stop bouncing back and forth between changed signals
return self.settings.get_string(self.key_name) != \
combo.get_model().get_value(combo.get_active_iter(), 0)
def _on_setting_changed(self, setting, key):
print "%s SETTING CHANGED: %s" % (key, self.setting.get_string(key))
def _on_combo_changed(self, combo):
print "COMBO CHANGED", combo.get_model().get_value(combo.get_active_iter(), 0)
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