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 ""
"Project-Id-Version: Night Theme Switcher\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -45,35 +45,35 @@ msgstr ""
msgid "Turn Off"
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."
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"
msgstr ""
#: src/preferences/SchedulePage.js:49
#: src/preferences/SchedulePage.js:48
msgid "Location Services"
msgstr ""
#: src/preferences/SchedulePage.js:57
#: src/preferences/SchedulePage.js:56 src/preferences/ui/SchedulePage.ui:79
msgid "Manual schedule"
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"
msgstr ""
#: src/preferences/SchedulePage.js:91
#: src/preferences/SchedulePage.js:90
msgid "None"
msgstr ""
#: src/preferences/SchedulePage.js:92
#: src/preferences/SchedulePage.js:91
msgid "Top bar"
msgstr ""
#: src/preferences/SchedulePage.js:93
#: src/preferences/SchedulePage.js:92
msgid "System menu"
msgstr ""
@@ -228,7 +228,7 @@ msgid "Path to the night background"
msgstr ""
#: 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"
msgstr ""
@@ -301,7 +301,7 @@ msgid "When the day ends"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:174
#: src/preferences/ui/SchedulePage.ui:15
#: src/preferences/ui/SchedulePage.ui:50
msgid "Transition"
msgstr ""
@@ -335,7 +335,7 @@ msgstr ""
msgid "Run commands"
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"
msgstr ""
@@ -344,7 +344,7 @@ msgstr ""
msgid "notify-send \"Hello sunshine!\""
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"
msgstr ""
@@ -373,48 +373,48 @@ msgstr ""
msgid "Schedule"
msgstr ""
#: src/preferences/ui/SchedulePage.ui:16
msgid "Smooth transition between day and night appearance."
msgstr ""
#: src/preferences/ui/SchedulePage.ui:31
#: src/preferences/ui/SchedulePage.ui:15
msgid "Manual time source"
msgstr ""
#: src/preferences/ui/SchedulePage.ui:32
#: src/preferences/ui/SchedulePage.ui:16
msgid ""
"The extension will try to use Night Light or Location Services to "
"automatically set your current sunrise and sunset times if they are enabled. "
"If you prefer, you can manually choose a time source."
msgstr ""
#: src/preferences/ui/SchedulePage.ui:49
#: src/preferences/ui/SchedulePage.ui:33
msgid "Always show on-demand controls"
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."
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>"
msgstr ""
#: src/preferences/ui/SchedulePage.ui:67
#: src/preferences/ui/SchedulePage.ui:66
msgid ""
"When Night Light is temporarily disabled, the extension will switch to day "
"variants."
msgstr ""
#: src/preferences/ui/SchedulePage.ui:80
msgid "Manual schedule times"
msgstr ""
#: src/preferences/ui/SchedulePage.ui:112
#: src/preferences/ui/SchedulePage.ui:111
msgid "Keyboard shortcut"
msgstr ""
#: src/preferences/ui/SchedulePage.ui:123
#: src/preferences/ui/SchedulePage.ui:122
msgid "Button location"
msgstr ""
+2 -13
View File
@@ -25,9 +25,7 @@ var SchedulePage = GObject.registerClass({
'schedule_sunset_time_chooser',
'ondemand_shortcut_button',
'ondemand_button_location_combo_row',
'nightlight_preferences_group',
'manual_schedule_preferences_group',
'ondemand_preferences_group',
'nightlight_expander_row',
],
}, class SchedulePage extends Adw.PreferencesPage {
constructor(props = {}) {
@@ -44,6 +42,7 @@ var SchedulePage = GObject.registerClass({
const nightlightChoice = new DropDownChoice({ id: 'nightlight', title: _('Night Light') });
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);
const locationChoice = new DropDownChoice({ id: 'location', title: _('Location Services') });
@@ -101,15 +100,5 @@ var SchedulePage = GObject.registerClass({
};
settings.connect('changed::ondemand-button-placement', () => 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="title" translatable="yes">Schedule</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>
<object class="AdwPreferencesGroup">
<child>
@@ -59,68 +43,85 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="nightlight_preferences_group">
<property name="title" translatable="yes">Night Light</property>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Advanced Settings</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes"><![CDATA[Follow <i>Disable until tomorrow</i>]]></property>
<property name="subtitle" translatable="yes">When Night Light is temporarily disabled, the extension will switch to day variants.</property>
<property name="activatable-widget">nightlight_follow_disable_switch</property>
<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="nightlight_follow_disable_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>
<object class="GtkSwitch" id="transition_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Sunset</property>
<object class="AdwExpanderRow" id="nightlight_expander_row">
<property name="title" translatable="yes">Night Light</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="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 class="AdwActionRow">
<property name="title" translatable="yes"><![CDATA[Follow <i>Disable until tomorrow</i>]]></property>
<property name="subtitle" translatable="yes">When Night Light is temporarily disabled, the extension will switch to day variants.</property>
<property name="activatable-widget">nightlight_follow_disable_switch</property>
<child>
<object class="GtkSwitch" id="nightlight_follow_disable_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwComboRow" id="ondemand_button_location_combo_row">
<property name="title" translatable="yes">Button location</property>
<object class="AdwExpanderRow">
<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>
</child>
</object>