[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.
This commit is contained in:
Calum Lind 2024-02-19 17:50:03 +00:00
parent 5dd7aa5321
commit 7f3f7f69ee
No known key found for this signature in database
GPG Key ID: 90597A687B836BA3
4 changed files with 50 additions and 79 deletions

View File

@ -429,77 +429,6 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </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> <child>
<object class="GtkFrame" id="frame29"> <object class="GtkFrame" id="frame29">
<property name="visible">True</property> <property name="visible">True</property>
@ -1035,6 +964,48 @@ and daemon (does not apply in Standalone mode).</property>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="padding">5</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> <property name="position">3</property>
</packing> </packing>
</child> </child>

View File

@ -84,7 +84,7 @@ except ImportError:
DEFAULT_PREFS = { DEFAULT_PREFS = {
'standalone': True, 'standalone': True,
'dark_theme': False, 'prefer_dark_theme': False,
'interactive_add': True, 'interactive_add': True,
'focus_add_dialog': True, 'focus_add_dialog': True,
'enable_system_tray': True, 'enable_system_tray': True,

View File

@ -75,7 +75,7 @@ class MainWindow(component.Component):
# Set theme # Set theme
Gtk.Settings.get_default().set_property( Gtk.Settings.get_default().set_property(
'gtk-application-prefer-dark-theme', 'gtk-application-prefer-dark-theme',
self.config['dark_theme'], self.config['prefer_dark_theme'],
) )
# Patch this GtkBuilder to avoid connecting signals from elsewhere # Patch this GtkBuilder to avoid connecting signals from elsewhere

View File

@ -174,7 +174,7 @@ class Preferences(component.Component):
# Initialize a binding for dark theme # Initialize a binding for dark theme
Gtk.Settings.get_default().bind_property( Gtk.Settings.get_default().bind_property(
'gtk-application-prefer-dark-theme', 'gtk-application-prefer-dark-theme',
self.builder.get_object('radio_theme_dark'), self.builder.get_object('chk_prefer_dark_theme'),
'active', 'active',
GObject.BindingFlags.BIDIRECTIONAL | GObject.BindingFlags.SYNC_CREATE, GObject.BindingFlags.BIDIRECTIONAL | GObject.BindingFlags.SYNC_CREATE,
) )
@ -565,8 +565,8 @@ class Preferences(component.Component):
self.builder.get_object('radio_thinclient').set_active( self.builder.get_object('radio_thinclient').set_active(
not self.gtkui_config['standalone'] not self.gtkui_config['standalone']
) )
self.builder.get_object('radio_theme_dark').set_active( self.builder.get_object('chk_prefer_dark_theme').set_active(
self.gtkui_config['dark_theme'] self.gtkui_config['prefer_dark_theme']
) )
self.builder.get_object('chk_show_rate_in_title').set_active( self.builder.get_object('chk_show_rate_in_title').set_active(
self.gtkui_config['show_rate_in_title'] self.gtkui_config['show_rate_in_title']
@ -752,8 +752,8 @@ class Preferences(component.Component):
).get_active() ).get_active()
# Interface tab # # Interface tab #
new_gtkui_config['dark_theme'] = self.builder.get_object( new_gtkui_config['prefer_dark_theme'] = self.builder.get_object(
'radio_theme_dark' 'chk_prefer_dark_theme'
).get_active() ).get_active()
new_gtkui_config['enable_system_tray'] = self.builder.get_object( new_gtkui_config['enable_system_tray'] = self.builder.get_object(
'chk_use_tray' 'chk_use_tray'
@ -1090,7 +1090,7 @@ class Preferences(component.Component):
log.debug('on_button_cancel_clicked') log.debug('on_button_cancel_clicked')
Gtk.Settings.get_default().set_property( Gtk.Settings.get_default().set_property(
'gtk-application-prefer-dark-theme', 'gtk-application-prefer-dark-theme',
self.gtkui_config['dark_theme'], self.gtkui_config['prefer_dark_theme'],
) )
self.hide() self.hide()
return True return True