From 9788083be6aab0e52934c999da214f607be35be8 Mon Sep 17 00:00:00 2001 From: Romain Vigier Date: Tue, 16 Aug 2022 01:39:57 +0200 Subject: [PATCH] Night Light Timer: Remove 'Follow Disable until tomorrow' --- ....extensions.nightthemeswitcher.gschema.xml | 3 -- src/data/ui/SchedulePage.ui | 18 ----------- src/modules/TimerNightlight.js | 31 +------------------ src/preferences/SchedulePage.js | 5 --- 4 files changed, 1 insertion(+), 56 deletions(-) diff --git a/src/data/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml b/src/data/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml index ea4caf3..5d953b0 100644 --- a/src/data/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml +++ b/src/data/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml @@ -74,9 +74,6 @@ SPDX-License-Identifier: GPL-3.0-or-later "schedule" - - false - false diff --git a/src/data/ui/SchedulePage.ui b/src/data/ui/SchedulePage.ui index f2a7eee..f0c6905 100644 --- a/src/data/ui/SchedulePage.ui +++ b/src/data/ui/SchedulePage.ui @@ -57,24 +57,6 @@ SPDX-License-Identifier: GPL-3.0-or-later - - - Night Light - These settings only apply when Night Light is the time source. - - - Disable until tomorrow]]> - When Night Light is temporarily disabled, the extension will switch to day variants. - nightlight_follow_disable_switch - - - center - - - - - - Manual schedule diff --git a/src/modules/TimerNightlight.js b/src/modules/TimerNightlight.js index 4985c5c..5a2b9b1 100644 --- a/src/modules/TimerNightlight.js +++ b/src/modules/TimerNightlight.js @@ -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); diff --git a/src/preferences/SchedulePage.js b/src/preferences/SchedulePage.js index ee63260..65441e4 100644 --- a/src/preferences/SchedulePage.js +++ b/src/preferences/SchedulePage.js @@ -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);