Night Light Timer: Remove 'Follow Disable until tomorrow'
This commit is contained in:
@@ -74,9 +74,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</choices>
|
||||
<default>"schedule"</default>
|
||||
</key>
|
||||
<key name="nightlight-follow-disable" type="b">
|
||||
<default>false</default>
|
||||
</key>
|
||||
<key name="always-enable-ondemand" type="b">
|
||||
<default>false</default>
|
||||
</key>
|
||||
|
||||
@@ -57,24 +57,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwExpanderRow" id="nightlight_expander_row">
|
||||
<property name="title" translatable="yes">Night Light</property>
|
||||
<property name="subtitle" translatable="yes">These settings only apply when Night Light is the time source.</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>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="nightlight_follow_disable_switch">
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwExpanderRow">
|
||||
<property name="title" translatable="yes">Manual schedule</property>
|
||||
|
||||
@@ -28,23 +28,15 @@ const COLOR_INTERFACE = `
|
||||
* 'NightLightActive' property and will signal any change.
|
||||
*/
|
||||
var TimerNightlight = class {
|
||||
#settings;
|
||||
|
||||
#cancellable = null;
|
||||
#colorDbusProxy = null;
|
||||
#settingsConnections = [];
|
||||
#nightlightStateConnection = null;
|
||||
#previousNightlightState = null;
|
||||
|
||||
constructor() {
|
||||
this.#settings = extensionUtils.getSettings(`${Me.metadata['settings-schema']}.time`);
|
||||
}
|
||||
|
||||
async enable() {
|
||||
debug.message('Enabling Night Light Timer...');
|
||||
this.#cancellable = new Gio.Cancellable();
|
||||
this.#colorDbusProxy = await this.#createColorDbusProxy();
|
||||
this.#connectSettings();
|
||||
this.#listenToNightlightState();
|
||||
this.emit('time-changed', this.time);
|
||||
debug.message('Night Light Timer enabled.');
|
||||
@@ -53,7 +45,6 @@ var TimerNightlight = class {
|
||||
disable() {
|
||||
debug.message('Disabling Night Light Timer...');
|
||||
this.#stopListeningToNightlightState();
|
||||
this.#disconnectSettings();
|
||||
this.#colorDbusProxy = null;
|
||||
this.#cancellable.cancel();
|
||||
this.#cancellable = null;
|
||||
@@ -88,20 +79,6 @@ var TimerNightlight = class {
|
||||
});
|
||||
}
|
||||
|
||||
#connectSettings() {
|
||||
debug.message('Connecting Night Light Timer to settings...');
|
||||
this.#settingsConnections.push({
|
||||
settings: this.#settings,
|
||||
id: this.#settings.connect('changed::nightlight-follow-disable', this.#onNightlightFollowDisableChanged.bind(this)),
|
||||
});
|
||||
}
|
||||
|
||||
#disconnectSettings() {
|
||||
debug.message('Disconnecting Night Light Timer from settings...');
|
||||
this.#settingsConnections.forEach(connection => connection.settings.disconnect(connection.id));
|
||||
this.#settingsConnections = [];
|
||||
}
|
||||
|
||||
#listenToNightlightState() {
|
||||
debug.message('Listening to Night Light state...');
|
||||
this.#nightlightStateConnection = this.#colorDbusProxy.connect(
|
||||
@@ -119,10 +96,6 @@ var TimerNightlight = class {
|
||||
}
|
||||
|
||||
|
||||
#onNightlightFollowDisableChanged() {
|
||||
this.#onNightlightStateChanged();
|
||||
}
|
||||
|
||||
#onNightlightStateChanged(_sender, _dbusProperties) {
|
||||
const newState = this.#isNightlightActive();
|
||||
if (newState !== this.#previousNightlightState) {
|
||||
@@ -134,9 +107,7 @@ var TimerNightlight = class {
|
||||
|
||||
|
||||
#isNightlightActive() {
|
||||
return this.#settings.get_boolean('nightlight-follow-disable')
|
||||
? !this.#colorDbusProxy.DisabledUntilTomorrow && this.#colorDbusProxy.NightLightActive
|
||||
: this.#colorDbusProxy.NightLightActive;
|
||||
return this.#colorDbusProxy.NightLightActive;
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(TimerNightlight.prototype);
|
||||
|
||||
@@ -20,12 +20,10 @@ var SchedulePage = GObject.registerClass({
|
||||
'manual_time_source_switch',
|
||||
'time_source_combo_row',
|
||||
'always_show_ondemand_switch',
|
||||
'nightlight_follow_disable_switch',
|
||||
'schedule_sunrise_time_chooser',
|
||||
'schedule_sunset_time_chooser',
|
||||
'ondemand_shortcut_button',
|
||||
'ondemand_button_location_combo_row',
|
||||
'nightlight_expander_row',
|
||||
],
|
||||
}, class SchedulePage extends Adw.PreferencesPage {
|
||||
constructor(props = {}) {
|
||||
@@ -42,7 +40,6 @@ 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') });
|
||||
@@ -72,8 +69,6 @@ var SchedulePage = GObject.registerClass({
|
||||
|
||||
settings.bind('always-enable-ondemand', this._always_show_ondemand_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
settings.bind('nightlight-follow-disable', this._nightlight_follow_disable_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
settings.bind('schedule-sunrise', this._schedule_sunrise_time_chooser, 'time', Gio.SettingsBindFlags.DEFAULT);
|
||||
settings.bind('schedule-sunset', this._schedule_sunset_time_chooser, 'time', Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user