Dark theme: fix the binding with the gsettings

fixes #118
This commit is contained in:
Bilal Elmoussaoui 2019-02-13 00:26:34 +01:00
parent 34694833eb
commit 214affdebb
2 changed files with 3 additions and 4 deletions

View file

@ -67,7 +67,7 @@ class Application(Gtk.Application):
gtk_settings = Gtk.Settings.get_default()
Settings.get_default().bind("night-mode", gtk_settings,
"gtk-application-prefer-dark-theme",
Gio.SettingsBindFlags.GET)
Gio.SettingsBindFlags.DEFAULT)
@staticmethod
def __setup_css():

View file

@ -59,9 +59,7 @@ class SettingsWindow(Gtk.Window):
self.__init_widgets()
def __init_widgets(self):
settings = Settings.get_default()
settings.bind("night-mode", self.dark_theme_switch, "state", Gio.SettingsBindFlags.DEFAULT)
self.dark_theme_switch.set_active(Settings.get_default().is_night_mode)
self.lock_switch.set_active(Keyring.get_default().has_password())
@Gtk.Template.Callback('lock_switch_state_changed')
@ -89,6 +87,7 @@ class SettingsWindow(Gtk.Window):
@Gtk.Template.Callback('dark_theme_switch_state_changed')
@staticmethod
def __on_dark_theme_changed(_, state):
Settings.get_default().is_night_mode = state
gtk_settings = Gtk.Settings.get_default()
gtk_settings.set_property("gtk-application-prefer-dark-theme",
state)