Add on-demand option for all automatic sources

This commit is contained in:
Romain
2020-11-06 10:36:50 +00:00
parent d7fed9aea3
commit 3cc980ff4e
8 changed files with 520 additions and 320 deletions
+48 -46
View File
@@ -35,8 +35,8 @@ const { TimerOndemand } = Me.imports.modules.TimerOndemand;
* They can connect to its 'time-changed' signal and ask its 'time' property * They can connect to its 'time-changed' signal and ask its 'time' property
* for the current time. * for the current time.
* *
* It will try to use one of this three different time sources, in this order of * It will try to use one of these three different time sources, in this order
* preference: * of preference:
* - Night Light * - Night Light
* - Location Services * - Location Services
* - Manual schedule * - Manual schedule
@@ -47,35 +47,35 @@ const { TimerOndemand } = Me.imports.modules.TimerOndemand;
var Timer = class { var Timer = class {
constructor() { constructor() {
this._source = null; this._sources = [];
this._previousTime = null; this._previousTime = null;
this._nightlightStatusChangedConnect = null; this._nightlightStatusChangedConnect = null;
this._locationStatusChangedConnect = null; this._locationStatusChangedConnect = null;
this._manualTimeSourceChangedConnect = null; this._manualTimeSourceChangedConnect = null;
this._timeSourceChangedConnect = null; this._timeSourceChangedConnect = null;
this._timeChangedConnect = null; this._timeChangedConnects = [];
} }
enable() { enable() {
logDebug('Enabling Timer...'); logDebug('Enabling Timer...');
this._connectSettings(); this._connectSettings();
this._createSource(); this._createSources();
this._connectSource(); this._connectSources();
this._enableSource(); this._enableSources();
logDebug('Timer enabled.'); logDebug('Timer enabled.');
} }
disable() { disable() {
logDebug('Disabling Timer...'); logDebug('Disabling Timer...');
this._disconnectSource(); this._disconnectSources();
this._disableSource(); this._disableSources();
this._disconnectSettings(); this._disconnectSettings();
logDebug('Timer disabled.'); logDebug('Timer disabled.');
} }
get time() { get time() {
return this._source ? this._source.time : null; return this._previousTime;
} }
@@ -84,6 +84,7 @@ var Timer = class {
this._nightlightStatusChangedConnect = e.settings.system.connect('nightlight-status-changed', this._onSourceChanged.bind(this)); this._nightlightStatusChangedConnect = e.settings.system.connect('nightlight-status-changed', this._onSourceChanged.bind(this));
this._locationStatusChangedConnect = e.settings.system.connect('location-status-changed', this._onSourceChanged.bind(this)); this._locationStatusChangedConnect = e.settings.system.connect('location-status-changed', this._onSourceChanged.bind(this));
this._manualTimeSourceChangedConnect = e.settings.time.connect('manual-time-source-changed', this._onSourceChanged.bind(this)); this._manualTimeSourceChangedConnect = e.settings.time.connect('manual-time-source-changed', this._onSourceChanged.bind(this));
this._alwaysEnableOndemandChangedConnect = e.settings.time.connect('always-enable-ondemand-changed', this._onSourceChanged.bind(this));
this._timeSourceChangedConnect = e.settings.time.connect('time-source-changed', this._onTimeSourceChanged.bind(this)); this._timeSourceChangedConnect = e.settings.time.connect('time-source-changed', this._onTimeSourceChanged.bind(this));
} }
@@ -107,45 +108,48 @@ var Timer = class {
logDebug('Disconnected Timer from settings.'); logDebug('Disconnected Timer from settings.');
} }
_createSource() { _createSources() {
switch (this._getSource()) { const source = this._getSource();
switch (source) {
case 'nightlight': case 'nightlight':
this._source = new TimerNightlight(); this._sources.push(new TimerNightlight());
break; break;
case 'location': case 'location':
this._source = new TimerLocation(); this._sources.push(new TimerLocation());
break; break;
case 'schedule': case 'schedule':
this._source = new TimerSchedule(); this._sources.push(new TimerSchedule());
break; break;
case 'ondemand': case 'ondemand':
this._source = new TimerOndemand(); this._sources.push(new TimerOndemand());
break; break;
} }
if (e.settings.time.alwaysEnableOndemand && ['nightlight', 'location', 'schedule'].includes(source))
this._sources.push(new TimerOndemand());
} }
_enableSource() { _enableSources() {
this._source.enable(); this._sources.forEach(source => source.enable());
} }
_disableSource() { _disableSources() {
if (this._source) { this._sources.forEach(source => source.disable());
this._source.disable(); this._sources = [];
this._source = null;
}
} }
_connectSource() { _connectSources() {
logDebug('Connecting to time source...'); logDebug('Connecting to time sources...');
this._timeChangedConnect = this._source.connect('time-changed', this._onTimeChanged.bind(this)); this._sources.forEach(source => this._timeChangedConnects.push({
source,
connect: source.connect('time-changed', this._onTimeChanged.bind(this)),
}));
} }
_disconnectSource() { _disconnectSources() {
if (this._timeChangedConnect) { this._timeChangedConnects.forEach(timeChangedConnect => timeChangedConnect.source.disconnect(timeChangedConnect.connect));
this._source.disconnect(this._timeChangedConnect); this._timeChangedConnects = [];
this._timeChangedConnect = null; logDebug('Disconnected from time sources.');
}
logDebug('Disconnected from time source.');
} }
@@ -162,8 +166,8 @@ var Timer = class {
_onTimeChanged(_source, newTime) { _onTimeChanged(_source, newTime) {
if (newTime !== this._previousTime) { if (newTime !== this._previousTime) {
logDebug(`Time has changed to ${newTime}.`); logDebug(`Time has changed to ${newTime}.`);
this.emit('time-changed', newTime);
this._previousTime = newTime; this._previousTime = newTime;
this.emit('time-changed', newTime);
} }
} }
@@ -171,8 +175,9 @@ var Timer = class {
_getSource() { _getSource() {
logDebug('Getting time source...'); logDebug('Getting time source...');
let source;
if (e.settings.time.manualTimeSource) { if (e.settings.time.manualTimeSource) {
let source = e.settings.time.timeSource; source = e.settings.time.timeSource;
logDebug(`Time source is forced to ${source}.`); logDebug(`Time source is forced to ${source}.`);
if ( if (
(source === 'nightlight' && !e.settings.system.nightlightEnabled) || (source === 'nightlight' && !e.settings.system.nightlightEnabled) ||
@@ -182,19 +187,16 @@ var Timer = class {
source = 'schedule'; source = 'schedule';
e.settings.time.timeSource = source; e.settings.time.timeSource = source;
} }
return source; } else {
if (e.settings.system.nightlightEnabled)
source = 'nightlight';
else if (e.settings.system.locationEnabled)
source = 'location';
else
source = 'schedule';
logDebug(`Time source is ${source}.`);
e.settings.time.timeSource = source;
} }
let source;
if (e.settings.system.nightlightEnabled)
source = 'nightlight';
else if (e.settings.system.locationEnabled)
source = 'location';
else
source = 'schedule';
logDebug(`Time source is ${source}.`);
e.settings.time.timeSource = source;
return source; return source;
} }
+35 -3
View File
@@ -47,6 +47,7 @@ var TimerOndemand = class {
this._previousKeybinding = null; this._previousKeybinding = null;
this._ondemandKeybindingConnect = null; this._ondemandKeybindingConnect = null;
this._ondemandButtonPlacementConnect = null; this._ondemandButtonPlacementConnect = null;
this._timeChangedConnect = null;
} }
enable() { enable() {
@@ -54,12 +55,14 @@ var TimerOndemand = class {
this._connectSettings(); this._connectSettings();
this._addKeybinding(); this._addKeybinding();
this._addButton(); this._addButton();
this._connectTimer();
this.emit('time-changed', this.time); this.emit('time-changed', this.time);
logDebug('On-demand Timer enabled.'); logDebug('On-demand Timer enabled.');
} }
disable() { disable() {
logDebug('Disabling On-demand Timer...'); logDebug('Disabling On-demand Timer...');
this._disconnectTimer();
this._removeKeybinding(); this._removeKeybinding();
this._removeButton(); this._removeButton();
this._disconnectSettings(); this._disconnectSettings();
@@ -90,6 +93,19 @@ var TimerOndemand = class {
} }
} }
_connectTimer() {
logDebug('Connecting On-demand Timer to Timer...');
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
}
_disconnectTimer() {
if (this._timeChangedConnect) {
e.timer.disconnect(this._timeChangedConnect);
this._timeChangedConnect = null;
}
logDebug('Disconnected On-demand Timer from Timer.');
}
_onOndemandKeybindingChanged(_settings, _keybinding) { _onOndemandKeybindingChanged(_settings, _keybinding) {
this._removeKeybinding(); this._removeKeybinding();
@@ -101,6 +117,10 @@ var TimerOndemand = class {
this._addButton(); this._addButton();
} }
_onTimeChanged(_timer, _newTime) {
this._updateButton();
}
_addKeybinding() { _addKeybinding() {
this._previousKeybinding = e.settings.time.ondemandKeybinding; this._previousKeybinding = e.settings.time.ondemandKeybinding;
@@ -145,6 +165,14 @@ var TimerOndemand = class {
} }
} }
_updateButton() {
if (this._button) {
logDebug('Updating On-demand Timer button state...');
this._button.update();
logDebug('Updated On-demand Timer button state.');
}
}
_addButtonToPanel() { _addButtonToPanel() {
logDebug('Adding On-demand Timer button to the panel...'); logDebug('Adding On-demand Timer button to the panel...');
const icon = new St.Icon({ const icon = new St.Icon({
@@ -154,9 +182,11 @@ var TimerOndemand = class {
this._button = new PanelMenuButton(0.0); this._button = new PanelMenuButton(0.0);
const buttonActor = getActor(this._button); const buttonActor = getActor(this._button);
buttonActor.add_actor(icon); buttonActor.add_actor(icon);
this._button.update = () => {
icon.gicon = this._getIconForTime(e.timer.time);
};
buttonActor.connect('button-press-event', () => { buttonActor.connect('button-press-event', () => {
this._toggleTime(); this._toggleTime();
icon.gicon = this._getIconForTime(e.timer.time);
}); });
main.panel.addToStatusArea('NightThemeSwitcherButton', this._button); main.panel.addToStatusArea('NightThemeSwitcherButton', this._button);
logDebug('Added On-demand Timer button to the panel.'); logDebug('Added On-demand Timer button to the panel.');
@@ -167,10 +197,12 @@ var TimerOndemand = class {
const aggregateMenu = main.panel.statusArea.aggregateMenu; const aggregateMenu = main.panel.statusArea.aggregateMenu;
const position = findShellAggregateMenuItemPosition(aggregateMenu._system.menu) - 1; const position = findShellAggregateMenuItemPosition(aggregateMenu._system.menu) - 1;
this._button = new PopupImageMenuItem(this._getLabelForTime(e.timer.time), this._getIconForTime(e.timer.time)); this._button = new PopupImageMenuItem(this._getLabelForTime(e.timer.time), this._getIconForTime(e.timer.time));
this._button.connect('activate', () => { this._button.update = () => {
this._toggleTime();
this._button.label.text = this._getLabelForTime(e.timer.time); this._button.label.text = this._getLabelForTime(e.timer.time);
this._button.setIcon(this._getIconForTime(e.timer.time)); this._button.setIcon(this._getIconForTime(e.timer.time));
};
this._button.connect('activate', () => {
this._toggleTime();
}); });
aggregateMenu.menu.addMenuItem(this._button, position); aggregateMenu.menu.addMenuItem(this._button, position);
logDebug('Added On-demand Timer button to the menu.'); logDebug('Added On-demand Timer button to the menu.');
+58 -37
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Night Theme Switcher 7\n" "Project-Id-Version: Night Theme Switcher 7\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-04 11:00+0100\n" "POT-Creation-Date: 2020-11-06 11:27+0100\n"
"PO-Revision-Date: 2020-11-04 11:02+0100\n" "PO-Revision-Date: 2020-11-06 11:29+0100\n"
"Last-Translator: Romain Vigier <romain@romainvigier.fr>\n" "Last-Translator: Romain Vigier <romain@romainvigier.fr>\n"
"Language-Team: French <romain@romainvigier.fr>\n" "Language-Team: French <romain@romainvigier.fr>\n"
"Language: fr\n" "Language: fr\n"
@@ -39,11 +39,11 @@ msgstr ""
"pour le thème GNOME Shell \"%s\". Veuillez les sélectionner manuellement " "pour le thème GNOME Shell \"%s\". Veuillez les sélectionner manuellement "
"dans les préférences de lextension." "dans les préférences de lextension."
#: src/modules/TimerOndemand.js:185 #: src/modules/TimerOndemand.js:217
msgid "Switch to night theme" msgid "Switch to night theme"
msgstr "Passer au thème nocturne" msgstr "Passer au thème nocturne"
#: src/modules/TimerOndemand.js:185 #: src/modules/TimerOndemand.js:217
msgid "Switch to day theme" msgid "Switch to day theme"
msgstr "Passer au thème diurne" msgstr "Passer au thème diurne"
@@ -73,7 +73,7 @@ msgstr "Thème dicônes"
msgid "Schedule" msgid "Schedule"
msgstr "Horaires" msgstr "Horaires"
#: src/preferences/Schedule.js:204 src/preferences/ui/schedule.ui:741 #: src/preferences/Schedule.js:217 src/preferences/ui/schedule.ui:842
msgid "Choose" msgid "Choose"
msgstr "Choisir" msgstr "Choisir"
@@ -320,62 +320,72 @@ msgstr ""
"Permuter vers les variantes diurnes lorsque le mode nuit est désactivé " "Permuter vers les variantes diurnes lorsque le mode nuit est désactivé "
"temporairement" "temporairement"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:145 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141
msgid "Always enable the on-demand timer"
msgstr "Toujours activer le gestionnaire à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:142
msgid "The on-demand timer will always be enabled alongside other timers"
msgstr ""
"Le gestionnaire à la demande sera toujours activés avec les autres "
"gestionnaires"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:150
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:91 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:91
msgid "On-demand time" msgid "On-demand time"
msgstr "Temps à la demande" msgstr "Temps à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:92 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:92
msgid "The current time used in on-demand mode" msgid "The current time used in on-demand mode"
msgstr "Le temps actuel utilisé dans le mode à la demande" msgstr "Le temps actuel utilisé dans le mode à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:150 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:155
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:96 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:96
msgid "Key combination to toggle time" msgid "Key combination to toggle time"
msgstr "Combinaison de touches pour permuter le temps" msgstr "Combinaison de touches pour permuter le temps"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:97 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:97
msgid "The key combination that will toggle time in on-demand mode" msgid "The key combination that will toggle time in on-demand mode"
msgstr "La combinaison de touches qui permutera le temps en mode à la demande" msgstr "La combinaison de touches qui permutera le temps en mode à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:160 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:165
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:106 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:106
msgid "On-demand button placement" msgid "On-demand button placement"
msgstr "Emplacement du bouton à la demande" msgstr "Emplacement du bouton à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:107 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:107
msgid "Where the on-demand button will be placed" msgid "Where the on-demand button will be placed"
msgstr "Où le bouton du changement à la demande sera placé" msgstr "Où le bouton du changement à la demande sera placé"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:165 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:111 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:111
msgid "Use manual time source" msgid "Use manual time source"
msgstr "Utiliser une source dhoraires manuelle" msgstr "Utiliser une source dhoraires manuelle"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:112 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:112
msgid "Disable automatic time source detection" msgid "Disable automatic time source detection"
msgstr "Désactive la détection automatique de la source dhoraires" msgstr "Désactive la détection automatique de la source dhoraires"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:175
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:116 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:116
msgid "Sunrise time" msgid "Sunrise time"
msgstr "Heure du lever" msgstr "Heure du lever"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:176
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:117 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:117
msgid "When the day starts" msgid "When the day starts"
msgstr "Quand le jour se lève" msgstr "Quand le jour se lève"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:175 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:180
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:121 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:121
msgid "Sunset time" msgid "Sunset time"
msgstr "Heure du coucher" msgstr "Heure du coucher"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:176 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:181
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:122 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:122
msgid "When the day ends" msgid "When the day ends"
msgstr "Quand le jour se couche" msgstr "Quand le jour se couche"
@@ -390,7 +400,7 @@ msgstr "Sélectionnez votre image darrière-plan"
#: src/preferences/ui/backgrounds.ui:220 src/preferences/ui/backgrounds.ui:312 #: src/preferences/ui/backgrounds.ui:220 src/preferences/ui/backgrounds.ui:312
#: src/preferences/ui/commands.ui:206 src/preferences/ui/commands.ui:300 #: src/preferences/ui/commands.ui:206 src/preferences/ui/commands.ui:300
#: src/preferences/ui/schedule.ui:756 #: src/preferences/ui/schedule.ui:857
msgid "Clear" msgid "Clear"
msgstr "Effacer" msgstr "Effacer"
@@ -451,7 +461,7 @@ msgid "Press your keyboard shortcut..."
msgstr "Pressez votre raccourci clavier…" msgstr "Pressez votre raccourci clavier…"
#: src/preferences/ui/ondemand_keyboard_shortcut_dialog.ui:76 #: src/preferences/ui/ondemand_keyboard_shortcut_dialog.ui:76
#: src/preferences/ui/schedule.ui:727 #: src/preferences/ui/schedule.ui:828
msgid "Keyboard shortcut" msgid "Keyboard shortcut"
msgstr "Raccourci clavier" msgstr "Raccourci clavier"
@@ -474,37 +484,48 @@ msgstr ""
"lever et de coucher du soleil. Si vous préférez, vous pouvez choisir " "lever et de coucher du soleil. Si vous préférez, vous pouvez choisir "
"manuellement une source dhoraires.</small>" "manuellement une source dhoraires.</small>"
#: src/preferences/ui/schedule.ui:174 #: src/preferences/ui/schedule.ui:191
msgid "Always show on-demand controls"
msgstr "Toujours afficher les contrôles à la demande"
#: src/preferences/ui/schedule.ui:204
msgid ""
"<small>This allows you to override the current time when using a schedule.</"
"small>"
msgstr ""
"<small>Cela vous permet de contrôler le temps quand vous utiliser un horaire."
"</small>"
#: src/preferences/ui/schedule.ui:266
msgid "Manual time source" msgid "Manual time source"
msgstr "Source dhoraires manuelle" msgstr "Source dhoraires manuelle"
#: src/preferences/ui/schedule.ui:194 src/preferences/ui/schedule.ui:300 #: src/preferences/ui/schedule.ui:286 src/preferences/ui/schedule.ui:392
#: src/preferences/ui/schedule.ui:416 #: src/preferences/ui/schedule.ui:508
msgid "Night Light" msgid "Night Light"
msgstr "Mode nuit" msgstr "Mode nuit"
#: src/preferences/ui/schedule.ui:209 #: src/preferences/ui/schedule.ui:301
msgid "Location Services" msgid "Location Services"
msgstr "Services de localisation" msgstr "Services de localisation"
#: src/preferences/ui/schedule.ui:224 #: src/preferences/ui/schedule.ui:316
msgid "Manual schedule" msgid "Manual schedule"
msgstr "Horaire manuel" msgstr "Horaire manuel"
#: src/preferences/ui/schedule.ui:239 src/preferences/ui/schedule.ui:685 #: src/preferences/ui/schedule.ui:331 src/preferences/ui/schedule.ui:786
#: src/preferences/ui/schedule.ui:865
msgid "On-demand" msgid "On-demand"
msgstr "À la demande" msgstr "À la demande"
#: src/preferences/ui/schedule.ui:287 #: src/preferences/ui/schedule.ui:379
msgid "No preferences" msgid "No preferences"
msgstr "Pas de préférences" msgstr "Pas de préférences"
#: src/preferences/ui/schedule.ui:348 #: src/preferences/ui/schedule.ui:440
msgid "Follow <i>Disable until tomorrow</i>" msgid "Follow <i>Disable until tomorrow</i>"
msgstr "Suivre <i>Désactiver jusqu’à demain</i>" msgstr "Suivre <i>Désactiver jusqu’à demain</i>"
#: src/preferences/ui/schedule.ui:362 #: src/preferences/ui/schedule.ui:454
msgid "" msgid ""
"<small>When Night Light is temporarily disabled, the extension will switch " "<small>When Night Light is temporarily disabled, the extension will switch "
"to day variants.</small>" "to day variants.</small>"
@@ -512,35 +533,35 @@ msgstr ""
"<small>Quand le mode nuit est temporairement désactivé, lextension va " "<small>Quand le mode nuit est temporairement désactivé, lextension va "
"permuter vers les variantes diurnes.</small>" "permuter vers les variantes diurnes.</small>"
#: src/preferences/ui/schedule.ui:432 src/preferences/ui/schedule.ui:669 #: src/preferences/ui/schedule.ui:524 src/preferences/ui/schedule.ui:761
msgid "Manual schedule times" msgid "Manual schedule times"
msgstr "Horaires manuels" msgstr "Horaires manuels"
#: src/preferences/ui/schedule.ui:474 #: src/preferences/ui/schedule.ui:566
msgid "Sunrise" msgid "Sunrise"
msgstr "Lever du soleil" msgstr "Lever du soleil"
#: src/preferences/ui/schedule.ui:510 src/preferences/ui/schedule.ui:617 #: src/preferences/ui/schedule.ui:602 src/preferences/ui/schedule.ui:709
msgid ":" msgid ":"
msgstr ":" msgstr ":"
#: src/preferences/ui/schedule.ui:581 #: src/preferences/ui/schedule.ui:673
msgid "Sunset" msgid "Sunset"
msgstr "Coucher du soleil" msgstr "Coucher du soleil"
#: src/preferences/ui/schedule.ui:819 #: src/preferences/ui/schedule.ui:920
msgid "Button location" msgid "Button location"
msgstr "Emplacement du bouton" msgstr "Emplacement du bouton"
#: src/preferences/ui/schedule.ui:835 #: src/preferences/ui/schedule.ui:936
msgid "None" msgid "None"
msgstr "Aucun" msgstr "Aucun"
#: src/preferences/ui/schedule.ui:836 #: src/preferences/ui/schedule.ui:937
msgid "Top bar" msgid "Top bar"
msgstr "Barre supérieure" msgstr "Barre supérieure"
#: src/preferences/ui/schedule.ui:837 #: src/preferences/ui/schedule.ui:938
msgid "System menu" msgid "System menu"
msgstr "Menu système" msgstr "Menu système"
+53 -36
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Night Theme Switcher 39\n" "Project-Id-Version: Night Theme Switcher 39\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-04 11:00+0100\n" "POT-Creation-Date: 2020-11-06 11:27+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"
@@ -32,11 +32,11 @@ msgid ""
"preferences." "preferences."
msgstr "" msgstr ""
#: src/modules/TimerOndemand.js:185 #: src/modules/TimerOndemand.js:217
msgid "Switch to night theme" msgid "Switch to night theme"
msgstr "" msgstr ""
#: src/modules/TimerOndemand.js:185 #: src/modules/TimerOndemand.js:217
msgid "Switch to day theme" msgid "Switch to day theme"
msgstr "" msgstr ""
@@ -66,7 +66,7 @@ msgstr ""
msgid "Schedule" msgid "Schedule"
msgstr "" msgstr ""
#: src/preferences/Schedule.js:204 src/preferences/ui/schedule.ui:741 #: src/preferences/Schedule.js:217 src/preferences/ui/schedule.ui:842
msgid "Choose" msgid "Choose"
msgstr "" msgstr ""
@@ -311,62 +311,70 @@ msgstr ""
msgid "Switch back to day time when Night Light is temporarily disabled" msgid "Switch back to day time when Night Light is temporarily disabled"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:145 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141
msgid "Always enable the on-demand timer"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:142
msgid "The on-demand timer will always be enabled alongside other timers"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:150
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:91 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:91
msgid "On-demand time" msgid "On-demand time"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:92 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:92
msgid "The current time used in on-demand mode" msgid "The current time used in on-demand mode"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:150 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:155
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:96 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:96
msgid "Key combination to toggle time" msgid "Key combination to toggle time"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:97 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:97
msgid "The key combination that will toggle time in on-demand mode" msgid "The key combination that will toggle time in on-demand mode"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:160 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:165
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:106 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:106
msgid "On-demand button placement" msgid "On-demand button placement"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:107 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:107
msgid "Where the on-demand button will be placed" msgid "Where the on-demand button will be placed"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:165 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:111 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:111
msgid "Use manual time source" msgid "Use manual time source"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:112 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:112
msgid "Disable automatic time source detection" msgid "Disable automatic time source detection"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:175
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:116 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:116
msgid "Sunrise time" msgid "Sunrise time"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:176
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:117 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:117
msgid "When the day starts" msgid "When the day starts"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:175 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:180
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:121 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:121
msgid "Sunset time" msgid "Sunset time"
msgstr "" msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:176 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:181
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:122 #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:122
msgid "When the day ends" msgid "When the day ends"
msgstr "" msgstr ""
@@ -381,7 +389,7 @@ msgstr ""
#: src/preferences/ui/backgrounds.ui:220 src/preferences/ui/backgrounds.ui:312 #: src/preferences/ui/backgrounds.ui:220 src/preferences/ui/backgrounds.ui:312
#: src/preferences/ui/commands.ui:206 src/preferences/ui/commands.ui:300 #: src/preferences/ui/commands.ui:206 src/preferences/ui/commands.ui:300
#: src/preferences/ui/schedule.ui:756 #: src/preferences/ui/schedule.ui:857
msgid "Clear" msgid "Clear"
msgstr "" msgstr ""
@@ -435,7 +443,7 @@ msgid "Press your keyboard shortcut..."
msgstr "" msgstr ""
#: src/preferences/ui/ondemand_keyboard_shortcut_dialog.ui:76 #: src/preferences/ui/ondemand_keyboard_shortcut_dialog.ui:76
#: src/preferences/ui/schedule.ui:727 #: src/preferences/ui/schedule.ui:828
msgid "Keyboard shortcut" msgid "Keyboard shortcut"
msgstr "" msgstr ""
@@ -454,71 +462,80 @@ msgid ""
"If you prefer, you can manually choose a time source.</small>" "If you prefer, you can manually choose a time source.</small>"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:174 #: src/preferences/ui/schedule.ui:191
msgid "Always show on-demand controls"
msgstr ""
#: src/preferences/ui/schedule.ui:204
msgid ""
"<small>This allows you to override the current time when using a schedule.</"
"small>"
msgstr ""
#: src/preferences/ui/schedule.ui:266
msgid "Manual time source" msgid "Manual time source"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:194 src/preferences/ui/schedule.ui:300 #: src/preferences/ui/schedule.ui:286 src/preferences/ui/schedule.ui:392
#: src/preferences/ui/schedule.ui:416 #: src/preferences/ui/schedule.ui:508
msgid "Night Light" msgid "Night Light"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:209 #: src/preferences/ui/schedule.ui:301
msgid "Location Services" msgid "Location Services"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:224 #: src/preferences/ui/schedule.ui:316
msgid "Manual schedule" msgid "Manual schedule"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:239 src/preferences/ui/schedule.ui:685 #: src/preferences/ui/schedule.ui:331 src/preferences/ui/schedule.ui:786
#: src/preferences/ui/schedule.ui:865
msgid "On-demand" msgid "On-demand"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:287 #: src/preferences/ui/schedule.ui:379
msgid "No preferences" msgid "No preferences"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:348 #: src/preferences/ui/schedule.ui:440
msgid "Follow <i>Disable until tomorrow</i>" msgid "Follow <i>Disable until tomorrow</i>"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:362 #: src/preferences/ui/schedule.ui:454
msgid "" msgid ""
"<small>When Night Light is temporarily disabled, the extension will switch " "<small>When Night Light is temporarily disabled, the extension will switch "
"to day variants.</small>" "to day variants.</small>"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:432 src/preferences/ui/schedule.ui:669 #: src/preferences/ui/schedule.ui:524 src/preferences/ui/schedule.ui:761
msgid "Manual schedule times" msgid "Manual schedule times"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:474 #: src/preferences/ui/schedule.ui:566
msgid "Sunrise" msgid "Sunrise"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:510 src/preferences/ui/schedule.ui:617 #: src/preferences/ui/schedule.ui:602 src/preferences/ui/schedule.ui:709
msgid ":" msgid ":"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:581 #: src/preferences/ui/schedule.ui:673
msgid "Sunset" msgid "Sunset"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:819 #: src/preferences/ui/schedule.ui:920
msgid "Button location" msgid "Button location"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:835 #: src/preferences/ui/schedule.ui:936
msgid "None" msgid "None"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:836 #: src/preferences/ui/schedule.ui:937
msgid "Top bar" msgid "Top bar"
msgstr "" msgstr ""
#: src/preferences/ui/schedule.ui:837 #: src/preferences/ui/schedule.ui:938
msgid "System menu" msgid "System menu"
msgstr "" msgstr ""
+16 -3
View File
@@ -49,6 +49,14 @@ var SchedulePreferences = class {
Gio.SettingsBindFlags.INVERT_BOOLEAN Gio.SettingsBindFlags.INVERT_BOOLEAN
); );
const alwaysEnableOndemandSwitch = this._builder.get_object('always_enable_ondemand_switch');
settings.time.settings.bind(
'always-enable-ondemand',
alwaysEnableOndemandSwitch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const manual = this._builder.get_object('manual'); const manual = this._builder.get_object('manual');
settings.time.settings.bind( settings.time.settings.bind(
'manual-time-source', 'manual-time-source',
@@ -122,9 +130,6 @@ var SchedulePreferences = class {
case 'schedule': case 'schedule':
manualPrefsStack.set_visible_child_name('schedule_times'); manualPrefsStack.set_visible_child_name('schedule_times');
break; break;
case 'ondemand':
manualPrefsStack.set_visible_child_name('ondemand');
break;
default: default:
manualPrefsStack.set_visible_child_name('none'); manualPrefsStack.set_visible_child_name('none');
} }
@@ -198,6 +203,14 @@ var SchedulePreferences = class {
settings.time.scheduleSunset = newTime; settings.time.scheduleSunset = newTime;
}); });
const ondemand = this._builder.get_object('ondemand');
const updateOndemandVisibility = () => {
ondemand.visible = settings.time.alwaysEnableOndemand || settings.time.timeSource === 'ondemand';
};
settings.time.connect('always-enable-ondemand-changed', () => updateOndemandVisibility());
settings.time.connect('time-source-changed', () => updateOndemandVisibility());
updateOndemandVisibility();
const ondemandShortcutButton = this._builder.get_object('ondemand_shortcut_button'); const ondemandShortcutButton = this._builder.get_object('ondemand_shortcut_button');
const updateOndemandShortcutButtonLabel = () => { const updateOndemandShortcutButtonLabel = () => {
const label = settings.time.ondemandKeybinding; const label = settings.time.ondemandKeybinding;
+289 -195
View File
@@ -59,7 +59,7 @@ Author: Romain Vigier
<property name="spacing">30</property> <property name="spacing">30</property>
<property name="baseline-position">top</property> <property name="baseline-position">top</property>
<child> <child>
<object class="GtkFrame" id="auto"> <object class="GtkFrame" id="general">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label-xalign">0</property> <property name="label-xalign">0</property>
@@ -148,6 +148,98 @@ Author: Romain Vigier
</child> </child>
</object> </object>
</child> </child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">16</property>
<property name="margin-right">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="spacing">30</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Always show on-demand controls</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">&lt;small&gt;This allows you to override the current time when using a schedule.&lt;/small&gt;</property>
<property name="use-markup">True</property>
<property name="wrap">True</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="always_enable_ondemand_switch">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object> </object>
</child> </child>
<child type="label_item"> <child type="label_item">
@@ -671,200 +763,7 @@ Author: Romain Vigier
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="ondemand"> <placeholder/>
<property name="width-request">600</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">On-demand</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<child>
<object class="GtkListBox">
<property name="width-request">600</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="selection-mode">none</property>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">16</property>
<property name="margin-right">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="spacing">30</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Keyboard shortcut</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkButton" id="ondemand_shortcut_button">
<property name="label" translatable="yes">Choose</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ondemand_shortcut_clear_button">
<property name="label" translatable="yes">Clear</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="linked"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">16</property>
<property name="margin-right">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="spacing">30</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Button location</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="ondemand_button_placement_combo">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="active">1</property>
<property name="active-id">panel</property>
<items>
<item id="none" translatable="yes">None</item>
<item id="panel" translatable="yes">Top bar</item>
<item id="menu" translatable="yes">System menu</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="name">ondemand</property>
<property name="title" translatable="yes">On-demand</property>
<property name="position">3</property>
</packing>
</child> </child>
</object> </object>
<packing> <packing>
@@ -873,5 +772,200 @@ Author: Romain Vigier
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="ondemand">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">On-demand</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<child>
<object class="GtkListBox">
<property name="width-request">600</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="selection-mode">none</property>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">16</property>
<property name="margin-right">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="spacing">30</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Keyboard shortcut</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkButton" id="ondemand_shortcut_button">
<property name="label" translatable="yes">Choose</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ondemand_shortcut_clear_button">
<property name="label" translatable="yes">Clear</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="linked"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">16</property>
<property name="margin-right">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="spacing">30</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Button location</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="ondemand_button_placement_combo">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="active">1</property>
<property name="active-id">panel</property>
<items>
<item id="none" translatable="yes">None</item>
<item id="panel" translatable="yes">Top bar</item>
<item id="menu" translatable="yes">System menu</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object> </object>
</interface> </interface>
@@ -136,6 +136,11 @@
<summary>Follow Night Light "Disable until tomorrow"</summary> <summary>Follow Night Light "Disable until tomorrow"</summary>
<description>Switch back to day time when Night Light is temporarily disabled</description> <description>Switch back to day time when Night Light is temporarily disabled</description>
</key> </key>
<key name="always-enable-ondemand" type="b">
<default>false</default>
<summary>Always enable the on-demand timer</summary>
<description>The on-demand timer will always be enabled alongside other timers</description>
</key>
<key name="ondemand-time" type="s"> <key name="ondemand-time" type="s">
<choices> <choices>
<choice value="day"/> <choice value="day"/>
+16
View File
@@ -38,6 +38,7 @@ var TimeSettings = class {
this._timeSourceChangedConnect = this.settings.connect('changed::time-source', this._onTimeSourceChanged.bind(this)); this._timeSourceChangedConnect = this.settings.connect('changed::time-source', this._onTimeSourceChanged.bind(this));
this._manualTimeSourceChangedConnect = this.settings.connect('changed::manual-time-source', this._onManualTimeSourceChanged.bind(this)); this._manualTimeSourceChangedConnect = this.settings.connect('changed::manual-time-source', this._onManualTimeSourceChanged.bind(this));
this._nightlightFollowDisableConnect = this.settings.connect('changed::nightlight-follow-disable', this._onNightlightFollowDisableChanged.bind(this)); this._nightlightFollowDisableConnect = this.settings.connect('changed::nightlight-follow-disable', this._onNightlightFollowDisableChanged.bind(this));
this._alwaysEnableOndemandConnect = this.settings.connect('changed::always-enable-ondemand', this._onAlwaysEnableOndemandChanged.bind(this));
this._ondemandKeybindingChangedConnect = this.settings.connect('changed::nightthemeswitcher-ondemand-keybinding', this._onOndemandKeybindingChanged.bind(this)); this._ondemandKeybindingChangedConnect = this.settings.connect('changed::nightthemeswitcher-ondemand-keybinding', this._onOndemandKeybindingChanged.bind(this));
this._ondemandButtonPlacementChangedConnect = this.settings.connect('changed::ondemand-button-placement', this._onOndemandButtonPlacementChanged.bind(this)); this._ondemandButtonPlacementChangedConnect = this.settings.connect('changed::ondemand-button-placement', this._onOndemandButtonPlacementChanged.bind(this));
logDebug('System time signals connected.'); logDebug('System time signals connected.');
@@ -48,6 +49,7 @@ var TimeSettings = class {
this.settings.disconnect(this._timeSourceChangedConnect); this.settings.disconnect(this._timeSourceChangedConnect);
this.settings.disconnect(this._manualTimeSourceChangedConnect); this.settings.disconnect(this._manualTimeSourceChangedConnect);
this.settings.disconnect(this._nightlightFollowDisableConnect); this.settings.disconnect(this._nightlightFollowDisableConnect);
this.settings.disconnect(this._alwaysEnableOndemandConnect);
this.settings.disconnect(this._ondemandKeybindingChangedConnect); this.settings.disconnect(this._ondemandKeybindingChangedConnect);
this.settings.disconnect(this._ondemandButtonPlacementChangedConnect); this.settings.disconnect(this._ondemandButtonPlacementChangedConnect);
logDebug('Time settings signals disconnected.'); logDebug('Time settings signals disconnected.');
@@ -83,6 +85,15 @@ var TimeSettings = class {
this.settings.set_boolean('nightlight-follow-disable', value); this.settings.set_boolean('nightlight-follow-disable', value);
} }
get alwaysEnableOndemand() {
return this.settings.get_boolean('always-enable-ondemand');
}
set alwaysEnableOndemand(value) {
if (value !== this.alwaysEnableOndemand)
this.settings.set_boolean('always-enable-ondemand', value);
}
get ondemandTime() { get ondemandTime() {
return this.settings.get_string('ondemand-time'); return this.settings.get_string('ondemand-time');
} }
@@ -145,6 +156,11 @@ var TimeSettings = class {
this.emit('nightlight-follow-disable-changed', this.nightlightFollowDisable); this.emit('nightlight-follow-disable-changed', this.nightlightFollowDisable);
} }
_onAlwaysEnableOndemandChanged(_settings, _changedKey) {
logDebug(`Always enable on-demand timer has been ${this.alwaysEnableOndemand ? 'ena' : 'disa'}bled.`);
this.emit('always-enable-ondemand-changed', this.alwaysEnableOndemand);
}
_onOndemandKeybindingChanged(_settings, _changedKey) { _onOndemandKeybindingChanged(_settings, _changedKey) {
if (this.ondemandKeybinding) if (this.ondemandKeybinding)
logDebug(`On-demand keybinding has changed to ${this.ondemandKeybinding}.`); logDebug(`On-demand keybinding has changed to ${this.ondemandKeybinding}.`);