Group advanced settings and use expander rows

This commit is contained in:
Romain Vigier
2022-02-23 22:56:34 +01:00
parent 1b7e63d9d1
commit 4ad8f217c3
3 changed files with 95 additions and 105 deletions
+29 -29
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Night Theme Switcher\n" "Project-Id-Version: Night Theme Switcher\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-23 21:30+0100\n" "POT-Creation-Date: 2022-02-23 22:56+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -45,35 +45,35 @@ msgstr ""
msgid "Turn Off" msgid "Turn Off"
msgstr "" msgstr ""
#: src/preferences/BackgroundButton.js:61 #: src/preferences/BackgroundButton.js:71
msgid "Only JPEG, PNG, TIFF and XML files can be set as background image." msgid "Only JPEG, PNG, TIFF and XML files can be set as background image."
msgstr "" msgstr ""
#: src/preferences/SchedulePage.js:45 src/preferences/ui/SchedulePage.ui:63 #: src/preferences/SchedulePage.js:43 src/preferences/ui/SchedulePage.ui:62
msgid "Night Light" msgid "Night Light"
msgstr "" msgstr ""
#: src/preferences/SchedulePage.js:49 #: src/preferences/SchedulePage.js:48
msgid "Location Services" msgid "Location Services"
msgstr "" msgstr ""
#: src/preferences/SchedulePage.js:57 #: src/preferences/SchedulePage.js:56 src/preferences/ui/SchedulePage.ui:79
msgid "Manual schedule" msgid "Manual schedule"
msgstr "" msgstr ""
#: src/preferences/SchedulePage.js:58 src/preferences/ui/SchedulePage.ui:109 #: src/preferences/SchedulePage.js:57 src/preferences/ui/SchedulePage.ui:108
msgid "On-demand" msgid "On-demand"
msgstr "" msgstr ""
#: src/preferences/SchedulePage.js:91 #: src/preferences/SchedulePage.js:90
msgid "None" msgid "None"
msgstr "" msgstr ""
#: src/preferences/SchedulePage.js:92 #: src/preferences/SchedulePage.js:91
msgid "Top bar" msgid "Top bar"
msgstr "" msgstr ""
#: src/preferences/SchedulePage.js:93 #: src/preferences/SchedulePage.js:92
msgid "System menu" msgid "System menu"
msgstr "" msgstr ""
@@ -228,7 +228,7 @@ msgid "Path to the night background"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:120 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:120
#: src/preferences/ui/SchedulePage.ui:43 #: src/preferences/ui/SchedulePage.ui:27
msgid "Time source" msgid "Time source"
msgstr "" msgstr ""
@@ -301,7 +301,7 @@ msgid "When the day ends"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:174 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:174
#: src/preferences/ui/SchedulePage.ui:15 #: src/preferences/ui/SchedulePage.ui:50
msgid "Transition" msgid "Transition"
msgstr "" msgstr ""
@@ -335,7 +335,7 @@ msgstr ""
msgid "Run commands" msgid "Run commands"
msgstr "" msgstr ""
#: src/preferences/ui/CommandsPage.ui:21 src/preferences/ui/SchedulePage.ui:83 #: src/preferences/ui/CommandsPage.ui:21 src/preferences/ui/SchedulePage.ui:82
msgid "Sunrise" msgid "Sunrise"
msgstr "" msgstr ""
@@ -344,7 +344,7 @@ msgstr ""
msgid "notify-send \"Hello sunshine!\"" msgid "notify-send \"Hello sunshine!\""
msgstr "" msgstr ""
#: src/preferences/ui/CommandsPage.ui:35 src/preferences/ui/SchedulePage.ui:95 #: src/preferences/ui/CommandsPage.ui:35 src/preferences/ui/SchedulePage.ui:94
msgid "Sunset" msgid "Sunset"
msgstr "" msgstr ""
@@ -373,48 +373,48 @@ msgstr ""
msgid "Schedule" msgid "Schedule"
msgstr "" msgstr ""
#: src/preferences/ui/SchedulePage.ui:16 #: src/preferences/ui/SchedulePage.ui:15
msgid "Smooth transition between day and night appearance."
msgstr ""
#: src/preferences/ui/SchedulePage.ui:31
msgid "Manual time source" msgid "Manual time source"
msgstr "" msgstr ""
#: src/preferences/ui/SchedulePage.ui:32 #: src/preferences/ui/SchedulePage.ui:16
msgid "" msgid ""
"The extension will try to use Night Light or Location Services to " "The extension will try to use Night Light or Location Services to "
"automatically set your current sunrise and sunset times if they are enabled. " "automatically set your current sunrise and sunset times if they are enabled. "
"If you prefer, you can manually choose a time source." "If you prefer, you can manually choose a time source."
msgstr "" msgstr ""
#: src/preferences/ui/SchedulePage.ui:49 #: src/preferences/ui/SchedulePage.ui:33
msgid "Always show on-demand controls" msgid "Always show on-demand controls"
msgstr "" msgstr ""
#: src/preferences/ui/SchedulePage.ui:50 #: src/preferences/ui/SchedulePage.ui:34
msgid "Allows you to override the current time when using a schedule." msgid "Allows you to override the current time when using a schedule."
msgstr "" msgstr ""
#: src/preferences/ui/SchedulePage.ui:66 #: src/preferences/ui/SchedulePage.ui:47
msgid "Advanced Settings"
msgstr ""
#: src/preferences/ui/SchedulePage.ui:51
msgid "Smooth transition between day and night appearance."
msgstr ""
#: src/preferences/ui/SchedulePage.ui:65
msgid "Follow <i>Disable until tomorrow</i>" msgid "Follow <i>Disable until tomorrow</i>"
msgstr "" msgstr ""
#: src/preferences/ui/SchedulePage.ui:67 #: src/preferences/ui/SchedulePage.ui:66
msgid "" msgid ""
"When Night Light is temporarily disabled, the extension will switch to day " "When Night Light is temporarily disabled, the extension will switch to day "
"variants." "variants."
msgstr "" msgstr ""
#: src/preferences/ui/SchedulePage.ui:80 #: src/preferences/ui/SchedulePage.ui:111
msgid "Manual schedule times"
msgstr ""
#: src/preferences/ui/SchedulePage.ui:112
msgid "Keyboard shortcut" msgid "Keyboard shortcut"
msgstr "" msgstr ""
#: src/preferences/ui/SchedulePage.ui:123 #: src/preferences/ui/SchedulePage.ui:122
msgid "Button location" msgid "Button location"
msgstr "" msgstr ""
+2 -13
View File
@@ -25,9 +25,7 @@ var SchedulePage = GObject.registerClass({
'schedule_sunset_time_chooser', 'schedule_sunset_time_chooser',
'ondemand_shortcut_button', 'ondemand_shortcut_button',
'ondemand_button_location_combo_row', 'ondemand_button_location_combo_row',
'nightlight_preferences_group', 'nightlight_expander_row',
'manual_schedule_preferences_group',
'ondemand_preferences_group',
], ],
}, class SchedulePage extends Adw.PreferencesPage { }, class SchedulePage extends Adw.PreferencesPage {
constructor(props = {}) { constructor(props = {}) {
@@ -44,6 +42,7 @@ var SchedulePage = GObject.registerClass({
const nightlightChoice = new DropDownChoice({ id: 'nightlight', title: _('Night Light') }); const nightlightChoice = new DropDownChoice({ id: 'nightlight', title: _('Night Light') });
nightlightChoice.connect('notify::enabled', () => choiceFilter.changed(Gtk.FilterChange.DIFFERENT)); nightlightChoice.connect('notify::enabled', () => choiceFilter.changed(Gtk.FilterChange.DIFFERENT));
nightlightChoice.bind_property('enabled', this._nightlight_expander_row, 'visible', GObject.BindingFlags.DEFAULT);
colorSettings.bind('night-light-enabled', nightlightChoice, 'enabled', Gio.SettingsBindFlags.GET); colorSettings.bind('night-light-enabled', nightlightChoice, 'enabled', Gio.SettingsBindFlags.GET);
const locationChoice = new DropDownChoice({ id: 'location', title: _('Location Services') }); const locationChoice = new DropDownChoice({ id: 'location', title: _('Location Services') });
@@ -101,15 +100,5 @@ var SchedulePage = GObject.registerClass({
}; };
settings.connect('changed::ondemand-button-placement', () => updateOndemandButtonLocationComboRowSelected()); settings.connect('changed::ondemand-button-placement', () => updateOndemandButtonLocationComboRowSelected());
updateOndemandButtonLocationComboRowSelected(); updateOndemandButtonLocationComboRowSelected();
const updateGroupsVisibility = () => {
const timeSource = settings.get_string('time-source');
this._nightlight_preferences_group.visible = timeSource === 'nightlight';
this._manual_schedule_preferences_group.visible = timeSource === 'schedule';
this._ondemand_preferences_group.visible = timeSource === 'ondemand' || settings.get_boolean('always-enable-ondemand');
};
settings.connect('changed::time-source', () => updateGroupsVisibility());
settings.connect('changed::always-enable-ondemand', () => updateGroupsVisibility());
updateGroupsVisibility();
} }
}); });
+64 -63
View File
@@ -8,22 +8,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
<property name="name">schedule</property> <property name="name">schedule</property>
<property name="title" translatable="yes">Schedule</property> <property name="title" translatable="yes">Schedule</property>
<property name="icon-name">nightthemeswitcher-schedule-symbolic</property> <property name="icon-name">nightthemeswitcher-schedule-symbolic</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Transition</property>
<property name="subtitle" translatable="yes">Smooth transition between day and night appearance.</property>
<property name="activatable-widget">transition_switch</property>
<child>
<object class="GtkSwitch" id="transition_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child> <child>
<object class="AdwPreferencesGroup"> <object class="AdwPreferencesGroup">
<child> <child>
@@ -59,68 +43,85 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object> </object>
</child> </child>
<child> <child>
<object class="AdwPreferencesGroup" id="nightlight_preferences_group"> <object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Night Light</property> <property name="title" translatable="yes">Advanced Settings</property>
<child> <child>
<object class="AdwActionRow"> <object class="AdwActionRow">
<property name="title" translatable="yes"><![CDATA[Follow <i>Disable until tomorrow</i>]]></property> <property name="title" translatable="yes">Transition</property>
<property name="subtitle" translatable="yes">When Night Light is temporarily disabled, the extension will switch to day variants.</property> <property name="subtitle" translatable="yes">Smooth transition between day and night appearance.</property>
<property name="activatable-widget">nightlight_follow_disable_switch</property> <property name="activatable-widget">transition_switch</property>
<child> <child>
<object class="GtkSwitch" id="nightlight_follow_disable_switch"> <object class="GtkSwitch" id="transition_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="manual_schedule_preferences_group">
<property name="title" translatable="yes">Manual schedule times</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Sunrise</property>
<child>
<object class="TimeChooser" id="schedule_sunrise_time_chooser">
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="valign">center</property> <property name="valign">center</property>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
<child> <child>
<object class="AdwActionRow"> <object class="AdwExpanderRow" id="nightlight_expander_row">
<property name="title" translatable="yes">Sunset</property> <property name="title" translatable="yes">Night Light</property>
<child> <child>
<object class="TimeChooser" id="schedule_sunset_time_chooser"> <object class="AdwActionRow">
<property name="margin-top">12</property> <property name="title" translatable="yes"><![CDATA[Follow <i>Disable until tomorrow</i>]]></property>
<property name="margin-bottom">12</property> <property name="subtitle" translatable="yes">When Night Light is temporarily disabled, the extension will switch to day variants.</property>
<property name="valign">center</property> <property name="activatable-widget">nightlight_follow_disable_switch</property>
</object> <child>
</child> <object class="GtkSwitch" id="nightlight_follow_disable_switch">
</object> <property name="valign">center</property>
</child> </object>
</object> </child>
</child>
<child>
<object class="AdwPreferencesGroup" id="ondemand_preferences_group">
<property name="title" translatable="yes">On-demand</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Keyboard shortcut</property>
<property name="activatable-widget">ondemand_shortcut_button</property>
<child>
<object class="ShortcutButton" id="ondemand_shortcut_button">
<property name="valign">center</property>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
<child> <child>
<object class="AdwComboRow" id="ondemand_button_location_combo_row"> <object class="AdwExpanderRow">
<property name="title" translatable="yes">Button location</property> <property name="title" translatable="yes">Manual schedule</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Sunrise</property>
<child>
<object class="TimeChooser" id="schedule_sunrise_time_chooser">
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Sunset</property>
<child>
<object class="TimeChooser" id="schedule_sunset_time_chooser">
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwExpanderRow">
<property name="title" translatable="yes">On-demand</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Keyboard shortcut</property>
<property name="activatable-widget">ondemand_shortcut_button</property>
<child>
<object class="ShortcutButton" id="ondemand_shortcut_button">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwComboRow" id="ondemand_button_location_combo_row">
<property name="title" translatable="yes">Button location</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>