Skip to content

Commit

Permalink
Remove dark mode preference
Browse files Browse the repository at this point in the history
With the GTK4 + libadwaita port Cozy now automatically follows the system
color scheme, and this setting is no longer needed.
  • Loading branch information
rdbende committed Dec 22, 2023
1 parent 1be8d73 commit 1dd51d5
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 44 deletions.
8 changes: 0 additions & 8 deletions cozy/application_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ def forward_duration(self) -> int:
def forward_duration(self, new_value):
self._settings.set_int("forward-duration", new_value)

@property
def dark_mode(self) -> bool:
return self._settings.get_boolean("dark-mode")

@dark_mode.setter
def dark_mode(self, new_value: bool):
self._settings.set_boolean("dark-mode", new_value)

@property
def window_width(self) -> int:
return self._settings.get_int("window-width")
Expand Down
4 changes: 0 additions & 4 deletions cozy/ui/preferences_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class PreferencesView(Adw.PreferencesWindow):
_glib_settings: Gio.Settings = inject.attr(Gio.Settings)
_view_model: SettingsViewModel = inject.attr(SettingsViewModel)

dark_mode_switch: Gtk.Switch = Gtk.Template.Child()
swap_author_reader_switch: Gtk.Switch = Gtk.Template.Child()
replay_switch: Gtk.Switch = Gtk.Template.Child()
sleep_timer_fadeout_switch: Adw.SwitchRow = Gtk.Template.Child()
Expand Down Expand Up @@ -67,9 +66,6 @@ def _bind_view_model(self):
self._view_model.bind_to("storage_attributes", self._refresh_storage_rows)

def _bind_settings(self):
self._glib_settings.bind("dark-mode", self.dark_mode_switch, "active",
Gio.SettingsBindFlags.DEFAULT)

self._glib_settings.bind("swap-author-reader", self.swap_author_reader_switch, "active",
Gio.SettingsBindFlags.DEFAULT)

Expand Down
16 changes: 0 additions & 16 deletions cozy/view_model/settings_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ def __init__(self):

self._lock_ui: bool = False

self._gtk_settings = Gtk.Settings.get_default()
self.style_manager = Adw.StyleManager.get_default()
self._set_dark_mode()

self._app_settings.add_listener(self._on_app_setting_changed)

if self._model.first_start:
self._importer.scan()

Expand Down Expand Up @@ -119,13 +113,3 @@ def add_first_storage_location(self, path: str):

self._model.invalidate()
self._notify("storage_locations")

def _set_dark_mode(self):
if self._app_settings.dark_mode:
self.style_manager.set_color_scheme(Adw.ColorScheme.PREFER_DARK)
else:
self.style_manager.set_color_scheme(Adw.ColorScheme.PREFER_LIGHT)

def _on_app_setting_changed(self, event: str, data):
if event == "dark-mode":
self._set_dark_mode()
7 changes: 1 addition & 6 deletions data/com.github.geigi.cozy.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
<summary>Display the time according to the playback speed.</summary>
<description></description>
</key>
<key type="b" name="dark-mode">
<default>false</default>
<summary>Enable Dark Mode.</summary>
<description></description>
</key>
<key type="b" name="swap-author-reader">
<default>false</default>
<summary>Swap author and reader tag assignment.</summary>
Expand Down Expand Up @@ -112,4 +107,4 @@
<description></description>
</key>
</schema>
</schemalist>
</schemalist>
10 changes: 0 additions & 10 deletions data/ui/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@
<object class="AdwPreferencesPage">
<property name="icon-name">settings-symbolic</property>
<property name="title" translatable="true">General</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="true">Appearance</property>
<child>
<object class="AdwSwitchRow" id="dark_mode_switch">
<property name="title">Dark Mode</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="true">Tags</property>
Expand Down

0 comments on commit 1dd51d5

Please sign in to comment.