Skip to content

Commit

Permalink
[GtkUI] Reword preferences to prefer dark theme
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cas-- committed Feb 19, 2024
1 parent 5dd7aa5 commit 7f3f7f6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 79 deletions.
113 changes: 42 additions & 71 deletions deluge/ui/gtk3/glade/preferences_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -429,77 +429,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame_theme">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment_theme">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">3</property>
<property name="left_padding">10</property>
<child>
<object class="GtkBox" id="hbox_theme">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkRadioButton" id="radio_theme_light">
<property name="label" translatable="yes">Light</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">The light theme</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radio_theme_dark">
<property name="label" translatable="yes">Dark</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">The dark theme</property>
<property name="draw_indicator">True</property>
<property name="group">radio_theme_light</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">7</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label_theme">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Theme</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame29">
<property name="visible">True</property>
Expand Down Expand Up @@ -1035,6 +964,48 @@ and daemon (does not apply in Standalone mode).</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame_theme">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkAlignment" id="alignment_theme">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="top-padding">3</property>
<property name="left-padding">10</property>
<child>
<object class="GtkCheckButton" id="chk_prefer_dark_theme">
<property name="label" translatable="yes">Prefer Dark</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="tooltip_text" translatable="yes">If available, use dark variant of GTK theme.</property>
<property name="draw-indicator">True</property>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label_theme">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Theme</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">3</property>
</packing>
</child>
Expand Down
2 changes: 1 addition & 1 deletion deluge/ui/gtk3/gtkui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion deluge/ui/gtk3/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions deluge/ui/gtk3/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7f3f7f6

Please sign in to comment.