Commit 7773cc5a authored by John Stowers's avatar John Stowers

tweak nautilus kind of

parent 97e348f2
......@@ -24,7 +24,7 @@ class _GSettingsSchema:
class GSettingsSetting:
def __init__(self, schema_name):
self._settings = Gio.Settings(schema_name)
self.gsettings = Gio.Settings(schema_name)
self._schema = _GSettingsSchema(schema_name)
def get_summary(self, key):
......@@ -34,10 +34,10 @@ class GSettingsSetting:
return self._schema._schema[key]["description"]
def get_value(self, key):
return self._settings[key]
return self.gsettings[key]
def get_all(self, key):
return dict(key=key, value=self._settings[key], **self._schema._schema[key])
return dict(key=key, value=self.gsettings[key], **self._schema._schema[key])
if __name__ == "__main__":
setting = GSettingsSetting("org.gnome.desktop.background")
......
from gi.repository import Gtk
from gtweak.gsettings import GSettingsSetting
from gtweak.tweakmodel import Tweak, TweakGroup
from gtweak.widgets import TweakSwitch
class GSettingsSwitchTweak(Tweak):
def __init__(self, schema_name, key_name):
settings = GSettingsSetting(schema_name)
Tweak.__init__(self, settings.get_summary(key_name), settings.get_description(key_name))
self.widget = TweakSwitch(settings, key_name)
TWEAK_GROUPS = (
TweakGroup(
"Nautilus",
GSettingsSwitchTweak("org.gnome.desktop.background", "show-desktop-icons"),
GSettingsSwitchTweak("org.gnome.desktop.background", "draw-background")),
)
from gi.repository import Gtk, Gio
class TweakSwitch(Gtk.HBox):
def __init__(self, settings, key):
Gtk.HBox.__init__(self)
self._settings = settings
lbl = Gtk.Label(self._settings.get_summary(key))
self.pack_start(lbl, False, False, 0)
self._sw = Gtk.Switch()
self.pack_start(self._sw, False, False, 0)
self._settings.gsettings.bind(key, self._sw, "active", Gio.SettingsBindFlags.DEFAULT)
self.show_all()
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