From 7f3f7f69ee78610e95bea07d99f699e9310c4e08 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Mon, 19 Feb 2024 17:50:03 +0000 Subject: [PATCH] [GtkUI] Reword preferences to prefer dark theme The GTK option for dark theme only provides a preference to use the dark theme, there is not a similar option for light theme so the settings should only refer to 'prefer dark theme' and whether it's on or off. --- deluge/ui/gtk3/glade/preferences_dialog.ui | 113 ++++++++------------- deluge/ui/gtk3/gtkui.py | 2 +- deluge/ui/gtk3/mainwindow.py | 2 +- deluge/ui/gtk3/preferences.py | 12 +-- 4 files changed, 50 insertions(+), 79 deletions(-) diff --git a/deluge/ui/gtk3/glade/preferences_dialog.ui b/deluge/ui/gtk3/glade/preferences_dialog.ui index 44bcafe4c7..720dc6b401 100644 --- a/deluge/ui/gtk3/glade/preferences_dialog.ui +++ b/deluge/ui/gtk3/glade/preferences_dialog.ui @@ -429,77 +429,6 @@ 0 - - - True - False - 0 - none - - - True - False - 3 - 10 - - - True - False - - - Light - True - True - False - The light theme - True - True - - - False - True - 0 - - - - - Dark - True - True - False - The dark theme - True - radio_theme_light - - - False - True - 7 - 1 - - - - - - - - - True - False - Theme - - - - - - - - False - False - 5 - 1 - - True @@ -1035,6 +964,48 @@ and daemon (does not apply in Standalone mode). False True 5 + 2 + + + + + True + False + 0 + none + + + True + False + 3 + 10 + + + Prefer Dark + True + True + False + If available, use dark variant of GTK theme. + True + + + + + + + True + False + Theme + + + + + + + + False + False + 5 3 diff --git a/deluge/ui/gtk3/gtkui.py b/deluge/ui/gtk3/gtkui.py index 0fbb5b773e..73a7c97aea 100644 --- a/deluge/ui/gtk3/gtkui.py +++ b/deluge/ui/gtk3/gtkui.py @@ -84,7 +84,7 @@ def getproctitle(): DEFAULT_PREFS = { 'standalone': True, - 'dark_theme': False, + 'prefer_dark_theme': False, 'interactive_add': True, 'focus_add_dialog': True, 'enable_system_tray': True, diff --git a/deluge/ui/gtk3/mainwindow.py b/deluge/ui/gtk3/mainwindow.py index 84956f2cd5..6c871d2d84 100644 --- a/deluge/ui/gtk3/mainwindow.py +++ b/deluge/ui/gtk3/mainwindow.py @@ -75,7 +75,7 @@ def __init__(self): # Set theme Gtk.Settings.get_default().set_property( 'gtk-application-prefer-dark-theme', - self.config['dark_theme'], + self.config['prefer_dark_theme'], ) # Patch this GtkBuilder to avoid connecting signals from elsewhere diff --git a/deluge/ui/gtk3/preferences.py b/deluge/ui/gtk3/preferences.py index cf303d75ab..cd67a5b09d 100644 --- a/deluge/ui/gtk3/preferences.py +++ b/deluge/ui/gtk3/preferences.py @@ -174,7 +174,7 @@ def set_separator(model, _iter, data=None): # Initialize a binding for dark theme Gtk.Settings.get_default().bind_property( 'gtk-application-prefer-dark-theme', - self.builder.get_object('radio_theme_dark'), + self.builder.get_object('chk_prefer_dark_theme'), 'active', GObject.BindingFlags.BIDIRECTIONAL | GObject.BindingFlags.SYNC_CREATE, ) @@ -565,8 +565,8 @@ def _show(self): self.builder.get_object('radio_thinclient').set_active( not self.gtkui_config['standalone'] ) - self.builder.get_object('radio_theme_dark').set_active( - self.gtkui_config['dark_theme'] + self.builder.get_object('chk_prefer_dark_theme').set_active( + self.gtkui_config['prefer_dark_theme'] ) self.builder.get_object('chk_show_rate_in_title').set_active( self.gtkui_config['show_rate_in_title'] @@ -752,8 +752,8 @@ def set_config(self, hide=False): ).get_active() # Interface tab # - new_gtkui_config['dark_theme'] = self.builder.get_object( - 'radio_theme_dark' + new_gtkui_config['prefer_dark_theme'] = self.builder.get_object( + 'chk_prefer_dark_theme' ).get_active() new_gtkui_config['enable_system_tray'] = self.builder.get_object( 'chk_use_tray' @@ -1090,7 +1090,7 @@ def on_button_cancel_clicked(self, data): log.debug('on_button_cancel_clicked') Gtk.Settings.get_default().set_property( 'gtk-application-prefer-dark-theme', - self.gtkui_config['dark_theme'], + self.gtkui_config['prefer_dark_theme'], ) self.hide() return True