From 514690926c989c075bf63624929cd99127079cd0 Mon Sep 17 00:00:00 2001 From: Romain Date: Wed, 23 Sep 2020 10:14:19 +0000 Subject: [PATCH] Split settings into different files --- Makefile | 1 + src/compat.js | 23 +- src/extension.js | 12 +- src/modules/Backgrounder.js | 64 +- src/modules/Commander.js | 16 +- src/modules/CursorThemer.js | 60 +- src/modules/GtkThemer.js | 70 +- src/modules/IconThemer.js | 60 +- src/modules/SettingsManager.js | 607 ------------------ src/modules/ShellThemer.js | 74 ++- src/modules/Timer.js | 34 +- src/modules/TimerLocation.js | 4 +- src/modules/TimerOndemand.js | 20 +- src/modules/TimerSchedule.js | 2 +- src/po/fr.po | 387 ++++++----- src/po/nightthemeswitcher@romainvigier.fr.pot | 363 ++++++----- src/prefs.js | 235 +++---- ....extensions.nightthemeswitcher.gschema.xml | 107 +-- ...tensions.nightthemeswitcher.v0.gschema.xml | 155 +++++ src/settings/Backgrounds.js | 99 +++ src/settings/Commands.js | 99 +++ src/settings/CursorVariants.js | 101 +++ src/settings/GtkVariants.js | 117 ++++ src/settings/IconVariants.js | 101 +++ src/settings/Settings.js | 95 +++ src/settings/ShellVariants.js | 117 ++++ src/settings/System.js | 177 +++++ src/settings/Time.js | 147 +++++ src/settings/migrations/v0ToV1.js | 63 ++ src/utils.js | 9 + 30 files changed, 2121 insertions(+), 1298 deletions(-) delete mode 100644 src/modules/SettingsManager.js create mode 100644 src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml create mode 100644 src/settings/Backgrounds.js create mode 100644 src/settings/Commands.js create mode 100644 src/settings/CursorVariants.js create mode 100644 src/settings/GtkVariants.js create mode 100644 src/settings/IconVariants.js create mode 100644 src/settings/Settings.js create mode 100644 src/settings/ShellVariants.js create mode 100644 src/settings/System.js create mode 100644 src/settings/Time.js create mode 100644 src/settings/migrations/v0ToV1.js diff --git a/Makefile b/Makefile index 089d57d..a6388b0 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ build: build-clean --extra-source=./utils.js \ --extra-source=./modules/ \ --extra-source=./schemas/ \ + --extra-source=./settings/ \ --podir=./po/ \ --gettext-domain=$(UUID) \ --out-dir=./build \ diff --git a/src/compat.js b/src/compat.js index 6f1a0fc..a1df2bc 100644 --- a/src/compat.js +++ b/src/compat.js @@ -39,18 +39,27 @@ function extensionManagerInitialized() { function extensionManagerLookup(uuid) { - if (shellMinorVersion > 32) - return imports.ui.main.extensionManager.lookup(uuid); + try { + if (shellMinorVersion > 32) + return imports.ui.main.extensionManager.lookup(uuid); + else + return extensionUtils.extensions[uuid] || null; + } catch (_) { + return null; + } +} + + +function getSettings(schema) { + if (shellMinorVersion <= 30) + return Me.imports.convenience.getSettings(schema); else - return extensionUtils.extensions[uuid] || null; + return extensionUtils.getSettings(schema); } function getExtensionSettings() { - if (shellMinorVersion <= 30) - return Me.imports.convenience.getSettings(); - else - return extensionUtils.getSettings(); + return getSettings(); } diff --git a/src/extension.js b/src/extension.js index 8cccff4..f5351b7 100644 --- a/src/extension.js +++ b/src/extension.js @@ -24,7 +24,7 @@ const Me = extensionUtils.getCurrentExtension(); const compat = Me.imports.compat; const { logDebug } = Me.imports.utils; -const { SettingsManager } = Me.imports.modules.SettingsManager; +const { Settings } = Me.imports.settings.Settings; const { Timer } = Me.imports.modules.Timer; const { GtkThemer } = Me.imports.modules.GtkThemer; const { ShellThemer } = Me.imports.modules.ShellThemer; @@ -35,7 +35,7 @@ const { Commander } = Me.imports.modules.Commander; var enabled = false; -var settingsManager = null; +var settings = null; var timer = null; var gtkThemer = null; var shellThemer = null; @@ -54,7 +54,7 @@ function init() { function enable() { _awaitExtensionManagerInit().then(() => { logDebug('Enabling extension...'); - settingsManager = new SettingsManager(); + settings = new Settings(); timer = new Timer(); gtkThemer = new GtkThemer(); shellThemer = new ShellThemer(); @@ -63,7 +63,7 @@ function enable() { backgrounder = new Backgrounder(); commander = new Commander(); - settingsManager.enable(); + settings.enable(); gtkThemer.enable(); shellThemer.enable(); iconThemer.enable(); @@ -88,9 +88,9 @@ function disable() { backgrounder.disable(); commander.disable(); timer.disable(); - settingsManager.disable(); + settings.disable(); - settingsManager = null; + settings = null; timer = null; gtkThemer = null; shellThemer = null; diff --git a/src/modules/Backgrounder.js b/src/modules/Backgrounder.js index c9d1679..ff5e585 100644 --- a/src/modules/Backgrounder.js +++ b/src/modules/Backgrounder.js @@ -33,16 +33,16 @@ const { logDebug } = Me.imports.utils; var Backgrounder = class { constructor() { - this._backgroundsStatusChangedConnect = null; - this._backgroundTimeChangedConnect = null; + this._statusChangedConnect = null; + this._backgroundChangedConnect = null; + this._systemBackgroundChangedConnect = null; this._backgroundChangedConnect = null; - this._timeChangedConnect = null; } enable() { logDebug('Enabling Backgrounder...'); this._watchStatus(); - if (e.settingsManager.backgroundsEnabled) { + if (e.settings.backgrounds.enabled) { this._connectSettings(); this._connectTimer(); } @@ -60,76 +60,84 @@ var Backgrounder = class { _watchStatus() { logDebug('Watching backgrounds status...'); - this._backgroundsStatusChangedConnect = e.settingsManager.connect('backgrounds-status-changed', this._onBackgroundsStatusChanged.bind(this)); + this._statusChangedConnect = e.settings.backgrounds.connect('status-changed', this._onStatusChanged.bind(this)); } _unwatchStatus() { - if (this._backgroundsStatusChangedConnect) { - e.settingsManager.disconnect(this._backgroundsStatusChangedConnect); - this._backgroundsStatusChangedConnect = null; + if (this._statusChangedConnect) { + e.settings.backgrounds.disconnect(this._statusChangedConnect); + this._statusChangedConnect = null; } logDebug('Stopped watching backgrounds status.'); } _connectSettings() { logDebug('Connecting Backgrounder to settings...'); - this._backgroundTimeChangedConnect = e.settingsManager.connect('background-time-changed', this._onBackgroundTimeChanged.bind(this)); - this._backgroundChangedConnect = e.settingsManager.connect('background-changed', this._onBackgroundChanged.bind(this)); + this._backgroundChangedConnect = e.settings.backgrounds.connect('time-changed', this._onBackgroundChanged.bind(this)); + this._systemBackgroundChangedConnect = e.settings.system.connect('background-changed', this._onSystemBackgroundChanged.bind(this)); } _disconnectSettings() { - if (this._backgroundTimeChangedConnect) { - e.settingsManager.disconnect(this._backgroundTimeChangedConnect); - this._backgroundTimeChangedConnect = null; - } if (this._backgroundChangedConnect) { - e.settingsManager.disconnect(this._backgroundChangedConnect); + e.settings.backgrounds.disconnect(this._backgroundChangedConnect); this._backgroundChangedConnect = null; } + if (this._systemBackgroundChangedConnect) { + e.settings.system.disconnect(this._systemBackgroundChangedConnect); + this._systemBackgroundChangedConnect = null; + } logDebug('Disconnected Backgrounder from settings.'); } _connectTimer() { logDebug('Connecting Backgrounder to Timer...'); - this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this)); + this._backgroundChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this)); } _disconnectTimer() { - if (this._timeChangedConnect) { - e.timer.disconnect(this._timeChangedConnect); - this._timeChangedConnect = null; + if (this._backgroundChangedConnect) { + e.timer.disconnect(this._backgroundChangedConnect); + this._backgroundChangedConnect = null; } logDebug('Disconnected Backgrounder from Timer.'); } - _onBackgroundsStatusChanged(_settings, _enabled) { + _onStatusChanged(_settings, _enabled) { this.disable(); this.enable(); } - _onBackgroundTimeChanged(_settings, changedBackgroundTime) { + _onBackgroundChanged(_settings, changedBackgroundTime) { if (changedBackgroundTime === e.timer.time) - this._changeBackground(changedBackgroundTime); + this._changeSystemBackground(changedBackgroundTime); } - _onBackgroundChanged(_settings, newBackground) { + _onSystemBackgroundChanged(_settings, newBackground) { switch (e.timer.time) { case 'day': - e.settingsManager.backgroundDay = newBackground; + e.settings.backgrounds.day = newBackground; break; case 'night': - e.settingsManager.backgroundNight = newBackground; + e.settings.backgrounds.night = newBackground; } } _onTimeChanged(_timer, newTime) { - this._changeBackground(newTime); + this._changeSystemBackground(newTime); } - _changeBackground(time) { - e.settingsManager.background = time === 'day' ? e.settingsManager.backgroundDay : e.settingsManager.backgroundNight; + _changeSystemBackground(time) { + switch (time) { + case 'day': + if (e.settings.backgrounds.day) + e.settings.system.background = e.settings.backgrounds.day; + break; + case 'night': + if (e.settings.backgrounds.night) + e.settings.system.background = e.settings.backgrounds.night; + } } }; diff --git a/src/modules/Commander.js b/src/modules/Commander.js index a965486..40a9877 100644 --- a/src/modules/Commander.js +++ b/src/modules/Commander.js @@ -31,14 +31,14 @@ const { logDebug } = Me.imports.utils; var Commander = class { constructor() { - this._commandsStatusChangedConnect = null; + this._statusChangedConnect = null; this._timeChangedConnect = null; } enable() { logDebug('Enabling Commander...'); this._watchStatus(); - if (e.settingsManager.commandsEnabled) + if (e.settings.commands.enabled) this._connectTimer(); logDebug('Commander enabled.'); } @@ -53,13 +53,13 @@ var Commander = class { _watchStatus() { logDebug('Watching commands status...'); - this._commandsStatusChangedConnect = e.settingsManager.connect('commands-status-changed', this._onCommandsStatusChanged.bind(this)); + this._statusChangedConnect = e.settings.commands.connect('status-changed', this._onStatusChanged.bind(this)); } _unwatchStatus() { - if (this._commandsStatusChangedConnect) { - e.settingsManager.disconnect(this._commandsStatusChangedConnect); - this._commandsStatusChangedConnect = null; + if (this._statusChangedConnect) { + e.settings.commands.disconnect(this._statusChangedConnect); + this._statusChangedConnect = null; } logDebug('Stopped watching commands status.'); } @@ -78,7 +78,7 @@ var Commander = class { } - _onCommandsStatusChanged(_settings, _enabled) { + _onStatusChanged(_settings, _enabled) { this.disable(); this.enable(); } @@ -89,7 +89,7 @@ var Commander = class { _spawnCommand(time) { - const command = time === 'day' ? e.settingsManager.commandSunrise : e.settingsManager.commandSunset; + const command = time === 'day' ? e.settings.commands.sunrise : e.settings.commands.sunset; GLib.spawn_async(null, ['sh', '-c', command], null, GLib.SpawnFlags.SEARCH_PATH, null); logDebug(`Spawned ${time} command.`); } diff --git a/src/modules/CursorThemer.js b/src/modules/CursorThemer.js index 589bcf6..b44ee80 100644 --- a/src/modules/CursorThemer.js +++ b/src/modules/CursorThemer.js @@ -32,16 +32,16 @@ const { logDebug } = Me.imports.utils; var CursorThemer = class { constructor() { - this._cursorVariantsStatusChangedConnect = null; - this._cursorVariantChangedConnect = null; - this._cursorThemeChangedConnect = null; + this._statusChangedConnect = null; + this._variantChangedConnect = null; + this._systemCursorThemeChangedConnect = null; this._timeChangedConnect = null; } enable() { logDebug('Enabling Cursor Themer...'); this._watchStatus(); - if (e.settingsManager.cursorVariantsEnabled) { + if (e.settings.cursorVariants.enabled) { this._connectSettings(); this._connectTimer(); } @@ -59,31 +59,31 @@ var CursorThemer = class { _watchStatus() { logDebug('Watching cursor variants status...'); - this._cursorVariantsStatusChangedConnect = e.settingsManager.connect('cursor-variants-status-changed', this._onCursorVariantsStatusChanged.bind(this)); + this._statusChangedConnect = e.settings.cursorVariants.connect('status-changed', this._onStatusChanged.bind(this)); } _unwatchStatus() { - if (this._cursorVariantsStatusChangedConnect) { - e.settingsManager.disconnect(this._cursorVariantsStatusChangedConnect); - this._cursorVariantsStatusChangedConnect = null; + if (this._statusChangedConnect) { + e.settings.cursorVariants.disconnect(this._statusChangedConnect); + this._statusChangedConnect = null; } logDebug('Stopped watching cursor variants status.'); } _connectSettings() { logDebug('Connecting Cursor Themer to settings...'); - this._cursorVariantChangedConnect = e.settingsManager.connect('cursor-variant-changed', this._onCursorVariantChanged.bind(this)); - this._cursorThemeChangedConnect = e.settingsManager.connect('cursor-theme-changed', this._onCursorThemeChanged.bind(this)); + this._variantChangedConnect = e.settings.cursorVariants.connect('variant-changed', this._onVariantChanged.bind(this)); + this._systemCursorThemeChangedConnect = e.settings.system.connect('cursor-theme-changed', this._onSystemCursorThemeChanged.bind(this)); } _disconnectSettings() { - if (this._cursorVariantChangedConnect) { - e.settingsManager.disconnect(this._cursorVariantChangedConnect); - this._cursorVariantChangedConnect = null; + if (this._variantChangedConnect) { + e.settings.cursorVariants.disconnect(this._variantChangedConnect); + this._variantChangedConnect = null; } - if (this._cursorThemeChangedConnect) { - e.settingsManager.disconnect(this._cursorThemeChangedConnect); - this._cursorThemeChangedConnect = null; + if (this._systemCursorThemeChangedConnect) { + e.settings.system.disconnect(this._systemCursorThemeChangedConnect); + this._systemCursorThemeChangedConnect = null; } logDebug('Disconnected Cursor Themer from settings.'); } @@ -102,35 +102,43 @@ var CursorThemer = class { } - _onCursorVariantsStatusChanged(_settings, _enabled) { + _onStatusChanged(_settings, _enabled) { this.disable(); this.enable(); } - _onCursorVariantChanged(_settings, changedVariantTime) { + _onVariantChanged(_settings, changedVariantTime) { if (changedVariantTime === e.timer.time) - this._setVariant(changedVariantTime); + this._setSystemVariant(changedVariantTime); } - _onCursorThemeChanged(_settings, newTheme) { + _onSystemCursorThemeChanged(_settings, newTheme) { switch (e.timer.time) { case 'day': - e.settingsManager.cursorVariantDay = newTheme; + e.settings.cursorVariants.day = newTheme; break; case 'night': - e.settingsManager.cursorVariantNight = newTheme; + e.settings.cursorVariants.night = newTheme; } - this._setVariant(e.timer.time); + this._setSystemVariant(e.timer.time); } _onTimeChanged(_timer, newTime) { - this._setVariant(newTime); + this._setSystemVariant(newTime); } - _setVariant(time) { + _setSystemVariant(time) { logDebug(`Setting the cursor ${time} variant...`); - e.settingsManager.cursorTheme = time === 'day' ? e.settingsManager.cursorVariantDay : e.settingsManager.cursorVariantNight; + switch (time) { + case 'day': + if (e.settings.cursorVariants.day) + e.settings.system.cursorTheme = e.settings.cursorVariants.day; + break; + case 'night': + if (e.settings.cursorVariants.night) + e.settings.system.cursorTheme = e.settings.cursorVariants.night; + } } }; diff --git a/src/modules/GtkThemer.js b/src/modules/GtkThemer.js index cba1659..1cf7f83 100644 --- a/src/modules/GtkThemer.js +++ b/src/modules/GtkThemer.js @@ -43,10 +43,10 @@ const _ = Gettext.gettext; var GtkThemer = class { constructor() { - this._gtkVariantsStatusChangedConnect = null; - this._gtkVariantChangedConnect = null; - this._gtkThemeChangedConnect = null; - this._manualGtkVariantsChangedConnect = null; + this._statusChangedConnect = null; + this._variantChangedConnect = null; + this._manualChangedConnect = null; + this._systemGtkThemeChangedConnect = null; this._timeChangedConnect = null; } @@ -54,7 +54,7 @@ var GtkThemer = class { logDebug('Enabling GTK Themer...'); try { this._watchStatus(); - if (e.settingsManager.gtkVariantsEnabled) { + if (e.settings.gtkVariants.enabled) { this._connectSettings(); this._updateVariants(); this._connectTimer(); @@ -76,32 +76,36 @@ var GtkThemer = class { _watchStatus() { logDebug('Watching GTK variants status...'); - this._gtkVariantsStatusChangedConnect = e.settingsManager.connect('gtk-variants-status-changed', this._onGtkVariantsStatusChanged.bind(this)); + this._statusChangedConnect = e.settings.gtkVariants.connect('status-changed', this._onStatusChanged.bind(this)); } _unwatchStatus() { - if (this._gtkVariantsStatusChangedConnect) { - e.settingsManager.disconnect(this._gtkVariantsStatusChangedConnect); - this._gtkVariantsStatusChangedConnect = null; + if (this._statusChangedConnect) { + e.settings.gtkVariants.disconnect(this._statusChangedConnect); + this._statusChangedConnect = null; } logDebug('Stopped watching GTK variants status.'); } _connectSettings() { logDebug('Connecting GTK Themer to settings...'); - this._gtkVariantChangedConnect = e.settingsManager.connect('gtk-variant-changed', this._onGtkVariantChanged.bind(this)); - this._gtkThemeChangedConnect = e.settingsManager.connect('gtk-theme-changed', this._onGtkThemeChanged.bind(this)); - this._manualGtkVariantsChangedConnect = e.settingsManager.connect('manual-gtk-variants-changed', this._onManualGtkVariantsChanged.bind(this)); + this._variantChangedConnect = e.settings.gtkVariants.connect('variant-changed', this._onVariantChanged.bind(this)); + this._manualChangedConnect = e.settings.gtkVariants.connect('manual-changed', this._onManualChanged.bind(this)); + this._systemGtkThemeChangedConnect = e.settings.system.connect('gtk-theme-changed', this._onSystemGtkThemeChanged.bind(this)); } _disconnectSettings() { - if (this._gtkVariantChangedConnect) { - e.settingsManager.disconnect(this._gtkVariantChangedConnect); - this._gtkVariantChangedConnect = null; + if (this._variantChangedConnect) { + e.settings.gtkVariants.disconnect(this._variantChangedConnect); + this._variantChangedConnect = null; } - if (this._gtkThemeChangedConnect) { - e.settingsManager.disconnect(this._gtkThemeChangedConnect); - this._gtkThemeChangedConnect = null; + if (this._manualChangedConnect) { + e.settings.gtkVariants.disconnect(this._manualChangedConnect); + this._manualChangedConnect = null; + } + if (this._systemGtkThemeChangedConnect) { + e.settings.system.disconnect(this._systemGtkThemeChangedConnect); + this._systemGtkThemeChangedConnect = null; } logDebug('Disconnected GTK Themer from settings.'); } @@ -120,54 +124,54 @@ var GtkThemer = class { } - _onGtkVariantsStatusChanged(_settings, _enabled) { + _onStatusChanged(_settings, _enabled) { this.disable(); this.enable(); } - _onGtkVariantChanged(_settings, changedVariantTime) { + _onVariantChanged(_settings, changedVariantTime) { if (changedVariantTime === e.timer.time) - this._setVariant(changedVariantTime); + this._setSystemVariant(changedVariantTime); } - _onGtkThemeChanged(_settings, _newTheme) { + _onSystemGtkThemeChanged(_settings, _newTheme) { try { this._updateVariants(); - this._setVariant(e.timer.time); + this._setSystemVariant(e.timer.time); } catch (error) { notifyError(error); } } - _onManualGtkVariantsChanged(_settings, enabled) { + _onManualChanged(_settings, enabled) { this.disable(); this.enable(); if (enabled) - this._setVariant(e.timer.time); + this._setSystemVariant(e.timer.time); } _onTimeChanged(_timer, newTime) { - this._setVariant(newTime); + this._setSystemVariant(newTime); } _areVariantsUpToDate() { - return e.settingsManager.gtkTheme === e.settingsManager.gtkVariantDay || e.settingsManager.gtkTheme === e.settingsManager.gtkVariantNight; + return e.settings.system.gtkTheme === e.settings.gtkVariants.day || e.settings.system.gtkTheme === e.settings.gtkVariants.night; } - _setVariant(time) { + _setSystemVariant(time) { if (!time) return; logDebug(`Setting the GTK ${time} variant...`); - e.settingsManager.gtkTheme = time === 'day' ? e.settingsManager.gtkVariantDay : e.settingsManager.gtkVariantNight; + e.settings.system.gtkTheme = time === 'day' ? e.settings.gtkVariants.day : e.settings.gtkVariants.night; } _updateVariants() { - if (e.settingsManager.manualGtkVariants || this._areVariantsUpToDate()) + if (e.settings.gtkVariants.manual || this._areVariantsUpToDate()) return; logDebug('Updating GTK variants...'); - const originalTheme = e.settingsManager.gtkTheme; + const originalTheme = e.settings.system.gtkTheme; const variants = GtkVariants.guessFrom(originalTheme); const installedThemes = getInstalledGtkThemes(); @@ -176,8 +180,8 @@ var GtkThemer = class { throw new Error(message); } - e.settingsManager.gtkVariantDay = variants.get('day'); - e.settingsManager.gtkVariantNight = variants.get('night'); + e.settings.gtkVariants.day = variants.get('day'); + e.settings.gtkVariants.night = variants.get('night'); logDebug(`New GTK variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`); } diff --git a/src/modules/IconThemer.js b/src/modules/IconThemer.js index 462addf..2790a3f 100644 --- a/src/modules/IconThemer.js +++ b/src/modules/IconThemer.js @@ -32,16 +32,16 @@ const { logDebug } = Me.imports.utils; var IconThemer = class { constructor() { - this._iconVariantsStatusChangedConnect = null; - this._iconVariantChangedConnect = null; - this._iconThemeChangedConnect = null; + this._statusChangedConnect = null; + this._variantChangedConnect = null; + this._systemIconThemeChangedConnect = null; this._timeChangedConnect = null; } enable() { logDebug('Enabling Icon Themer...'); this._watchStatus(); - if (e.settingsManager.iconVariantsEnabled) { + if (e.settings.iconVariants.enabled) { this._connectSettings(); this._connectTimer(); } @@ -59,31 +59,31 @@ var IconThemer = class { _watchStatus() { logDebug('Watching icon variants status...'); - this._iconVariantsStatusChangedConnect = e.settingsManager.connect('icon-variants-status-changed', this._onIconVariantsStatusChanged.bind(this)); + this._statusChangedConnect = e.settings.iconVariants.connect('status-changed', this._onStatusChanged.bind(this)); } _unwatchStatus() { - if (this._iconVariantsStatusChangedConnect) { - e.settingsManager.disconnect(this._iconVariantsStatusChangedConnect); - this._iconVariantsStatusChangedConnect = null; + if (this._statusChangedConnect) { + e.settings.iconVariants.disconnect(this._statusChangedConnect); + this._statusChangedConnect = null; } logDebug('Stopped watching icon variants status.'); } _connectSettings() { logDebug('Connecting Icon Themer to settings...'); - this._iconVariantChangedConnect = e.settingsManager.connect('icon-variant-changed', this._onIconVariantChanged.bind(this)); - this._iconThemeChangedConnect = e.settingsManager.connect('icon-theme-changed', this._onIconThemeChanged.bind(this)); + this._variantChangedConnect = e.settings.iconVariants.connect('variant-changed', this._onVariantChanged.bind(this)); + this._systemIconThemeChangedConnect = e.settings.system.connect('icon-theme-changed', this._onSystemIconThemeChanged.bind(this)); } _disconnectSettings() { - if (this._iconVariantChangedConnect) { - e.settingsManager.disconnect(this._iconVariantChangedConnect); - this._iconVariantChangedConnect = null; + if (this._variantChangedConnect) { + e.settings.iconVariants.disconnect(this._variantChangedConnect); + this._variantChangedConnect = null; } - if (this._iconThemeChangedConnect) { - e.settingsManager.disconnect(this._iconThemeChangedConnect); - this._iconThemeChangedConnect = null; + if (this._systemIconThemeChangedConnect) { + e.settings.system.disconnect(this._systemIconThemeChangedConnect); + this._systemIconThemeChangedConnect = null; } logDebug('Disconnected Icon Themer from settings.'); } @@ -102,35 +102,43 @@ var IconThemer = class { } - _onIconVariantsStatusChanged(_settings, _enabled) { + _onStatusChanged(_settings, _enabled) { this.disable(); this.enable(); } - _onIconVariantChanged(_settings, changedVariantTime) { + _onVariantChanged(_settings, changedVariantTime) { if (changedVariantTime === e.timer.time) - this._setVariant(changedVariantTime); + this._setSystemVariant(changedVariantTime); } - _onIconThemeChanged(_settings, newTheme) { + _onSystemIconThemeChanged(_settings, newTheme) { switch (e.timer.time) { case 'day': - e.settingsManager.iconVariantDay = newTheme; + e.settings.iconVariants.day = newTheme; break; case 'night': - e.settingsManager.iconVariantNight = newTheme; + e.settings.iconVariants.night = newTheme; } - this._setVariant(e.timer.time); + this._setSystemVariant(e.timer.time); } _onTimeChanged(_timer, newTime) { - this._setVariant(newTime); + this._setSystemVariant(newTime); } - _setVariant(time) { + _setSystemVariant(time) { logDebug(`Setting the icon ${time} variant...`); - e.settingsManager.iconTheme = time === 'day' ? e.settingsManager.iconVariantDay : e.settingsManager.iconVariantNight; + switch (time) { + case 'day': + if (e.settings.iconVariants.day) + e.settings.system.iconTheme = e.settings.iconVariants.day; + break; + case 'night': + if (e.settings.iconVariants.night) + e.settings.system.iconTheme = e.settings.iconVariants.night; + } } }; diff --git a/src/modules/SettingsManager.js b/src/modules/SettingsManager.js deleted file mode 100644 index 313a045..0000000 --- a/src/modules/SettingsManager.js +++ /dev/null @@ -1,607 +0,0 @@ -/* -Night Theme Switcher Gnome Shell extension - -Copyright (C) 2020 Romain Vigier - -This program is free software: you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation, either version 3 of the License, or (at your option) any later -version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program. If not, see . -*/ - -const { Gio } = imports.gi; -const { extensionUtils } = imports.misc; -const Signals = imports.signals; - -const Me = extensionUtils.getCurrentExtension(); - -const compat = Me.imports.compat; -const { logDebug, getUserthemesExtension, getUserthemesSettings } = Me.imports.utils; - - -/** - * The Settings Manager centralizes all the different settings the extension - * needs. It handles getting and settings values as well as signaling any - * changes. - */ -var SettingsManager = class { - - constructor() { - logDebug('Initializing settings...'); - this._extensionsSettings = compat.getExtensionSettings(); - this._colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' }); - this._locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' }); - this._interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' }); - this._backgroundSettings = new Gio.Settings({ schema: 'org.gnome.desktop.background' }); - this._userthemesSettings = getUserthemesSettings(); - logDebug('Settings initialized.'); - } - - enable() { - logDebug('Connecting settings signals...'); - this._gtkVariantsStatusChangedConnect = this._extensionsSettings.connect('changed::gtk-variants-enabled', this._onGtkVariantsStatusChanged.bind(this)); - this._gtkVariantDayChangedConnect = this._extensionsSettings.connect('changed::gtk-variant-day', this._onGtkVariantDayChanged.bind(this)); - this._gtkVariantNightChangedConnect = this._extensionsSettings.connect('changed::gtk-variant-night', this._onGtkVariantNightChanged.bind(this)); - this._manualGtkVariantsChangedConnect = this._extensionsSettings.connect('changed::manual-gtk-variants', this._onManualGtkVariantsChanged.bind(this)); - this._shellVariantsStatusChangedConnect = this._extensionsSettings.connect('changed::shell-variants-enabled', this._onShellVariantsStatusChanged.bind(this)); - this._shellVariantDayChangedConnect = this._extensionsSettings.connect('changed::shell-variant-day', this._onShellVariantDayChanged.bind(this)); - this._shellVariantNightChangedConnect = this._extensionsSettings.connect('changed::shell-variant-night', this._onShellVariantNightChanged.bind(this)); - this._manualShellVariantsChangedConnect = this._extensionsSettings.connect('changed::manual-shell-variants', this._onManualShellVariantsChanged.bind(this)); - this._iconVariantsStatusConnect = this._extensionsSettings.connect('changed::icon-variants-enabled', this._onIconVariantsStatusChanged.bind(this)); - this._iconVariantDayChangedConnect = this._extensionsSettings.connect('changed::icon-variant-day', this._onIconVariantDayChanged.bind(this)); - this._iconVariantNightChangedConnect = this._extensionsSettings.connect('changed::icon-variant-night', this._onIconVariantNightChanged.bind(this)); - this._cursorVariantsStatusConnect = this._extensionsSettings.connect('changed::cursor-variants-enabled', this._onCursorVariantsStatusChanged.bind(this)); - this._cursorVariantDayChangedConnect = this._extensionsSettings.connect('changed::cursor-variant-day', this._onCursorVariantDayChanged.bind(this)); - this._cursorVariantNightChangedConnect = this._extensionsSettings.connect('changed::cursor-variant-night', this._onCursorVariantNightChanged.bind(this)); - this._timeSourceChangedConnect = this._extensionsSettings.connect('changed::time-source', this._onTimeSourceChanged.bind(this)); - this._manualTimeSourceChangedConnect = this._extensionsSettings.connect('changed::manual-time-source', this._onManualTimeSourceChanged.bind(this)); - this._ondemandKeybindingChangedConnect = this._extensionsSettings.connect('changed::nightthemeswitcher-ondemand-keybinding', this._onOndemandKeybindingChanged.bind(this)); - this._ondemandButtonPlacementChangedConnect = this._extensionsSettings.connect('changed::ondemand-button-placement', this._onOndemandButtonPlacementChanged.bind(this)); - this._commandsStatusConnect = this._extensionsSettings.connect('changed::commands-enabled', this._onCommandsStatusChanged.bind(this)); - this._backgroundsStatusConnect = this._extensionsSettings.connect('changed::backgrounds-enabled', this._onBackgroundsStatusChanged.bind(this)); - this._backgroundDayChangedConnect = this._extensionsSettings.connect('changed::background-day', this._onBackgroundDayChanged.bind(this)); - this._backgroundNightChangedConnect = this._extensionsSettings.connect('changed::background-night', this._onBackgroundNightChanged.bind(this)); - this._nightlightStatusConnect = this._colorSettings.connect('changed::night-light-enabled', this._onNightlightStatusChanged.bind(this)); - this._locationStatusConnect = this._locationSettings.connect('changed::enabled', this._onLocationStatusChanged.bind(this)); - this._gtkThemeChangedConnect = this._interfaceSettings.connect('changed::gtk-theme', this._onGtkThemeChanged.bind(this)); - this._iconThemeChangedConnect = this._interfaceSettings.connect('changed::icon-theme', this._onIconThemeChanged.bind(this)); - this._cursorThemeChangedConnect = this._interfaceSettings.connect('changed::cursor-theme', this._onCursorThemeChanged.bind(this)); - this._backgroundChangedConnect = this._backgroundSettings.connect('changed::picture-uri', this._onBackgroundChanged.bind(this)); - if (this._userthemesSettings) - this._shell_theme_changed_connect = this._userthemesSettings.connect('changed::name', this._onShellThemeChanged.bind(this)); - logDebug('Settings signals connected.'); - } - - disable() { - logDebug('Disconnecting settings signals...'); - this._extensionsSettings.disconnect(this._gtkVariantsStatusChangedConnect); - this._extensionsSettings.disconnect(this._gtkVariantDayChangedConnect); - this._extensionsSettings.disconnect(this._gtkVariantNightChangedConnect); - this._extensionsSettings.disconnect(this._manualGtkVariantsChangedConnect); - this._extensionsSettings.disconnect(this._shellVariantsStatusChangedConnect); - this._extensionsSettings.disconnect(this._shellVariantDayChangedConnect); - this._extensionsSettings.disconnect(this._shellVariantNightChangedConnect); - this._extensionsSettings.disconnect(this._manualShellVariantsChangedConnect); - this._extensionsSettings.disconnect(this._iconVariantsStatusConnect); - this._extensionsSettings.disconnect(this._iconVariantDayChangedConnect); - this._extensionsSettings.disconnect(this._iconVariantNightChangedConnect); - this._extensionsSettings.disconnect(this._cursorVariantsStatusConnect); - this._extensionsSettings.disconnect(this._cursorVariantDayChangedConnect); - this._extensionsSettings.disconnect(this._cursorVariantNightChangedConnect); - this._extensionsSettings.disconnect(this._timeSourceChangedConnect); - this._extensionsSettings.disconnect(this._manualTimeSourceChangedConnect); - this._extensionsSettings.disconnect(this._ondemandKeybindingChangedConnect); - this._extensionsSettings.disconnect(this._ondemandButtonPlacementChangedConnect); - this._extensionsSettings.disconnect(this._commandsStatusConnect); - this._extensionsSettings.disconnect(this._backgroundsStatusConnect); - this._extensionsSettings.disconnect(this._backgroundDayChangedConnect); - this._extensionsSettings.disconnect(this._backgroundNightChangedConnect); - this._colorSettings.disconnect(this._nightlightStatusConnect); - this._locationSettings.disconnect(this._locationStatusConnect); - this._interfaceSettings.disconnect(this._gtkThemeChangedConnect); - this._interfaceSettings.disconnect(this._iconThemeChangedConnect); - this._interfaceSettings.disconnect(this._cursorThemeChangedConnect); - this._backgroundSettings.disconnect(this._backgroundChangedConnect); - if (this._userthemesSettings) - this._userthemesSettings.disconnect(this._shell_theme_changed_connect); - logDebug('Settings signals disconnected.'); - } - - /** - * SETTERS AND GETTERS - */ - - /* GTK variants settings */ - - get gtkVariantsEnabled() { - return this._extensionsSettings.get_boolean('gtk-variants-enabled'); - } - - get gtkVariantDay() { - return this._extensionsSettings.get_string('gtk-variant-day'); - } - - set gtkVariantDay(value) { - if (value !== this.gtkVariantDay) { - this._extensionsSettings.set_string('gtk-variant-day', value); - logDebug(`The GTK day variant has been set to '${value}'.`); - } - } - - get gtkVariantNight() { - return this._extensionsSettings.get_string('gtk-variant-night'); - } - - set gtkVariantNight(value) { - if (value !== this.gtkVariantNight) { - this._extensionsSettings.set_string('gtk-variant-night', value); - logDebug(`The GTK night variant has been set to '${value}'.`); - } - } - - get manualGtkVariants() { - return this._extensionsSettings.get_boolean('manual-gtk-variants'); - } - - - /* Shell variants settings */ - - get shellVariantsEnabled() { - return this._extensionsSettings.get_boolean('shell-variants-enabled'); - } - - get shellVariantDay() { - return this._extensionsSettings.get_string('shell-variant-day'); - } - - set shellVariantDay(value) { - if (value !== this.shellVariantDay) { - this._extensionsSettings.set_string('shell-variant-day', value); - logDebug(`The shell day variant has been set to '${value}'.`); - } - } - - get shellVariantNight() { - return this._extensionsSettings.get_string('shell-variant-night'); - } - - set shellVariantNight(value) { - if (value !== this.shellVariantNight) { - this._extensionsSettings.set_string('shell-variant-night', value); - logDebug(`The shell night variant has been set to '${value}'.`); - } - } - - get manualShellVariants() { - return this._extensionsSettings.get_boolean('manual-shell-variants'); - } - - /* Cursor variants settings */ - - get cursorVariantsEnabled() { - return this._extensionsSettings.get_boolean('cursor-variants-enabled'); - } - - get cursorVariantDay() { - return this._extensionsSettings.get_string('cursor-variant-day') || this.cursorTheme; - } - - set cursorVariantDay(value) { - if (value !== this.cursorVariantDay) { - this._extensionsSettings.set_string('cursor-variant-day', value); - logDebug(`The cursor day variant has been set to '${value}'.`); - } - } - - get cursorVariantNight() { - return this._extensionsSettings.get_string('cursor-variant-night') || this.cursorTheme; - } - - set cursorVariantNight(value) { - if (value !== this.cursorVariantNight) { - this._extensionsSettings.set_string('cursor-variant-night', value); - logDebug(`The cursor night variant has been set to '${value}'.`); - } - } - - /* Icon variants settings */ - - get iconVariantsEnabled() { - return this._extensionsSettings.get_boolean('icon-variants-enabled'); - } - - get iconVariantDay() { - return this._extensionsSettings.get_string('icon-variant-day') || this.iconTheme; - } - - set iconVariantDay(value) { - if (value !== this.iconVariantDay) { - this._extensionsSettings.set_string('icon-variant-day', value); - logDebug(`The icon day variant has been set to '${value}'.`); - } - } - - get iconVariantNight() { - return this._extensionsSettings.get_string('icon-variant-night') || this.iconTheme; - } - - set iconVariantNight(value) { - if (value !== this.iconVariantNight) { - this._extensionsSettings.set_string('icon-variant-night', value); - logDebug(`The icon night variant has been set to '${value}'.`); - } - } - - - /* Time source settings */ - - get timeSource() { - return this._extensionsSettings.get_string('time-source'); - } - - set timeSource(value) { - if (value !== this.timeSource) { - this._extensionsSettings.set_string('time-source', value); - logDebug(`The time source has been set to ${value}.`); - } - } - - get manualTimeSource() { - return this._extensionsSettings.get_boolean('manual-time-source'); - } - - get ondemandTime() { - return this._extensionsSettings.get_string('ondemand-time'); - } - - set ondemandTime(value) { - if (value !== this.ondemandTime) { - this._extensionsSettings.set_string('ondemand-time', value); - logDebug(`The on-demand time has been set to ${value}.`); - } - } - - get ondemandKeybinding() { - return this._extensionsSettings.get_strv('nightthemeswitcher-ondemand-keybinding')[0]; - } - - get ondemandButtonPlacement() { - return this._extensionsSettings.get_string('ondemand-button-placement'); - } - - get scheduleSunrise() { - return this._extensionsSettings.get_double('schedule-sunrise'); - } - - get scheduleSunset() { - return this._extensionsSettings.get_double('schedule-sunset'); - } - - - /* Commands settings */ - - get commandsEnabled() { - return this._extensionsSettings.get_boolean('commands-enabled'); - } - - get commandSunrise() { - return this._extensionsSettings.get_string('command-sunrise'); - } - - get commandSunset() { - return this._extensionsSettings.get_string('command-sunset'); - } - - - /* Background settings */ - - get backgroundsEnabled() { - return this._extensionsSettings.get_boolean('backgrounds-enabled'); - } - - get backgroundDay() { - return this._extensionsSettings.get_string('background-day') || this.background; - } - - set backgroundDay(value) { - this._extensionsSettings.set_string('background-day', value); - } - - get backgroundNight() { - return this._extensionsSettings.get_string('background-night') || this.background; - } - - set backgroundNight(value) { - this._extensionsSettings.set_string('background-night', value); - } - - - /* Night Light settings */ - - get nightlightEnabled() { - return this._colorSettings.get_boolean('night-light-enabled'); - } - - - /* Location settings */ - - get locationEnabled() { - return this._locationSettings.get_boolean('enabled'); - } - - - /* GTK theme settings */ - - get gtkTheme() { - return this._interfaceSettings.get_string('gtk-theme'); - } - - set gtkTheme(value) { - if (value !== this.gtkTheme) { - this._interfaceSettings.set_string('gtk-theme', value); - logDebug(`GTK theme has been set to '${value}'.`); - } - } - - /* Shell theme settings */ - - get shellTheme() { - if (this._userthemesSettings) - return this._userthemesSettings.get_string('name'); - else - return ''; - } - - set shellTheme(value) { - if (this._userthemesSettings && value !== this.shellTheme) - this._userthemesSettings.set_string('name', value); - } - - get useUserthemes() { - const extension = getUserthemesExtension(); - return extension && extension.state === 1; - } - - - /* Icon theme settings */ - - get iconTheme() { - return this._interfaceSettings.get_string('icon-theme'); - } - - set iconTheme(value) { - if (value !== this.iconTheme) { - this._interfaceSettings.set_string('icon-theme', value); - logDebug(`Icon theme has been set to '${value}'.`); - } - } - - - /* Cursor theme settings */ - - get cursorTheme() { - return this._interfaceSettings.get_string('cursor-theme'); - } - - set cursorTheme(value) { - if (value !== this.cursorTheme) { - this._interfaceSettings.set_string('cursor-theme', value); - logDebug(`Cursor theme has been set to '${value}'.`); - } - } - - - /* Background settings */ - - get background() { - return this._backgroundSettings.get_string('picture-uri'); - } - - set background(value) { - if (value !== this.background) - this._backgroundSettings.set_string('picture-uri', value); - } - - - /** - * SIGNALS - */ - - /* GTK variants */ - - _onGtkVariantsStatusChanged(_settings, _changedKey) { - logDebug(`GTK variants have been ${this.gtkVariantsEnabled ? 'ena' : 'disa'}bled.`); - this.emit('gtk-variants-status-changed', this.gtkVariantsEnabled); - } - - _onGtkVariantDayChanged(_settings, _changedKey) { - logDebug(`GTK day variant has changed to '${this.gtkVariantDay}'.`); - this.emit('gtk-variant-changed', 'day'); - } - - _onGtkVariantNightChanged(_settings, _changedKey) { - logDebug(`GTK night variant has changed to '${this.gtkVariantNight}'.`); - this.emit('gtk-variant-changed', 'night'); - } - - _onManualGtkVariantsChanged(_settings, _changedKey) { - logDebug(`Manual GTK variants have been ${this.manualGtkVariants ? 'ena' : 'disa'}bled.`); - this.emit('manual-gtk-variants-changed', this.manualGtkVariants); - } - - - /* Shell variants */ - - _onShellVariantsStatusChanged(_settings, _changedKey) { - logDebug(`Shell variants have been ${this.shellVariantsEnabled ? 'ena' : 'disa'}bled.`); - this.emit('shell-variants-status-changed', this.shellVariantsEnabled); - } - - _onShellVariantDayChanged(_settings, _changedKey) { - logDebug(`Shell day variant has changed to '${this.shellVariantDay}'.`); - this.emit('shell-variant-changed', 'day'); - } - - _onShellVariantNightChanged(_settings, _changedKey) { - logDebug(`Shell night variant has changed to '${this.shellVariantNight}'.`); - this.emit('shell-variant-changed', 'night'); - } - - _onManualShellVariantsChanged(_settings, _changedKey) { - logDebug(`Manual Shell variants have been ${this.manualShellVariants ? 'ena' : 'disa'}bled.`); - this.emit('manual-shell-variants-changed', this.manualShellVariants); - } - - - /* Cursor variants */ - - _onCursorVariantsStatusChanged(_settings, _changedKey) { - logDebug(`Cursor variants have been ${this.cursorVariantsEnabled ? 'ena' : 'disa'}bled.`); - this.emit('cursor-variants-status-changed', this.cursorVariantsEnabled); - } - - _onCursorVariantDayChanged(_settings, _changedKey) { - logDebug(`Cursor day variant has changed to '${this.cursorVariantDay}'.`); - this.emit('cursor-variant-changed', 'day'); - } - - _onCursorVariantNightChanged(_settings, _changedKey) { - logDebug(`Cursor night variant has changed to '${this.cursorVariantNight}'.`); - this.emit('cursor-variant-changed', 'night'); - } - - - /* Icon variants */ - - _onIconVariantsStatusChanged(_settings, _changedKey) { - logDebug(`Icon variants have been ${this.iconVariantsEnabled ? 'ena' : 'disa'}bled.`); - this.emit('icon-variants-status-changed', this.iconVariantsEnabled); - } - - _onIconVariantDayChanged(_settings, _changedKey) { - logDebug(`Icon day variant has changed to '${this.iconVariantDay}'.`); - this.emit('icon-variant-changed', 'day'); - } - - _onIconVariantNightChanged(_settings, _changedKey) { - logDebug(`Icon night variant has changed to '${this.iconVariantNight}'.`); - this.emit('icon-variant-changed', 'night'); - } - - - /* Time source */ - - _onTimeSourceChanged(_settings, _changedKey) { - logDebug(`Time source has changed to ${this.timeSource}.`); - this.emit('time-source-changed', this.timeSource); - } - - _onManualTimeSourceChanged(_settings, _changedKey) { - logDebug(`Manual time source has been ${this.manualTimeSource ? 'ena' : 'disa'}bled.`); - this.emit('manual-time-source-changed', this.manualTimeSource); - } - - _onOndemandKeybindingChanged(_settings, _changedKey) { - if (this.ondemandKeybinding) - logDebug(`On-demand keybinding has changed to ${this.ondemandKeybinding}.`); - else - logDebug('On-demand keybinding has been cleared.'); - this.emit('ondemand-keybinding-changed', this.ondemandKeybinding); - } - - _onOndemandButtonPlacementChanged(_settings, _changedKey) { - logDebug(`On-demand button placement has changed to ${this.ondemandButtonPlacement}`); - this.emit('ondemand-button-placement-changed', this.ondemandButtonPlacement); - } - - - /* Commands */ - - _onCommandsStatusChanged(_settings, _changedKey) { - logDebug(`Commands have been ${this.commandsEnabled ? 'ena' : 'disa'}bled.`); - this.emit('commands-status-changed', this.commandsEnabled); - } - - - /* Backgrounds */ - - _onBackgroundsStatusChanged(_settings, _changedKey) { - logDebug(`Backgrounds have been ${this.backgroundsEnabled ? 'ena' : 'disa'}bled.`); - this.emit('backgrounds-status-changed', this.backgroundsEnabled); - } - - _onBackgroundDayChanged(_settings, _changedKey) { - logDebug(`Day background has changed to '${this.backgroundDay}'.`); - this.emit('background-time-changed', 'day'); - } - - _onBackgroundNightChanged(_settings, _changedKey) { - logDebug(`Night background has changed to '${this.backgroundNight}'.`); - this.emit('background-time-changed', 'night'); - } - - - /* Night Light */ - - _onNightlightStatusChanged(_settings, _changedKey) { - logDebug(`Night Light has been ${this.nightlightEnabled ? 'ena' : 'disa'}bled.`); - this.emit('nightlight-status-changed', this.nightlightEnabled); - } - - - /* Location */ - - _onLocationStatusChanged(_settings, _changedKey) { - logDebug(`Location has been ${this.locationEnabled ? 'ena' : 'disa'}bled.`); - this.emit('location-status-changed', this.locationEnabled); - } - - - /* GTK theme */ - - _onGtkThemeChanged(_settings, _changedKey) { - logDebug(`GTK theme has changed to '${this.gtkTheme}'.`); - this.emit('gtk-theme-changed', this.gtkTheme); - } - - - /* Icon theme */ - - _onIconThemeChanged(_settings, _changedKey) { - logDebug(`Cursor theme has changed to '${this.iconTheme}'.`); - this.emit('icon-theme-changed', this.iconTheme); - } - - - /* Cursor theme */ - - _onCursorThemeChanged(_settings, _changedKey) { - logDebug(`Cursor theme has changed to '${this.cursorTheme}'.`); - this.emit('cursor-theme-changed', this.cursorTheme); - } - - - /* Background */ - - _onBackgroundChanged(_settings, _changedKey) { - logDebug(`Background has changed to '${this.background}'.`); - this.emit('background-changed', this.background); - } - - - /* Shell theme */ - - _onShellThemeChanged(_settings, _changedKey) { - logDebug(`Shell theme has changed to '${this.shellTheme}'.`); - this.emit('shell-theme-changed', this.shellTheme); - } - -}; -Signals.addSignalMethods(SettingsManager.prototype); diff --git a/src/modules/ShellThemer.js b/src/modules/ShellThemer.js index 9ceed20..8402249 100644 --- a/src/modules/ShellThemer.js +++ b/src/modules/ShellThemer.js @@ -43,10 +43,10 @@ const _ = Gettext.gettext; var ShellThemer = class { constructor() { - this._shellVariantsStatusChangedConnect = null; - this._shellVariantChangedConnect = null; - this._shellThemeChangedConnect = null; - this._manualShellVariantsChangedConnect = null; + this._statusChangedConnect = null; + this._variantChangedConnect = null; + this._manualChangedConnect = null; + this._systemShellThemeChangedConnect = null; this._timeChangedConnect = null; } @@ -54,7 +54,7 @@ var ShellThemer = class { logDebug('Enabling Shell Themer...'); try { this._watchStatus(); - if (e.settingsManager.shellVariantsEnabled) { + if (e.settings.shellVariants.enabled) { this._connectSettings(); this._updateVariants(); this._connectTimer(); @@ -76,32 +76,36 @@ var ShellThemer = class { _watchStatus() { logDebug('Watching shell variants status...'); - this._shellVariantsStatusChangedConnect = e.settingsManager.connect('shell-variants-status-changed', this._onShellVariantsStatusChanged.bind(this)); + this._statusChangedConnect = e.settings.shellVariants.connect('status-changed', this._onStatusChanged.bind(this)); } _unwatchStatus() { - if (this._shellVariantsStatusChangedConnect) { - e.settingsManager.disconnect(this._shellVariantsStatusChangedConnect); - this._shellVariantsStatusChangedConnect = null; + if (this._statusChangedConnect) { + e.settings.shellVariants.disconnect(this._statusChangedConnect); + this._statusChangedConnect = null; } logDebug('Stopped watching shell variants status.'); } _connectSettings() { logDebug('Connecting Shell Themer to settings...'); - this._shellVariantChangedConnect = e.settingsManager.connect('shell-variant-changed', this._onShellVariantChanged.bind(this)); - this._shellThemeChangedConnect = e.settingsManager.connect('shell-theme-changed', this._onShellThemeChanged.bind(this)); - this._manualShellVariantsChangedConnect = e.settingsManager.connect('manual-shell-variants-changed', this._onManualShellVariantsChanged.bind(this)); + this._variantChangedConnect = e.settings.shellVariants.connect('variant-changed', this._onVariantChanged.bind(this)); + this._manualChangedConnect = e.settings.shellVariants.connect('manual-changed', this._onManualChanged.bind(this)); + this._systemShellThemeChangedConnect = e.settings.system.connect('shell-theme-changed', this._onSystemShellThemeChanged.bind(this)); } _disconnectSettings() { - if (this._shellVariantChangedConnect) { - e.settingsManager.disconnect(this._shellVariantChangedConnect); - this._shellVariantChangedConnect = null; + if (this._variantChangedConnect) { + e.settings.shellVariants.disconnect(this._variantChangedConnect); + this._variantChangedConnect = null; } - if (this._shellThemeChangedConnect) { - e.settingsManager.disconnect(this._shellThemeChangedConnect); - this._shellThemeChangedConnect = null; + if (this._manualChangedConnect) { + e.settings.shellVariants.disconnect(this._manualChangedConnect); + this._manualChangedConnect = null; + } + if (this._systemShellThemeChangedConnect) { + e.settings.system.disconnect(this._systemShellThemeChangedConnect); + this._systemShellThemeChangedConnect = null; } logDebug('Disconnected Shell Themer from settings.'); } @@ -120,48 +124,48 @@ var ShellThemer = class { } - _onShellVariantsStatusChanged(_settings, _enabled) { + _onStatusChanged(_settings, _enabled) { this.disable(); this.enable(); } - _onShellVariantChanged(_settings, changedVariantTime) { + _onVariantChanged(_settings, changedVariantTime) { if (changedVariantTime === e.timer.time) - this._setVariant(e.timer.time); + this._setSystemVariant(e.timer.time); } - _onShellThemeChanged(_settings, _newTheme) { + _onSystemShellThemeChanged(_settings, _newTheme) { try { this._updateVariants(); - this._setVariant(e.timer.time); + this._setSystemVariant(e.timer.time); } catch (error) { notifyError(error); } } - _onManualShellVariantsChanged(_settings, enabled) { + _onManualChanged(_settings, enabled) { this.disable(); this.enable(); if (enabled) - this._setVariant(e.timer.time); + this._setSystemVariant(e.timer.time); } _onTimeChanged(_timer, newTime) { - this._setVariant(newTime); + this._setSystemVariant(newTime); } _areVariantsUpToDate() { - return e.settingsManager.shellTheme === e.settingsManager.shellVariantDay || e.settingsManager.shellTheme === e.settingsManager.shellVariantNight; + return e.settings.system.shellTheme === e.settings.shellVariants.day || e.settings.system.shellTheme === e.settings.shellVariants.night; } - _setVariant(time) { + _setSystemVariant(time) { if (!time) return; logDebug(`Setting the shell ${time} variant...`); - const shellTheme = time === 'day' ? e.settingsManager.shellVariantDay : e.settingsManager.shellVariantNight; - if (e.settingsManager.useUserthemes) { - e.settingsManager.shellTheme = shellTheme; + const shellTheme = time === 'day' ? e.settings.shellVariants.day : e.settings.shellVariants.night; + if (e.settings.system.useUserthemes) { + e.settings.system.shellTheme = shellTheme; } else { const stylesheet = getShellThemeStylesheet(shellTheme); applyShellStylesheet(stylesheet); @@ -169,11 +173,11 @@ var ShellThemer = class { } _updateVariants() { - if (!e.settingsManager.useUserthemes || e.settingsManager.manualShellVariants || this._areVariantsUpToDate()) + if (!e.settings.system.useUserthemes || e.settings.shellVariants.manual || this._areVariantsUpToDate()) return; logDebug('Updating Shell variants...'); - const originalTheme = e.settingsManager.shellTheme; + const originalTheme = e.settings.system.shellTheme; const variants = ShellVariants.guessFrom(originalTheme); const installedThemes = getInstalledShellThemes(); @@ -182,8 +186,8 @@ var ShellThemer = class { throw new Error(message); } - e.settingsManager.shellVariantDay = variants.get('day'); - e.settingsManager.shellVariantNight = variants.get('night'); + e.settings.shellVariants.day = variants.get('day'); + e.settings.shellVariants.night = variants.get('night'); logDebug(`New Shell variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`); } diff --git a/src/modules/Timer.js b/src/modules/Timer.js index 220f9af..24aa7d0 100644 --- a/src/modules/Timer.js +++ b/src/modules/Timer.js @@ -81,27 +81,27 @@ var Timer = class { _connectSettings() { logDebug('Connecting Timer to settings...'); - this._nightlightStatusChangedConnect = e.settingsManager.connect('nightlight-status-changed', this._onSourceChanged.bind(this)); - this._locationStatusChangedConnect = e.settingsManager.connect('location-status-changed', this._onSourceChanged.bind(this)); - this._manualTimeSourceChangedConnect = e.settingsManager.connect('manual-time-source-changed', this._onSourceChanged.bind(this)); - this._timeSourceChangedConnect = e.settingsManager.connect('time-source-changed', this._onTimeSourceChanged.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._manualTimeSourceChangedConnect = e.settings.time.connect('manual-time-source-changed', this._onSourceChanged.bind(this)); + this._timeSourceChangedConnect = e.settings.time.connect('time-source-changed', this._onTimeSourceChanged.bind(this)); } _disconnectSettings() { if (this._nightlightStatusChangedConnect) { - e.settingsManager.disconnect(this._nightlightStatusChangedConnect); + e.settings.system.disconnect(this._nightlightStatusChangedConnect); this._nightlightStatusChangedConnect = null; } if (this._locationStatusChangedConnect) { - e.settingsManager.disconnect(this._locationStatusChangedConnect); + e.settings.system.disconnect(this._locationStatusChangedConnect); this._locationStatusChangedConnect = null; } if (this._manualTimeSourceChangedConnect) { - e.settingsManager.disconnect(this._manualTimeSourceChangedConnect); + e.settings.time.disconnect(this._manualTimeSourceChangedConnect); this._manualTimeSourceChangedConnect = null; } if (this._timeSourceChangedConnect) { - e.settingsManager.disconnect(this._timeSourceChangedConnect); + e.settings.time.disconnect(this._timeSourceChangedConnect); this._timeSourceChangedConnect = null; } logDebug('Disconnected Timer from settings.'); @@ -155,7 +155,7 @@ var Timer = class { } _onTimeSourceChanged(_settings, _newSource) { - if (e.settingsManager.manualTimeSource) + if (e.settings.time.manualTimeSource) this._onSourceChanged(); } @@ -171,30 +171,30 @@ var Timer = class { _getSource() { logDebug('Getting time source...'); - if (e.settingsManager.manualTimeSource) { - let source = e.settingsManager.timeSource; + if (e.settings.time.manualTimeSource) { + let source = e.settings.time.timeSource; logDebug(`Time source is forced to ${source}.`); if ( - (source === 'nightlight' && !e.settingsManager.nightlightEnabled) || - (source === 'location' && !e.settingsManager.locationEnabled) + (source === 'nightlight' && !e.settings.system.nightlightEnabled) || + (source === 'location' && !e.settings.system.locationEnabled) ) { logDebug(`Unable to choose ${source} time source, falling back to manual schedule.`); source = 'schedule'; - e.settingsManager.timeSource = source; + e.settings.time.timeSource = source; } return source; } let source; - if (e.settingsManager.nightlightEnabled) + if (e.settings.system.nightlightEnabled) source = 'nightlight'; - else if (e.settingsManager.locationEnabled) + else if (e.settings.system.locationEnabled) source = 'location'; else source = 'schedule'; logDebug(`Time source is ${source}.`); - e.settingsManager.timeSource = source; + e.settings.time.timeSource = source; return source; } diff --git a/src/modules/TimerLocation.js b/src/modules/TimerLocation.js index 9d7a961..17cfaf3 100644 --- a/src/modules/TimerLocation.js +++ b/src/modules/TimerLocation.js @@ -46,8 +46,8 @@ var TimerLocation = class { // Before we have the location suntimes, we'll use the manual schedule // times this._suntimes = new Map([ - ['sunrise', e.settingsManager.scheduleSunrise], - ['sunset', e.settingsManager.scheduleSunrise], + ['sunrise', e.settings.time.scheduleSunrise], + ['sunset', e.settings.time.scheduleSunrise], ]); this._geoclue = null; this._geoclueConnect = null; diff --git a/src/modules/TimerOndemand.js b/src/modules/TimerOndemand.js index 78e7232..96a5c72 100644 --- a/src/modules/TimerOndemand.js +++ b/src/modules/TimerOndemand.js @@ -65,24 +65,24 @@ var TimerOndemand = class { get time() { - return e.settingsManager.ondemandTime; + return e.settings.time.ondemandTime; } _connectSettings() { logDebug('Connecting On-demand Timer to settings...'); - this._ondemandKeybindingConnect = e.settingsManager.connect('ondemand-keybinding-changed', this._onOndemandKeybindingChanged.bind(this)); - this._ondemandButtonPlacementConnect = e.settingsManager.connect('ondemand-button-placement-changed', this._onOndemandButtonPlacementChanged.bind(this)); + this._ondemandKeybindingConnect = e.settings.time.connect('ondemand-keybinding-changed', this._onOndemandKeybindingChanged.bind(this)); + this._ondemandButtonPlacementConnect = e.settings.time.connect('ondemand-button-placement-changed', this._onOndemandButtonPlacementChanged.bind(this)); } _disconnectSettings() { logDebug('Disconnecting On-demand Timer from settings...'); if (this._ondemandKeybindingConnect) { - e.settingsManager.disconnect(this._ondemandKeybindingConnect); + e.settings.time.disconnect(this._ondemandKeybindingConnect); this._ondemandKeybindingConnect = null; } if (this._ondemandButtonPlacementConnect) { - e.settingsManager.disconnect(this._ondemandButtonPlacementConnect); + e.settings.time.disconnect(this._ondemandButtonPlacementConnect); this._ondemandButtonPlacementConnect = null; } } @@ -100,13 +100,13 @@ var TimerOndemand = class { _addKeybinding() { - this._previousKeybinding = e.settingsManager.ondemandKeybinding; - if (!e.settingsManager.ondemandKeybinding) + this._previousKeybinding = e.settings.time.ondemandKeybinding; + if (!e.settings.time.ondemandKeybinding) return; logDebug('Adding On-demand Timer keybinding...'); main.wm.addKeybinding( 'nightthemeswitcher-ondemand-keybinding', - e.settingsManager._extensionsSettings, + e.settings.time.settings, keyBindingAutoRepeat(), Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, this._toggleTime.bind(this) @@ -123,7 +123,7 @@ var TimerOndemand = class { } _addButton() { - switch (e.settingsManager.ondemandButtonPlacement) { + switch (e.settings.time.ondemandButtonPlacement) { case 'panel': this._addButtonToPanel(); break; @@ -177,7 +177,7 @@ var TimerOndemand = class { } _toggleTime() { - e.settingsManager.ondemandTime = e.timer.time === 'day' ? 'night' : 'day'; + e.settings.time.ondemandTime = e.timer.time === 'day' ? 'night' : 'day'; this.emit('time-changed', this.time); } diff --git a/src/modules/TimerSchedule.js b/src/modules/TimerSchedule.js index ad6720a..f3d1355 100644 --- a/src/modules/TimerSchedule.js +++ b/src/modules/TimerSchedule.js @@ -62,7 +62,7 @@ var TimerSchedule = class { _isDaytime() { const time = GLib.DateTime.new_now_local(); const hour = time.get_hour() + time.get_minute() / 60 + time.get_second() / 3600; - return hour >= e.settingsManager.scheduleSunrise && hour <= e.settingsManager.scheduleSunset; + return hour >= e.settings.time.scheduleSunrise && hour <= e.settings.time.scheduleSunset; } _watchForTimeChange() { diff --git a/src/po/fr.po b/src/po/fr.po index 7755728..003d458 100644 --- a/src/po/fr.po +++ b/src/po/fr.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Night Theme Switcher 7\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-05 08:43+0200\n" -"PO-Revision-Date: 2020-08-06 12:53+0200\n" +"POT-Creation-Date: 2020-09-23 11:56+0200\n" +"PO-Revision-Date: 2020-09-23 11:57+0200\n" "Last-Translator: Romain Vigier \n" "Language-Team: French - France \n" "Language: fr_FR\n" @@ -18,15 +18,15 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1)\n" "X-Generator: Gtranslator 3.36.0\n" -#: src/prefs.js:227 src/prefs.ui:644 +#: src/prefs.js:230 src/prefs.ui:643 msgid "Choose" msgstr "Choisir" -#: src/prefs.js:347 +#: src/prefs.js:350 msgid "Default" msgstr "Par défaut" -#: src/modules/GtkThemer.js:176 +#: src/modules/GtkThemer.js:179 #, javascript-format msgid "" "Unable to automatically detect the day and night variants for the \"%s\" GTK " @@ -36,7 +36,7 @@ msgstr "" "pour le thème GTK \"%s\". Veuillez les sélectionner manuellement dans les " "préférences de l’extension." -#: src/modules/ShellThemer.js:183 +#: src/modules/ShellThemer.js:185 #, javascript-format msgid "" "Unable to automatically detect the day and night variants for the \"%s\" " @@ -47,269 +47,299 @@ msgstr "" "pour le thème GNOME Shell \"%s\". Veuillez les sélectionner manuellement " "dans les préférences de l’extension." -#: src/modules/TimerOndemand.js:162 +#: src/modules/TimerOndemand.js:167 msgid "Switch to night theme" msgstr "Passer au thème nocturne" -#: src/modules/TimerOndemand.js:162 +#: src/modules/TimerOndemand.js:167 msgid "Switch to day theme" msgstr "Passer au thème diurne" #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:6 -#: src/prefs.ui:816 +msgid "Settings version" +msgstr "Version des paramètres" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:7 +msgid "The current extension settings version" +msgstr "La version actuelle des paramètres de l’extension" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:13 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:6 +#: src/prefs.ui:821 msgid "Switch GTK variants" msgstr "Permuter les variantes GTK" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:7 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:14 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:7 msgid "Enable GTK variants switching" msgstr "Activer le changement de variantes GTK" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:11 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:18 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:11 msgid "Day GTK theme" msgstr "Thème GTK diurne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:12 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:19 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:12 msgid "The GTK theme to use during daytime" msgstr "Le thème GTK à utiliser le jour" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:16 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:23 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:16 msgid "Night GTK theme" msgstr "Thème GTK nocturne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:17 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:24 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:17 msgid "The GTK theme to use during nighttime" msgstr "Le thème GTK à utiliser la nuit" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:21 -msgid "Original GTK theme" -msgstr "Thème GTK original" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:22 -msgid "The GTK theme to restore when the extension is disabled" -msgstr "Le thème GTK à restaurer quand l’extension est désactivée" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:26 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:28 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:21 msgid "Use manual GTK variants" msgstr "Utiliser des variantes GTK manuelles" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:27 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:29 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:22 msgid "Disable automatic GTK theme variants detection" msgstr "Désactiver la détection automatique des variantes du thème GTK" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:31 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:35 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:26 msgid "Switch shell variants" msgstr "Permuter les variantes du shell" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:32 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:36 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:27 msgid "Enable shell variants switching" msgstr "Activer le changement des variantes du shell" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:36 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:40 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:31 msgid "Day shell theme" msgstr "Thème shell diurne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:37 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:41 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:32 msgid "The shell theme to use during daytime" msgstr "Le thème shell à utiliser le jour" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:41 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:45 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:36 msgid "Night shell theme" msgstr "Thème shell nocturne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:42 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:37 msgid "The shell theme to use during nighttime" msgstr "Le thème shell à utiliser la nuit" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46 -msgid "Original shell theme" -msgstr "Thème shell original" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:47 -msgid "The shell theme to restore when the extension is disabled" -msgstr "Le thème shell à restaurer quand l’extension est désactivée" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:50 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:41 msgid "Use manual shell variants" msgstr "Utiliser des variantes shell manuelles" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:52 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:42 msgid "Disable automatic shell theme variants detection" msgstr "Désactiver la détection automatique des variantes du thème shell" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:56 -#: src/prefs.ui:1504 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:46 +#: src/prefs.ui:1509 msgid "Switch icon variants" msgstr "Permuter les variantes d’icônes" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:58 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:47 msgid "Enable icon variants switching" msgstr "Activer le changement de variantes d’icônes" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:61 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:51 msgid "Day icon theme" msgstr "Thème d’icônes diurne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:63 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:52 msgid "The icon theme to use during daytime" msgstr "Le thème d’icônes à utiliser le jour" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:66 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:56 msgid "Night icon theme" msgstr "Thème d’icônes nocturne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:68 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:57 msgid "The icon theme to use during nighttime" msgstr "Le thème d’icônes à utiliser la nuit" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71 -msgid "Original icon theme" -msgstr "Thème d’icônes original" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:72 -msgid "The icon theme to restore when the extension is disabled" -msgstr "Le thème d’icônes à restaurer quand l’extension est désactivée" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:76 -#: src/prefs.ui:1750 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:74 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:61 +#: src/prefs.ui:1755 msgid "Switch cursor variants" msgstr "Permuter les variantes de curseur" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:77 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:75 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:62 msgid "Enable cursor variants switching" msgstr "Activer le changement de variantes de curseur" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:81 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:79 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:66 msgid "Day cursor theme" msgstr "Thème de curseurs diurne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:82 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:80 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:67 msgid "The cursor theme to use during daytime" msgstr "Le thème de curseurs à utiliser le jour" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:86 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:84 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:71 msgid "Night cursor theme" msgstr "Thème de curseurs nocturne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:87 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:85 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:72 msgid "The cursor theme to use during nighttime" msgstr "Le thème de curseurs à utiliser la nuit" #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:91 -msgid "Original cursor theme" -msgstr "Thème de curseurs original" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92 -msgid "The cursor theme to restore when the extension is disabled" -msgstr "Le thème de curseurs à restaurer quand l’extension est désactivée" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102 -msgid "Time source" -msgstr "Source d’horaires" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:103 -msgid "The source used to check current time" -msgstr "Source utilisée pour vérifier les horaires" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:111 -msgid "On-demand time" -msgstr "Temps à la demande" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:112 -msgid "The current time used in on-demand mode" -msgstr "Le temps actuel utilisé dans le mode à la demande" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:116 -msgid "Key combination to toggle time" -msgstr "Combinaison de touches pour permuter le temps" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:117 -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" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:126 -msgid "On-demand button placement" -msgstr "Emplacement du bouton à la demande" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:127 -msgid "Where the on-demand button will be placed" -msgstr "Où le bouton du changement à la demande sera placé" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131 -msgid "Use manual time source" -msgstr "Utiliser une source d’horaires manuelle" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132 -msgid "Disable automatic time source detection" -msgstr "Désactive la détection automatique de la source d’horaires" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136 -msgid "Sunrise time" -msgstr "Heure du lever" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:137 -msgid "When the day starts" -msgstr "Quand le jour se lève" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141 -msgid "Sunset time" -msgstr "Heure du coucher" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:142 -msgid "When the day ends" -msgstr "Quand le jour se couche" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:126 msgid "Enable commands" msgstr "Activer les commandes" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:147 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:127 msgid "Commands will be spawned on time change" msgstr "Les commandes seront lancées au changement d’horaire" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151 -#: src/prefs.ui:2369 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:96 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:131 +#: src/prefs.ui:2432 msgid "Sunrise command" msgstr "Commande du lever de soleil" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:152 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:97 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:132 msgid "The command to spawn at sunrise" msgstr "La commande à lancer quand le soleil se lève" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156 -#: src/prefs.ui:2428 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:101 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:136 +#: src/prefs.ui:2523 msgid "Sunset command" msgstr "Commande du coucher de soleil" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:157 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:137 msgid "The command to spawn at sunset" msgstr "La commande à lancer quand le soleil se couche" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:108 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:141 msgid "Enable backgrounds" msgstr "Activer les arrière-plans" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:162 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:109 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:142 msgid "Background will be changed on time change" msgstr "L’arrière-plan changera au changement d’horaire" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166 -#: src/prefs.ui:2083 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:113 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:146 +#: src/prefs.ui:2088 msgid "Day background" msgstr "Arrière-plan diurne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:167 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:114 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:147 msgid "Path to the day background" msgstr "Chemin vers l’arrière-plan diurne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171 -#: src/prefs.ui:2143 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:118 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:151 +#: src/prefs.ui:2177 msgid "Night background" msgstr "Arrière-plan nocturne" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:172 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:119 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:152 msgid "Path to the night background" msgstr "Chemin vers l’arrière-plan nocturne" +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:82 +msgid "Time source" +msgstr "Source d’horaires" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:83 +msgid "The source used to check current time" +msgstr "Source utilisée pour vérifier les horaires" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:140 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:91 +msgid "On-demand time" +msgstr "Temps à la demande" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:92 +msgid "The current time used in on-demand mode" +msgstr "Le temps actuel utilisé dans le mode à la demande" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:145 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:96 +msgid "Key combination to toggle time" +msgstr "Combinaison de touches pour permuter le temps" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:97 +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" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:155 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:106 +msgid "On-demand button placement" +msgstr "Emplacement du bouton à la demande" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:107 +msgid "Where the on-demand button will be placed" +msgstr "Où le bouton du changement à la demande sera placé" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:160 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:111 +msgid "Use manual time source" +msgstr "Utiliser une source d’horaires manuelle" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:112 +msgid "Disable automatic time source detection" +msgstr "Désactive la détection automatique de la source d’horaires" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:165 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:116 +msgid "Sunrise time" +msgstr "Heure du lever" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:117 +msgid "When the day starts" +msgstr "Quand le jour se lève" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:121 +msgid "Sunset time" +msgstr "Heure du coucher" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:122 +msgid "When the day ends" +msgstr "Quand le jour se couche" + #: src/prefs.ui:58 msgid "Press your keyboard shortcut..." msgstr "Pressez votre raccourci clavier…" @@ -373,35 +403,36 @@ msgstr ":" msgid "Sunset" msgstr "Coucher du soleil" -#: src/prefs.ui:659 +#: src/prefs.ui:658 src/prefs.ui:2121 src/prefs.ui:2210 src/prefs.ui:2464 +#: src/prefs.ui:2555 msgid "Clear" msgstr "Effacer" -#: src/prefs.ui:713 +#: src/prefs.ui:718 msgid "Button location" msgstr "Emplacement du bouton" -#: src/prefs.ui:728 +#: src/prefs.ui:733 msgid "None" msgstr "Aucun" -#: src/prefs.ui:729 +#: src/prefs.ui:734 msgid "Top bar" msgstr "Barre supérieure" -#: src/prefs.ui:730 +#: src/prefs.ui:735 msgid "System menu" msgstr "Menu système" -#: src/prefs.ui:768 +#: src/prefs.ui:773 msgid "Schedule" msgstr "Horaires" -#: src/prefs.ui:888 src/prefs.ui:963 src/prefs.ui:1232 src/prefs.ui:1307 +#: src/prefs.ui:893 src/prefs.ui:968 src/prefs.ui:1237 src/prefs.ui:1312 msgid "Manual variants" msgstr "Variantes manuelles" -#: src/prefs.ui:901 +#: src/prefs.ui:906 msgid "" "You can manually set variants if the extension cannot automatically " "detect the day and night variants of your GTK theme. Please soumettre une requête pour obtenir le support " "de votre thème." -#: src/prefs.ui:1002 src/prefs.ui:1346 src/prefs.ui:1592 src/prefs.ui:1838 +#: src/prefs.ui:1007 src/prefs.ui:1351 src/prefs.ui:1597 src/prefs.ui:1843 msgid "Day variant" msgstr "Variante diurne" -#: src/prefs.ui:1058 src/prefs.ui:1402 src/prefs.ui:1648 src/prefs.ui:1894 +#: src/prefs.ui:1063 src/prefs.ui:1407 src/prefs.ui:1653 src/prefs.ui:1899 msgid "Night variant" msgstr "Variante nocturne" -#: src/prefs.ui:1111 +#: src/prefs.ui:1116 msgid "GTK theme" msgstr "Thème GTK" -#: src/prefs.ui:1160 +#: src/prefs.ui:1165 msgid "Switch Shell variants" msgstr "Permuter les variantes Shell" -#: src/prefs.ui:1245 +#: src/prefs.ui:1250 msgid "" "You can manually set variants if the extension cannot automatically " "detect the day and night variants of your GNOME Shell theme. Please soumettre une requête pour obtenir le " "support de votre thème." -#: src/prefs.ui:1455 +#: src/prefs.ui:1460 msgid "Shell theme" msgstr "Thème du shell" -#: src/prefs.ui:1553 src/prefs.ui:1799 +#: src/prefs.ui:1558 src/prefs.ui:1804 msgid "Variants" msgstr "Variantes" -#: src/prefs.ui:1701 +#: src/prefs.ui:1706 msgid "Icon theme" msgstr "Thème d’icônes" -#: src/prefs.ui:1947 +#: src/prefs.ui:1952 msgid "Cursor theme" msgstr "Thème de curseur" -#: src/prefs.ui:1996 +#: src/prefs.ui:2001 msgid "Switch backgrounds" msgstr "Permuter les arrière-plans" -#: src/prefs.ui:2044 src/prefs.ui:2200 +#: src/prefs.ui:2049 src/prefs.ui:2263 msgid "Backgrounds" msgstr "Arrière-plans" -#: src/prefs.ui:2100 src/prefs.ui:2160 +#: src/prefs.ui:2111 src/prefs.ui:2200 msgid "Select your background image" msgstr "Sélectionnez votre image d’arrière-plan" -#: src/prefs.ui:2255 +#: src/prefs.ui:2318 msgid "Run commands" msgstr "Lancer des commandes" -#: src/prefs.ui:2268 +#: src/prefs.ui:2331 msgid "" "You can set custom commands that will be run when the time of the day " "changes." @@ -483,18 +514,42 @@ msgstr "" "Vous pouvez définir des commandes personnalisées qui seront lancées " "quand le moment du jour change." -#: src/prefs.ui:2330 src/prefs.ui:2484 +#: src/prefs.ui:2393 src/prefs.ui:2611 msgid "Commands" msgstr "Commandes" -#: src/prefs.ui:2385 +#: src/prefs.ui:2453 msgid "notify-send \"Hello sunshine!\"" msgstr "notify-send \"Bonjour!\"" -#: src/prefs.ui:2444 +#: src/prefs.ui:2544 msgid "notify-send \"Hello moonshine!\"" msgstr "notify-send \"Bonsoir!\"" +#~ msgid "Original GTK theme" +#~ msgstr "Thème GTK original" + +#~ msgid "The GTK theme to restore when the extension is disabled" +#~ msgstr "Le thème GTK à restaurer quand l’extension est désactivée" + +#~ msgid "Original shell theme" +#~ msgstr "Thème shell original" + +#~ msgid "The shell theme to restore when the extension is disabled" +#~ msgstr "Le thème shell à restaurer quand l’extension est désactivée" + +#~ msgid "Original icon theme" +#~ msgstr "Thème d’icônes original" + +#~ msgid "The icon theme to restore when the extension is disabled" +#~ msgstr "Le thème d’icônes à restaurer quand l’extension est désactivée" + +#~ msgid "Original cursor theme" +#~ msgstr "Thème de curseurs original" + +#~ msgid "The cursor theme to restore when the extension is disabled" +#~ msgstr "Le thème de curseurs à restaurer quand l’extension est désactivée" + #~ msgid "You can set different backgrounds for day and night." #~ msgstr "" #~ "Vous pouvez définir des arrière-plans diurnes et nocturnes différents." diff --git a/src/po/nightthemeswitcher@romainvigier.fr.pot b/src/po/nightthemeswitcher@romainvigier.fr.pot index a4a4bae..8e3e4e7 100644 --- a/src/po/nightthemeswitcher@romainvigier.fr.pot +++ b/src/po/nightthemeswitcher@romainvigier.fr.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Night Theme Switcher 34\n" +"Project-Id-Version: Night Theme Switcher 37\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-05 08:43+0200\n" +"POT-Creation-Date: 2020-09-23 11:56+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,22 +17,22 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/prefs.js:227 src/prefs.ui:644 +#: src/prefs.js:230 src/prefs.ui:643 msgid "Choose" msgstr "" -#: src/prefs.js:347 +#: src/prefs.js:350 msgid "Default" msgstr "" -#: src/modules/GtkThemer.js:176 +#: src/modules/GtkThemer.js:179 #, javascript-format msgid "" "Unable to automatically detect the day and night variants for the \"%s\" GTK " "theme. Please manually choose them in the extension's preferences." msgstr "" -#: src/modules/ShellThemer.js:183 +#: src/modules/ShellThemer.js:185 #, javascript-format msgid "" "Unable to automatically detect the day and night variants for the \"%s\" " @@ -40,269 +40,299 @@ msgid "" "preferences." msgstr "" -#: src/modules/TimerOndemand.js:162 +#: src/modules/TimerOndemand.js:167 msgid "Switch to night theme" msgstr "" -#: src/modules/TimerOndemand.js:162 +#: src/modules/TimerOndemand.js:167 msgid "Switch to day theme" msgstr "" #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:6 -#: src/prefs.ui:816 -msgid "Switch GTK variants" +msgid "Settings version" msgstr "" #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:7 +msgid "The current extension settings version" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:13 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:6 +#: src/prefs.ui:821 +msgid "Switch GTK variants" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:14 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:7 msgid "Enable GTK variants switching" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:11 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:18 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:11 msgid "Day GTK theme" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:12 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:19 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:12 msgid "The GTK theme to use during daytime" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:16 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:23 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:16 msgid "Night GTK theme" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:17 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:24 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:17 msgid "The GTK theme to use during nighttime" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:21 -msgid "Original GTK theme" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:22 -msgid "The GTK theme to restore when the extension is disabled" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:26 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:28 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:21 msgid "Use manual GTK variants" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:27 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:29 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:22 msgid "Disable automatic GTK theme variants detection" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:31 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:35 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:26 msgid "Switch shell variants" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:32 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:36 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:27 msgid "Enable shell variants switching" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:36 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:40 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:31 msgid "Day shell theme" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:37 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:41 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:32 msgid "The shell theme to use during daytime" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:41 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:45 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:36 msgid "Night shell theme" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:42 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:37 msgid "The shell theme to use during nighttime" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46 -msgid "Original shell theme" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:47 -msgid "The shell theme to restore when the extension is disabled" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:50 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:41 msgid "Use manual shell variants" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:52 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:42 msgid "Disable automatic shell theme variants detection" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:56 -#: src/prefs.ui:1504 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:46 +#: src/prefs.ui:1509 msgid "Switch icon variants" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:58 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:47 msgid "Enable icon variants switching" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:61 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:51 msgid "Day icon theme" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:63 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:52 msgid "The icon theme to use during daytime" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:66 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:56 msgid "Night icon theme" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:68 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:57 msgid "The icon theme to use during nighttime" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71 -msgid "Original icon theme" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:72 -msgid "The icon theme to restore when the extension is disabled" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:76 -#: src/prefs.ui:1750 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:74 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:61 +#: src/prefs.ui:1755 msgid "Switch cursor variants" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:77 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:75 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:62 msgid "Enable cursor variants switching" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:81 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:79 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:66 msgid "Day cursor theme" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:82 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:80 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:67 msgid "The cursor theme to use during daytime" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:86 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:84 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:71 msgid "Night cursor theme" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:87 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:85 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:72 msgid "The cursor theme to use during nighttime" msgstr "" #: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:91 -msgid "Original cursor theme" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92 -msgid "The cursor theme to restore when the extension is disabled" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102 -msgid "Time source" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:103 -msgid "The source used to check current time" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:111 -msgid "On-demand time" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:112 -msgid "The current time used in on-demand mode" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:116 -msgid "Key combination to toggle time" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:117 -msgid "The key combination that will toggle time in on-demand mode" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:126 -msgid "On-demand button placement" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:127 -msgid "Where the on-demand button will be placed" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131 -msgid "Use manual time source" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132 -msgid "Disable automatic time source detection" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136 -msgid "Sunrise time" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:137 -msgid "When the day starts" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141 -msgid "Sunset time" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:142 -msgid "When the day ends" -msgstr "" - -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:126 msgid "Enable commands" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:147 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:127 msgid "Commands will be spawned on time change" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151 -#: src/prefs.ui:2369 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:96 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:131 +#: src/prefs.ui:2432 msgid "Sunrise command" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:152 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:97 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:132 msgid "The command to spawn at sunrise" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156 -#: src/prefs.ui:2428 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:101 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:136 +#: src/prefs.ui:2523 msgid "Sunset command" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:157 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:137 msgid "The command to spawn at sunset" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:108 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:141 msgid "Enable backgrounds" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:162 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:109 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:142 msgid "Background will be changed on time change" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166 -#: src/prefs.ui:2083 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:113 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:146 +#: src/prefs.ui:2088 msgid "Day background" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:167 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:114 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:147 msgid "Path to the day background" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171 -#: src/prefs.ui:2143 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:118 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:151 +#: src/prefs.ui:2177 msgid "Night background" msgstr "" -#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:172 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:119 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:152 msgid "Path to the night background" msgstr "" +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:82 +msgid "Time source" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:83 +msgid "The source used to check current time" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:140 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:91 +msgid "On-demand time" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:92 +msgid "The current time used in on-demand mode" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:145 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:96 +msgid "Key combination to toggle time" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:97 +msgid "The key combination that will toggle time in on-demand mode" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:155 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:106 +msgid "On-demand button placement" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:107 +msgid "Where the on-demand button will be placed" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:160 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:111 +msgid "Use manual time source" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:112 +msgid "Disable automatic time source detection" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:165 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:116 +msgid "Sunrise time" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:117 +msgid "When the day starts" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:170 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:121 +msgid "Sunset time" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171 +#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml:122 +msgid "When the day ends" +msgstr "" + #: src/prefs.ui:58 msgid "Press your keyboard shortcut..." msgstr "" @@ -362,35 +392,36 @@ msgstr "" msgid "Sunset" msgstr "" -#: src/prefs.ui:659 +#: src/prefs.ui:658 src/prefs.ui:2121 src/prefs.ui:2210 src/prefs.ui:2464 +#: src/prefs.ui:2555 msgid "Clear" msgstr "" -#: src/prefs.ui:713 +#: src/prefs.ui:718 msgid "Button location" msgstr "" -#: src/prefs.ui:728 +#: src/prefs.ui:733 msgid "None" msgstr "" -#: src/prefs.ui:729 +#: src/prefs.ui:734 msgid "Top bar" msgstr "" -#: src/prefs.ui:730 +#: src/prefs.ui:735 msgid "System menu" msgstr "" -#: src/prefs.ui:768 +#: src/prefs.ui:773 msgid "Schedule" msgstr "" -#: src/prefs.ui:888 src/prefs.ui:963 src/prefs.ui:1232 src/prefs.ui:1307 +#: src/prefs.ui:893 src/prefs.ui:968 src/prefs.ui:1237 src/prefs.ui:1312 msgid "Manual variants" msgstr "" -#: src/prefs.ui:901 +#: src/prefs.ui:906 msgid "" "You can manually set variants if the extension cannot automatically " "detect the day and night variants of your GTK theme. Please submit a request to get your theme supported." msgstr "" -#: src/prefs.ui:1002 src/prefs.ui:1346 src/prefs.ui:1592 src/prefs.ui:1838 +#: src/prefs.ui:1007 src/prefs.ui:1351 src/prefs.ui:1597 src/prefs.ui:1843 msgid "Day variant" msgstr "" -#: src/prefs.ui:1058 src/prefs.ui:1402 src/prefs.ui:1648 src/prefs.ui:1894 +#: src/prefs.ui:1063 src/prefs.ui:1407 src/prefs.ui:1653 src/prefs.ui:1899 msgid "Night variant" msgstr "" -#: src/prefs.ui:1111 +#: src/prefs.ui:1116 msgid "GTK theme" msgstr "" -#: src/prefs.ui:1160 +#: src/prefs.ui:1165 msgid "Switch Shell variants" msgstr "" -#: src/prefs.ui:1245 +#: src/prefs.ui:1250 msgid "" "You can manually set variants if the extension cannot automatically " "detect the day and night variants of your GNOME Shell theme. Please submit a request to get your theme supported." msgstr "" -#: src/prefs.ui:1455 +#: src/prefs.ui:1460 msgid "Shell theme" msgstr "" -#: src/prefs.ui:1553 src/prefs.ui:1799 +#: src/prefs.ui:1558 src/prefs.ui:1804 msgid "Variants" msgstr "" -#: src/prefs.ui:1701 +#: src/prefs.ui:1706 msgid "Icon theme" msgstr "" -#: src/prefs.ui:1947 +#: src/prefs.ui:1952 msgid "Cursor theme" msgstr "" -#: src/prefs.ui:1996 +#: src/prefs.ui:2001 msgid "Switch backgrounds" msgstr "" -#: src/prefs.ui:2044 src/prefs.ui:2200 +#: src/prefs.ui:2049 src/prefs.ui:2263 msgid "Backgrounds" msgstr "" -#: src/prefs.ui:2100 src/prefs.ui:2160 +#: src/prefs.ui:2111 src/prefs.ui:2200 msgid "Select your background image" msgstr "" -#: src/prefs.ui:2255 +#: src/prefs.ui:2318 msgid "Run commands" msgstr "" -#: src/prefs.ui:2268 +#: src/prefs.ui:2331 msgid "" "You can set custom commands that will be run when the time of the day " "changes." msgstr "" -#: src/prefs.ui:2330 src/prefs.ui:2484 +#: src/prefs.ui:2393 src/prefs.ui:2611 msgid "Commands" msgstr "" -#: src/prefs.ui:2385 +#: src/prefs.ui:2453 msgid "notify-send \"Hello sunshine!\"" msgstr "" -#: src/prefs.ui:2444 +#: src/prefs.ui:2544 msgid "notify-send \"Hello moonshine!\"" msgstr "" diff --git a/src/prefs.js b/src/prefs.js index 472f04d..c9ca10d 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -24,6 +24,7 @@ const { extensionUtils } = imports.misc; const Me = extensionUtils.getCurrentExtension(); const { compat, utils } = Me.imports; +const { Settings } = Me.imports.settings.Settings; const Gettext = imports.gettext.domain(Me.metadata.uuid); const _ = Gettext.gettext; @@ -42,9 +43,11 @@ function buildPrefsWidget() { const Preferences = class { constructor() { - this.settings = compat.getExtensionSettings(); - this.colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' }); - this.locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' }); + // this.settings = compat.getExtensionSettings(); + this.settings = new Settings(); + this.settings.enable(); + // this.colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' }); + // this.locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' }); this.builder = new Gtk.Builder(); this.builder.set_translation_domain(Me.metadata.uuid); @@ -66,7 +69,7 @@ const Preferences = class { _connectSchedulePreferences() { const scheduleAutoSwitch = this.builder.get_object('prefs_schedule_auto_switch'); - this.settings.bind( + this.settings.time.settings.bind( 'manual-time-source', scheduleAutoSwitch, 'active', @@ -74,7 +77,7 @@ const Preferences = class { ); const scheduleManualTimeSource = this.builder.get_object('prefs_schedule_manual_time_source'); - this.settings.bind( + this.settings.time.settings.bind( 'manual-time-source', scheduleManualTimeSource, 'sensitive', @@ -83,10 +86,10 @@ const Preferences = class { const scheduleManualTimeSourceNightlightRadio = this.builder.get_object('prefs_schedule_manual_time_source_nightlight_radio'); const updateScheduleManualTimeSourceNightlightRadioActivity = () => { - scheduleManualTimeSourceNightlightRadio.active = this.settings.get_string('time-source') === 'nightlight'; + scheduleManualTimeSourceNightlightRadio.active = this.settings.time.timeSource === 'nightlight'; }; - this.settings.connect('changed::time-source', () => updateScheduleManualTimeSourceNightlightRadioActivity()); - this.colorSettings.bind( + this.settings.time.connect('time-source-changed', () => updateScheduleManualTimeSourceNightlightRadioActivity()); + this.settings.system.colorSettings.bind( 'night-light-enabled', scheduleManualTimeSourceNightlightRadio, 'sensitive', @@ -94,16 +97,16 @@ const Preferences = class { ); scheduleManualTimeSourceNightlightRadio.connect('toggled', () => { if (scheduleManualTimeSourceNightlightRadio.active) - this.settings.set_string('time-source', 'nightlight'); + this.settings.time.timeSource = 'nightlight'; }); updateScheduleManualTimeSourceNightlightRadioActivity(); const scheduleManualTimeSourceLocationRadio = this.builder.get_object('prefs_schedule_manual_time_source_location_radio'); const updateScheduleManualTimeSourceLocationRadioActivity = () => { - scheduleManualTimeSourceLocationRadio.active = this.settings.get_string('time-source') === 'location'; + scheduleManualTimeSourceLocationRadio.active = this.settings.time.timeSource === 'location'; }; - this.settings.connect('changed::time-source', () => updateScheduleManualTimeSourceLocationRadioActivity()); - this.locationSettings.bind( + this.settings.time.connect('time-source-changed', () => updateScheduleManualTimeSourceLocationRadioActivity()); + this.settings.system.locationSettings.bind( 'enabled', scheduleManualTimeSourceLocationRadio, 'sensitive', @@ -111,122 +114,122 @@ const Preferences = class { ); scheduleManualTimeSourceLocationRadio.connect('toggled', () => { if (scheduleManualTimeSourceLocationRadio.active) - this.settings.set_string('time-source', 'location'); + this.settings.time.timeSource = 'location'; }); updateScheduleManualTimeSourceLocationRadioActivity(); const scheduleManualTimeSourceManualRadio = this.builder.get_object('prefs_schedule_manual_time_source_manual_radio'); const updateScheduleManualTimeSourceManualRadioActivity = () => { - scheduleManualTimeSourceManualRadio.active = this.settings.get_string('time-source') === 'schedule'; + scheduleManualTimeSourceManualRadio.active = this.settings.time.timeSource === 'schedule'; }; - this.settings.connect('changed::time-source', () => updateScheduleManualTimeSourceManualRadioActivity()); + this.settings.time.connect('time-source-changed', () => updateScheduleManualTimeSourceManualRadioActivity()); scheduleManualTimeSourceManualRadio.connect('toggled', () => { if (scheduleManualTimeSourceManualRadio.active) - this.settings.set_string('time-source', 'schedule'); + this.settings.time.timeSource = 'schedule'; }); updateScheduleManualTimeSourceManualRadioActivity(); const scheduleManualTimeSourceOndemandRadio = this.builder.get_object('prefs_schedule_manual_time_source_ondemand_radio'); const updateScheduleManualTimeSourceOndemandRadioActivity = () => { - scheduleManualTimeSourceOndemandRadio.active = this.settings.get_string('time-source') === 'ondemand'; + scheduleManualTimeSourceOndemandRadio.active = this.settings.time.timeSource === 'ondemand'; }; - this.settings.connect('changed::time-source', () => updateScheduleManualTimeSourceOndemandRadioActivity()); + this.settings.time.connect('time-source-changed', () => updateScheduleManualTimeSourceOndemandRadioActivity()); scheduleManualTimeSourceOndemandRadio.connect('toggled', () => { if (scheduleManualTimeSourceOndemandRadio.active) - this.settings.set_string('time-source', 'ondemand'); + this.settings.time.timeSource = 'ondemand'; }); updateScheduleManualTimeSourceOndemandRadioActivity(); const scheduleManualScheduleTimes = this.builder.get_object('prefs_schedule_manual_schedule_times'); const updateScheduleManualScheduleTimesVisibility = () => { - scheduleManualScheduleTimes.visible = this.settings.get_string('time-source') === 'schedule'; + scheduleManualScheduleTimes.visible = this.settings.time.timeSource === 'schedule'; }; - this.settings.bind( + this.settings.time.settings.bind( 'manual-time-source', scheduleManualScheduleTimes, 'sensitive', Gio.SettingsBindFlags.DEFAULT ); - this.settings.connect('changed::time-source', () => updateScheduleManualScheduleTimesVisibility()); + this.settings.time.connect('time-source-changed', () => updateScheduleManualScheduleTimesVisibility()); updateScheduleManualScheduleTimesVisibility(); const scheduleManualScheduleTimesSunriseHoursSpin = this.builder.get_object('prefs_schedule_manual_schedule_times_sunrise_hours_spin'); - scheduleManualScheduleTimesSunriseHoursSpin.value = Math.trunc(this.settings.get_double('schedule-sunrise')); + scheduleManualScheduleTimesSunriseHoursSpin.value = Math.trunc(this.settings.time.scheduleSunrise); scheduleManualScheduleTimesSunriseHoursSpin.connect('output', () => { const text = scheduleManualScheduleTimesSunriseHoursSpin.adjustment.value.toString().padStart(2, '0'); scheduleManualScheduleTimesSunriseHoursSpin.set_text(text); return true; }); scheduleManualScheduleTimesSunriseHoursSpin.connect('value-changed', () => { - const oldTime = this.settings.get_double('schedule-sunrise'); + const oldTime = this.settings.time.scheduleSunrise; const oldHour = Math.trunc(oldTime); const newMinutes = oldTime - oldHour; const newTime = scheduleManualScheduleTimesSunriseHoursSpin.value + newMinutes; - this.settings.set_double('schedule-sunrise', newTime); + this.settings.time.scheduleSunrise = newTime; }); const scheduleManualScheduleTimesSunriseMinutesSpin = this.builder.get_object('prefs_schedule_manual_schedule_times_sunrise_minutes_spin'); - scheduleManualScheduleTimesSunriseMinutesSpin.value = Math.round((this.settings.get_double('schedule-sunrise') - Math.trunc(this.settings.get_double('schedule-sunrise'))) * 60); + scheduleManualScheduleTimesSunriseMinutesSpin.value = Math.round((this.settings.time.scheduleSunrise - Math.trunc(this.settings.time.scheduleSunrise)) * 60); scheduleManualScheduleTimesSunriseMinutesSpin.connect('output', () => { const text = scheduleManualScheduleTimesSunriseMinutesSpin.adjustment.value.toString().padStart(2, '0'); scheduleManualScheduleTimesSunriseMinutesSpin.set_text(text); return true; }); scheduleManualScheduleTimesSunriseMinutesSpin.connect('value-changed', () => { - const hour = Math.trunc(this.settings.get_double('schedule-sunrise')); + const hour = Math.trunc(this.settings.time.scheduleSunrise); const newMinutes = scheduleManualScheduleTimesSunriseMinutesSpin.value / 60; const newTime = hour + newMinutes; - this.settings.set_double('schedule-sunrise', newTime); + this.settings.time.scheduleSunrise = newTime; }); const scheduleManualScheduleTimesSunsetHoursSpin = this.builder.get_object('prefs_schedule_manual_schedule_times_sunset_hours_spin'); - scheduleManualScheduleTimesSunsetHoursSpin.value = Math.trunc(this.settings.get_double('schedule-sunset')); + scheduleManualScheduleTimesSunsetHoursSpin.value = Math.trunc(this.settings.time.scheduleSunset); scheduleManualScheduleTimesSunsetHoursSpin.connect('output', () => { const text = scheduleManualScheduleTimesSunsetHoursSpin.adjustment.value.toString().padStart(2, '0'); scheduleManualScheduleTimesSunsetHoursSpin.set_text(text); return true; }); scheduleManualScheduleTimesSunsetHoursSpin.connect('value-changed', () => { - const oldTime = this.settings.get_double('schedule-sunset'); + const oldTime = this.settings.time.scheduleSunset; const oldHour = Math.trunc(oldTime); const newMinutes = oldTime - oldHour; const newTime = scheduleManualScheduleTimesSunsetHoursSpin.value + newMinutes; - this.settings.set_double('schedule-sunset', newTime); + this.settings.time.scheduleSunset = newTime; }); const scheduleManualScheduleTimesSunsetMinutesSpin = this.builder.get_object('prefs_schedule_manual_schedule_times_sunset_minutes_spin'); - scheduleManualScheduleTimesSunsetMinutesSpin.value = Math.round((this.settings.get_double('schedule-sunset') - Math.trunc(this.settings.get_double('schedule-sunset'))) * 60); + scheduleManualScheduleTimesSunsetMinutesSpin.value = Math.round((this.settings.time.scheduleSunset - Math.trunc(this.settings.time.scheduleSunset)) * 60); scheduleManualScheduleTimesSunsetMinutesSpin.connect('output', () => { const text = scheduleManualScheduleTimesSunsetMinutesSpin.adjustment.value.toString().padStart(2, '0'); scheduleManualScheduleTimesSunsetMinutesSpin.set_text(text); return true; }); scheduleManualScheduleTimesSunsetMinutesSpin.connect('value-changed', () => { - const hour = Math.trunc(this.settings.get_double('schedule-sunset')); + const hour = Math.trunc(this.settings.time.scheduleSunset); const newMinutes = scheduleManualScheduleTimesSunsetMinutesSpin.value / 60; const newTime = hour + newMinutes; - this.settings.set_double('schedule-sunset', newTime); + this.settings.time.scheduleSunset = newTime; }); const scheduleOndemand = this.builder.get_object('prefs_schedule_ondemand'); const updateScheduleOndemandVisibility = () => { - scheduleOndemand.visible = this.settings.get_string('time-source') === 'ondemand'; + scheduleOndemand.visible = this.settings.time.timeSource === 'ondemand'; }; - this.settings.bind( + this.settings.time.settings.bind( 'manual-time-source', scheduleOndemand, 'sensitive', Gio.SettingsBindFlags.DEFAULT ); - this.settings.connect('changed::time-source', () => updateScheduleOndemandVisibility()); + this.settings.time.connect('time-source-changed', () => updateScheduleOndemandVisibility()); updateScheduleOndemandVisibility(); const scheduleOndemandShortcutButton = this.builder.get_object('prefs_schedule_ondemand_shortcut_button'); const updateScheduleOndemandShortcutButtonLabel = () => { - const label = this.settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0]; + const label = this.settings.time.ondemandKeybinding; scheduleOndemandShortcutButton.label = label || _('Choose'); }; - this.settings.connect('changed::nightthemeswitcher-ondemand-keybinding', () => updateScheduleOndemandShortcutButtonLabel()); + this.settings.time.connect('ondemand-keybinding-changed', () => updateScheduleOndemandShortcutButtonLabel()); scheduleOndemandShortcutButton.connect('clicked', () => { const dialog = this.builder.get_object('ondemand_keyboard_shortcut_dialog'); dialog.set_transient_for(this.widget.get_toplevel()); @@ -236,16 +239,16 @@ const Preferences = class { const scheduleOndemandShortcutClearButton = this.builder.get_object('prefs_schedule_ondemand_shortcut_clear_button'); scheduleOndemandShortcutClearButton.connect('clicked', () => { - this.settings.set_strv('nightthemeswitcher-ondemand-keybinding', ['']); + this.settings.time.ondemandKeybinding = ''; }); const updateScheduleOndemandShortcutClearButtonVisibility = () => { - scheduleOndemandShortcutClearButton.visible = !!this.settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0]; + scheduleOndemandShortcutClearButton.visible = !!this.settings.time.ondemandKeybinding; }; - this.settings.connect('changed::nightthemeswitcher-ondemand-keybinding', () => updateScheduleOndemandShortcutClearButtonVisibility()); + this.settings.time.connect('ondemand-keybinding-changed', () => updateScheduleOndemandShortcutClearButtonVisibility()); updateScheduleOndemandShortcutClearButtonVisibility(); const scheduleOndemandButtonPlacementCombo = this.builder.get_object('prefs_schedule_ondemand_button_placement_combo'); - this.settings.bind( + this.settings.time.settings.bind( 'ondemand-button-placement', scheduleOndemandButtonPlacementCombo, 'active-id', @@ -255,24 +258,24 @@ const Preferences = class { _connectGtkThemePreferences() { const gtkThemeSwitchVariantsSwitch = this.builder.get_object('prefs_gtk_theme_switch_variants_switch'); - this.settings.bind( - 'gtk-variants-enabled', + this.settings.gtkVariants.settings.bind( + 'enabled', gtkThemeSwitchVariantsSwitch, 'active', Gio.SettingsBindFlags.DEFAULT ); const gtkThemeManualVariants = this.builder.get_object('prefs_gtk_theme_manual_variants'); - this.settings.bind( - 'gtk-variants-enabled', + this.settings.gtkVariants.settings.bind( + 'enabled', gtkThemeManualVariants, 'sensitive', Gio.SettingsBindFlags.DEFAULT ); const gtkThemeManualVariantsSwitch = this.builder.get_object('prefs_gtk_theme_manual_variants_switch'); - this.settings.bind( - 'manual-gtk-variants', + this.settings.gtkVariants.settings.bind( + 'manual', gtkThemeManualVariantsSwitch, 'active', Gio.SettingsBindFlags.DEFAULT @@ -280,10 +283,10 @@ const Preferences = class { const gtkThemeVariants = this.builder.get_object('prefs_gtk_theme_variants'); const updateGtkThemeVariantsSensitivity = () => { - gtkThemeVariants.sensitive = !!(this.settings.get_boolean('gtk-variants-enabled') && this.settings.get_boolean('manual-gtk-variants')); + gtkThemeVariants.sensitive = !!(this.settings.gtkVariants.enabled && this.settings.gtkVariants.manual); }; - this.settings.connect('changed::gtk-variants-enabled', () => updateGtkThemeVariantsSensitivity()); - this.settings.connect('changed::manual-gtk-variants', () => updateGtkThemeVariantsSensitivity()); + this.settings.gtkVariants.connect('status-changed', () => updateGtkThemeVariantsSensitivity()); + this.settings.gtkVariants.connect('manual-changed', () => updateGtkThemeVariantsSensitivity()); updateGtkThemeVariantsSensitivity(); const gtkThemeVariantsDayCombo = this.builder.get_object('prefs_gtk_theme_variants_day_combo'); @@ -293,14 +296,14 @@ const Preferences = class { gtkThemeVariantsDayCombo.append(theme, theme); gtkThemeVariantsNightCombo.append(theme, theme); }); - this.settings.bind( - 'gtk-variant-day', + this.settings.gtkVariants.settings.bind( + 'day', gtkThemeVariantsDayCombo, 'active-id', Gio.SettingsBindFlags.DEFAULT ); - this.settings.bind( - 'gtk-variant-night', + this.settings.gtkVariants.settings.bind( + 'night', gtkThemeVariantsNightCombo, 'active-id', Gio.SettingsBindFlags.DEFAULT @@ -309,24 +312,24 @@ const Preferences = class { _connectShellThemePreferences() { const shellThemeSwitchVariantsSwitch = this.builder.get_object('prefs_shell_theme_switch_variants_switch'); - this.settings.bind( - 'shell-variants-enabled', + this.settings.shellVariants.settings.bind( + 'enabled', shellThemeSwitchVariantsSwitch, 'active', Gio.SettingsBindFlags.DEFAULT ); const shellThemeManualVariants = this.builder.get_object('prefs_shell_theme_manual_variants'); - this.settings.bind( - 'shell-variants-enabled', + this.settings.shellVariants.settings.bind( + 'enabled', shellThemeManualVariants, 'sensitive', Gio.SettingsBindFlags.DEFAULT ); const shellThemeManualVariantsSwitch = this.builder.get_object('prefs_shell_theme_manual_variants_switch'); - this.settings.bind( - 'manual-shell-variants', + this.settings.shellVariants.settings.bind( + 'manual', shellThemeManualVariantsSwitch, 'active', Gio.SettingsBindFlags.DEFAULT @@ -334,10 +337,10 @@ const Preferences = class { const shellThemeVariants = this.builder.get_object('prefs_shell_theme_variants'); const updateShellThemeVariantsSensitivity = () => { - shellThemeVariants.sensitive = !!(this.settings.get_boolean('shell-variants-enabled') && this.settings.get_boolean('manual-shell-variants')); + shellThemeVariants.sensitive = !!(this.settings.shellVariants.enabled && this.settings.shellVariants.manual); }; - this.settings.connect('changed::shell-variants-enabled', () => updateShellThemeVariantsSensitivity()); - this.settings.connect('changed::manual-shell-variants', () => updateShellThemeVariantsSensitivity()); + this.settings.shellVariants.connect('status-changed', () => updateShellThemeVariantsSensitivity()); + this.settings.shellVariants.connect('manual-changed', () => updateShellThemeVariantsSensitivity()); updateShellThemeVariantsSensitivity(); const shellThemeVariantsDayCombo = this.builder.get_object('prefs_shell_theme_variants_day_combo'); @@ -348,14 +351,14 @@ const Preferences = class { shellThemeVariantsDayCombo.append(theme, themeName); shellThemeVariantsNightCombo.append(theme, themeName); }); - this.settings.bind( - 'shell-variant-day', + this.settings.shellVariants.settings.bind( + 'day', shellThemeVariantsDayCombo, 'active-id', Gio.SettingsBindFlags.DEFAULT ); - this.settings.bind( - 'shell-variant-night', + this.settings.shellVariants.settings.bind( + 'night', shellThemeVariantsNightCombo, 'active-id', Gio.SettingsBindFlags.DEFAULT @@ -364,16 +367,16 @@ const Preferences = class { _connectIconThemePreferences() { const iconThemeSwitchVariantsSwitch = this.builder.get_object('prefs_icon_theme_switch_variants_switch'); - this.settings.bind( - 'icon-variants-enabled', + this.settings.iconVariants.settings.bind( + 'enabled', iconThemeSwitchVariantsSwitch, 'active', Gio.SettingsBindFlags.DEFAULT ); const iconThemeVariants = this.builder.get_object('prefs_icon_theme_variants'); - this.settings.bind( - 'icon-variants-enabled', + this.settings.iconVariants.settings.bind( + 'enabled', iconThemeVariants, 'sensitive', Gio.SettingsBindFlags.DEFAULT @@ -386,14 +389,14 @@ const Preferences = class { iconThemeVariantsDayCombo.append(theme, theme); iconThemeVariantsNightCombo.append(theme, theme); }); - this.settings.bind( - 'icon-variant-day', + this.settings.iconVariants.settings.bind( + 'day', iconThemeVariantsDayCombo, 'active-id', Gio.SettingsBindFlags.DEFAULT ); - this.settings.bind( - 'icon-variant-night', + this.settings.iconVariants.settings.bind( + 'night', iconThemeVariantsNightCombo, 'active-id', Gio.SettingsBindFlags.DEFAULT @@ -402,16 +405,16 @@ const Preferences = class { _connectCursorThemePreferences() { const cursorThemeSwitchVariantsSwitch = this.builder.get_object('prefs_cursor_theme_switch_variants_switch'); - this.settings.bind( - 'cursor-variants-enabled', + this.settings.cursorVariants.settings.bind( + 'enabled', cursorThemeSwitchVariantsSwitch, 'active', Gio.SettingsBindFlags.DEFAULT ); const cursorThemeVariants = this.builder.get_object('prefs_cursor_theme_variants'); - this.settings.bind( - 'cursor-variants-enabled', + this.settings.cursorVariants.settings.bind( + 'enabled', cursorThemeVariants, 'sensitive', Gio.SettingsBindFlags.DEFAULT @@ -424,14 +427,14 @@ const Preferences = class { cursorThemeVariantsDayCombo.append(theme, theme); cursorThemeVariantsNightCombo.append(theme, theme); }); - this.settings.bind( - 'cursor-variant-day', + this.settings.cursorVariants.settings.bind( + 'day', cursorThemeVariantsDayCombo, 'active-id', Gio.SettingsBindFlags.DEFAULT ); - this.settings.bind( - 'cursor-variant-night', + this.settings.cursorVariants.settings.bind( + 'night', cursorThemeVariantsNightCombo, 'active-id', Gio.SettingsBindFlags.DEFAULT @@ -440,16 +443,16 @@ const Preferences = class { _connectBackgroundPreferences() { const backgroundSwitchBackgroundsSwitch = this.builder.get_object('prefs_backgrounds_switch_backgrounds_switch'); - this.settings.bind( - 'backgrounds-enabled', + this.settings.backgrounds.settings.bind( + 'enabled', backgroundSwitchBackgroundsSwitch, 'active', Gio.SettingsBindFlags.DEFAULT ); const backgroundsBackgrounds = this.builder.get_object('prefs_backgrounds_backgrounds'); - this.settings.bind( - 'backgrounds-enabled', + this.settings.backgrounds.settings.bind( + 'enabled', backgroundsBackgrounds, 'sensitive', Gio.SettingsBindFlags.DEFAULT @@ -458,9 +461,9 @@ const Preferences = class { const backgroundsBackgroundsDayBackgroundButton = this.builder.get_object('prefs_backgrounds_backgrounds_day_background_button'); const dayBackgroundPreview = this.builder.get_object('day_background_preview'); const updateBackgroundsBackgroundsDayBackgroundButtonUri = () => { - backgroundsBackgroundsDayBackgroundButton.set_uri(this.settings.get_string('background-day')); + backgroundsBackgroundsDayBackgroundButton.set_uri(this.settings.backgrounds.day); }; - this.settings.connect('changed::background-day', () => updateBackgroundsBackgroundsDayBackgroundButtonUri()); + this.settings.backgrounds.connect('day-changed', () => updateBackgroundsBackgroundsDayBackgroundButtonUri()); backgroundsBackgroundsDayBackgroundButton.connect('update-preview', () => { const file = backgroundsBackgroundsDayBackgroundButton.get_preview_filename(); const allowedContentTypes = ['image/jpeg', 'image/png', 'image/tiff']; @@ -470,26 +473,26 @@ const Preferences = class { } }); backgroundsBackgroundsDayBackgroundButton.connect('file-set', () => { - this.settings.set_string('background-day', backgroundsBackgroundsDayBackgroundButton.get_uri()); + this.settings.backgrounds.day = backgroundsBackgroundsDayBackgroundButton.get_uri(); }); updateBackgroundsBackgroundsDayBackgroundButtonUri(); const backgroundsBackgroundsDayBackgroundClearButton = this.builder.get_object('prefs_backgrounds_backgrounds_day_background_clear_button'); backgroundsBackgroundsDayBackgroundClearButton.connect('clicked', () => { - this.settings.set_string('background-day', ''); + this.settings.backgrounds.day = ''; }); const updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity = () => { - backgroundsBackgroundsDayBackgroundClearButton.sensitive = !!this.settings.get_string('background-day'); + backgroundsBackgroundsDayBackgroundClearButton.sensitive = !!this.settings.backgrounds.day; }; - this.settings.connect('changed::background-day', () => updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity()); + this.settings.backgrounds.connect('day-changed', () => updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity()); updateBackgroundsBackgroundsDayBackgroundClearButtonSensitivity(); const backgroundsBackgroundsNightBackgroundButton = this.builder.get_object('prefs_backgrounds_backgrounds_night_background_button'); const nightBackgroundPreview = this.builder.get_object('night_background_preview'); const updateBackgroundsBackgroundsNightBackgroundButtonUri = () => { - backgroundsBackgroundsNightBackgroundButton.set_uri(this.settings.get_string('background-night')); + backgroundsBackgroundsNightBackgroundButton.set_uri(this.settings.backgrounds.night); }; - this.settings.connect('changed::background-night', () => updateBackgroundsBackgroundsNightBackgroundButtonUri()); + this.settings.backgrounds.connect('night-changed', () => updateBackgroundsBackgroundsNightBackgroundButtonUri()); backgroundsBackgroundsNightBackgroundButton.connect('update-preview', () => { const file = backgroundsBackgroundsNightBackgroundButton.get_preview_filename(); const allowedContentTypes = ['image/jpeg', 'image/png', 'image/tiff']; @@ -499,41 +502,41 @@ const Preferences = class { } }); backgroundsBackgroundsNightBackgroundButton.connect('file-set', () => { - this.settings.set_string('background-night', backgroundsBackgroundsNightBackgroundButton.get_uri()); + this.settings.backgrounds.night = backgroundsBackgroundsNightBackgroundButton.get_uri(); }); updateBackgroundsBackgroundsNightBackgroundButtonUri(); const backgroundsBackgroundsNightBackgroundClearButton = this.builder.get_object('prefs_backgrounds_backgrounds_night_background_clear_button'); backgroundsBackgroundsNightBackgroundClearButton.connect('clicked', () => { - this.settings.set_string('background-night', ''); + this.settings.backgrounds.night = ''; }); const updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity = () => { - backgroundsBackgroundsNightBackgroundClearButton.sensitive = !!this.settings.get_string('background-night'); + backgroundsBackgroundsNightBackgroundClearButton.sensitive = !!this.settings.backgrounds.night; }; - this.settings.connect('changed::background-night', () => updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity()); + this.settings.backgrounds.connect('night-changed', () => updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity()); updateBackgroundsBackgroundsNightBackgroundClearButtonSensitivity(); } _connectCommandsPreferences() { const commandsSwitchCommandsSwitch = this.builder.get_object('prefs_commands_switch_commands_switch'); - this.settings.bind( - 'commands-enabled', + this.settings.commands.settings.bind( + 'enabled', commandsSwitchCommandsSwitch, 'active', Gio.SettingsBindFlags.DEFAULT ); const commandsCommands = this.builder.get_object('prefs_commands_commands'); - this.settings.bind( - 'commands-enabled', + this.settings.commands.settings.bind( + 'enabled', commandsCommands, 'sensitive', Gio.SettingsBindFlags.DEFAULT ); const commandsCommandsSunriseCommandEntry = this.builder.get_object('prefs_commands_commands_sunrise_command_entry'); - this.settings.bind( - 'command-sunrise', + this.settings.commands.settings.bind( + 'sunrise', commandsCommandsSunriseCommandEntry, 'text', Gio.SettingsBindFlags.DEFAULT @@ -541,17 +544,17 @@ const Preferences = class { const commandsCommandsSunriseCommandClearButton = this.builder.get_object('prefs_commands_commands_sunrise_command_clear_button'); commandsCommandsSunriseCommandClearButton.connect('clicked', () => { - this.settings.set_string('command-sunrise', ''); + this.settings.commands.sunrise = ''; }); const updateCommandsCommandsSunriseCommandClearButtonSensitivity = () => { - commandsCommandsSunriseCommandClearButton.sensitive = !!this.settings.get_string('command-sunrise'); + commandsCommandsSunriseCommandClearButton.sensitive = !!this.settings.commands.sunrise; }; - this.settings.connect('changed::command-sunrise', () => updateCommandsCommandsSunriseCommandClearButtonSensitivity()); + this.settings.commands.connect('sunrise-changed', () => updateCommandsCommandsSunriseCommandClearButtonSensitivity()); updateCommandsCommandsSunriseCommandClearButtonSensitivity(); const commandsCommandsSunsetCommandEntry = this.builder.get_object('prefs_commands_commands_sunset_command_entry'); - this.settings.bind( - 'command-sunset', + this.settings.commands.settings.bind( + 'sunset', commandsCommandsSunsetCommandEntry, 'text', Gio.SettingsBindFlags.DEFAULT @@ -559,12 +562,12 @@ const Preferences = class { const commandsCommandsSunsetCommandClearButton = this.builder.get_object('prefs_commands_commands_sunset_command_clear_button'); commandsCommandsSunsetCommandClearButton.connect('clicked', () => { - this.settings.set_string('command-sunset', ''); + this.settings.commands.sunset = ''; }); const updateCommandsCommandsSunsetCommandClearButtonSensitivity = () => { - commandsCommandsSunsetCommandClearButton.sensitive = !!this.settings.get_string('command-sunset'); + commandsCommandsSunsetCommandClearButton.sensitive = !!this.settings.commands.sunset; }; - this.settings.connect('changed::command-sunset', () => updateCommandsCommandsSunsetCommandClearButtonSensitivity()); + this.settings.commands.connect('sunset-changed', () => updateCommandsCommandsSunsetCommandClearButtonSensitivity()); updateCommandsCommandsSunsetCommandClearButtonSensitivity(); } @@ -604,7 +607,7 @@ const Preferences = class { keycode, mask ); - this.settings.set_strv('nightthemeswitcher-ondemand-keybinding', [binding]); + this.settings.time.ondemandKeybinding = binding; ondemandKeyboardShortcutDialog.visible = false; return Gdk.EVENT_STOP; }); diff --git a/src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml b/src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml index 0157d72..abee720 100644 --- a/src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml +++ b/src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml @@ -1,76 +1,125 @@ - + + 0 + Settings version + The current extension settings version + + + + true Switch GTK variants Enable GTK variants switching - + "Adwaita" Day GTK theme The GTK theme to use during daytime - + "Adwaita-dark" Night GTK theme The GTK theme to use during nighttime - + false Use manual GTK variants Disable automatic GTK theme variants detection - + + + true Switch shell variants Enable shell variants switching - + "" Day shell theme The shell theme to use during daytime - + "" Night shell theme The shell theme to use during nighttime - + false Use manual shell variants Disable automatic shell theme variants detection - + + + false Switch icon variants Enable icon variants switching - + "" Day icon theme The icon theme to use during daytime - + "" Night icon theme The icon theme to use during nighttime - + + + false Switch cursor variants Enable cursor variants switching - + "" Day cursor theme The cursor theme to use during daytime - + "" Night cursor theme The cursor theme to use during nighttime + + + + false + Enable commands + Commands will be spawned on time change + + + "" + Sunrise command + The command to spawn at sunrise + + + "" + Sunset command + The command to spawn at sunset + + + + + false + Enable backgrounds + Background will be changed on time change + + + "" + Day background + Path to the day background + + + "" + Night background + Path to the night background + + + @@ -121,35 +170,5 @@ Sunset time When the day ends - - false - Enable commands - Commands will be spawned on time change - - - "" - Sunrise command - The command to spawn at sunrise - - - "" - Sunset command - The command to spawn at sunset - - - false - Enable backgrounds - Background will be changed on time change - - - "" - Day background - Path to the day background - - - "" - Night background - Path to the night background - diff --git a/src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml b/src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml new file mode 100644 index 0000000..4d7ac5b --- /dev/null +++ b/src/schemas/org.gnome.shell.extensions.nightthemeswitcher.v0.gschema.xml @@ -0,0 +1,155 @@ + + + + + true + Switch GTK variants + Enable GTK variants switching + + + "Adwaita" + Day GTK theme + The GTK theme to use during daytime + + + "Adwaita-dark" + Night GTK theme + The GTK theme to use during nighttime + + + false + Use manual GTK variants + Disable automatic GTK theme variants detection + + + true + Switch shell variants + Enable shell variants switching + + + "" + Day shell theme + The shell theme to use during daytime + + + "" + Night shell theme + The shell theme to use during nighttime + + + false + Use manual shell variants + Disable automatic shell theme variants detection + + + false + Switch icon variants + Enable icon variants switching + + + "" + Day icon theme + The icon theme to use during daytime + + + "" + Night icon theme + The icon theme to use during nighttime + + + false + Switch cursor variants + Enable cursor variants switching + + + "" + Day cursor theme + The cursor theme to use during daytime + + + "" + Night cursor theme + The cursor theme to use during nighttime + + + + + + + + + "schedule" + Time source + The source used to check current time + + + + + + + "day" + On-demand time + The current time used in on-demand mode + + + t']]]> + Key combination to toggle time + The key combination that will toggle time in on-demand mode + + + + + + + + "panel" + On-demand button placement + Where the on-demand button will be placed + + + false + Use manual time source + Disable automatic time source detection + + + 6 + Sunrise time + When the day starts + + + 20 + Sunset time + When the day ends + + + false + Enable commands + Commands will be spawned on time change + + + "" + Sunrise command + The command to spawn at sunrise + + + "" + Sunset command + The command to spawn at sunset + + + false + Enable backgrounds + Background will be changed on time change + + + "" + Day background + Path to the day background + + + "" + Night background + Path to the night background + + + diff --git a/src/settings/Backgrounds.js b/src/settings/Backgrounds.js new file mode 100644 index 0000000..a5b206c --- /dev/null +++ b/src/settings/Backgrounds.js @@ -0,0 +1,99 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { extensionUtils } = imports.misc; +const Signals = imports.signals; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; +const { logDebug, getSettingsSchema } = Me.imports.utils; + + +var BackgroundsSettings = class { + + constructor() { + logDebug('Initializing backgrounds settings...'); + this.settings = compat.getSettings(getSettingsSchema('backgrounds')); + logDebug('Backgrounds settings initialized.'); + } + + enable() { + logDebug('Connecting backgrounds settings signals...'); + this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this)); + this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this)); + this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this)); + logDebug('Backgrounds settings signals connected.'); + } + + disable() { + logDebug('Disconnecting backgrounds settings signals...'); + this.settings.disconnect(this._enabledChangedConnect); + this.settings.disconnect(this._dayChangedConnect); + this.settings.disconnect(this._nightChangedConnect); + logDebug('Backgrounds settings signals disconnected.'); + } + + + get enabled() { + return this.settings.get_boolean('enabled'); + } + + set enabled(value) { + if (value !== this.enabled) + this.settings.set_boolean('enabled', value); + } + + get day() { + return this.settings.get_string('day'); + } + + set day(value) { + if (value !== this.day) + this.settings.set_string('day', value); + } + + get night() { + return this.settings.get_string('night'); + } + + set night(value) { + if (value !== this.night) + this.settings.set_string('night', value); + } + + + _onEnabledChanged(_settings, _changedKey) { + logDebug(`Backgrounds have been ${this.enabled ? 'ena' : 'disa'}bled.`); + this.emit('status-changed', this.enabled); + } + + _onDayChanged(_settings, _changedKey) { + logDebug(`Day background has changed to '${this.day}'.`); + this.emit('background-changed', 'day'); + this.emit('day-changed'); + } + + _onNightChanged(_settings, _changedKey) { + logDebug(`Night background has changed to '${this.night}'.`); + this.emit('background-changed', 'night'); + this.emit('night-changed'); + } + +}; +Signals.addSignalMethods(BackgroundsSettings.prototype); diff --git a/src/settings/Commands.js b/src/settings/Commands.js new file mode 100644 index 0000000..c4ad4bd --- /dev/null +++ b/src/settings/Commands.js @@ -0,0 +1,99 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { extensionUtils } = imports.misc; +const Signals = imports.signals; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; +const { logDebug, getSettingsSchema } = Me.imports.utils; + + +var CommandsSettings = class { + + constructor() { + logDebug('Initializing commands settings...'); + this.settings = compat.getSettings(getSettingsSchema('commands')); + logDebug('Commands settings initialized.'); + } + + enable() { + logDebug('Connecting commands settings signals...'); + this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this)); + this._sunriseChangedConnect = this.settings.connect('changed::sunrise', this._onSunriseChanged.bind(this)); + this._sunsetChangedConnect = this.settings.connect('changed::sunset', this._onSunsetChanged.bind(this)); + logDebug('Commands settings signals connected.'); + } + + disable() { + logDebug('Disconnecting commands settings signals...'); + this.settings.disconnect(this._enabledChangedConnect); + this.settings.disconnect(this._sunriseChangedConnect); + this.settings.disconnect(this._sunsetChangedConnect); + logDebug('Commands settings signals disconnected.'); + } + + + get enabled() { + return this.settings.get_boolean('enabled'); + } + + set enabled(value) { + if (value !== this.enabled) + this.settings.set_boolean('enabled', value); + } + + get sunrise() { + return this.settings.get_string('sunrise'); + } + + set sunrise(value) { + if (value !== this.sunrise) + this.settings.set_string('sunrise', value); + } + + get sunset() { + return this.settings.get_string('sunset'); + } + + set sunset(value) { + if (value !== this.sunset) + this.settings.set_string('sunset', value); + } + + + _onEnabledChanged(_settings, _changedKey) { + logDebug(`Commands have been ${this.enabled ? 'ena' : 'disa'}bled.`); + this.emit('status-changed', this.enabled); + } + + _onSunriseChanged(_settings, _changedKey) { + logDebug(`Sunrise command changed to '${this.sunrise}'.`); + this.emit('command-changed', 'sunrise'); + this.emit('sunrise-changed'); + } + + _onSunsetChanged(_settings, _changedKey) { + logDebug(`Sunset command has changed to '${this.sunset}'.`); + this.emit('command-changed', 'sunset'); + this.emit('sunset-changed'); + } + +}; +Signals.addSignalMethods(CommandsSettings.prototype); diff --git a/src/settings/CursorVariants.js b/src/settings/CursorVariants.js new file mode 100644 index 0000000..12f162a --- /dev/null +++ b/src/settings/CursorVariants.js @@ -0,0 +1,101 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { extensionUtils } = imports.misc; +const Signals = imports.signals; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; +const { logDebug, getSettingsSchema } = Me.imports.utils; + + +var CursorVariantsSettings = class { + + constructor() { + logDebug('Initializing cursor variants settings...'); + this.settings = compat.getSettings(getSettingsSchema('cursor-variants')); + logDebug('Cursor variants settings initialized.'); + } + + enable() { + logDebug('Connecting cursor variants settings signals...'); + this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this)); + this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this)); + this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this)); + logDebug('Cursor variants settings signals connected.'); + } + + disable() { + logDebug('Disconnecting cursor variants settings signals...'); + this.settings.disconnect(this._enabledChangedConnect); + this.settings.disconnect(this._dayChangedConnect); + this.settings.disconnect(this._nightChangedConnect); + logDebug('Cursor variants settings signals disconnected.'); + } + + + get enabled() { + return this.settings.get_boolean('enabled'); + } + + set enabled(value) { + if (value !== this.enabled) + this.settings.set_boolean('enabled', value); + } + + get day() { + return this.settings.get_string('day'); + } + + set day(value) { + if (value !== this.day) { + this.settings.set_string('day', value); + logDebug(`The cursor day variant has been set to '${value}'.`); + } + } + + get night() { + return this.settings.get_string('night'); + } + + set night(value) { + if (value !== this.night) { + this.settings.set_string('night', value); + logDebug(`The cursor night variant has been set to '${value}'.`); + } + } + + + _onEnabledChanged(_settings, _changedKey) { + logDebug(`Cursor variants have been ${this.enabled ? 'ena' : 'disa'}bled.`); + this.emit('status-changed', this.enabled); + } + + _onDayChanged(_settings, _changedKey) { + logDebug(`Cursor day variant has changed to '${this.day}'.`); + this.emit('variant-changed', 'day'); + } + + _onNightChanged(_settings, _changedKey) { + logDebug(`Cursor night variant has changed to '${this.night}'.`); + this.emit('variant-changed', 'night'); + } + +}; +Signals.addSignalMethods(CursorVariantsSettings.prototype); diff --git a/src/settings/GtkVariants.js b/src/settings/GtkVariants.js new file mode 100644 index 0000000..62eb89c --- /dev/null +++ b/src/settings/GtkVariants.js @@ -0,0 +1,117 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { extensionUtils } = imports.misc; +const Signals = imports.signals; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; +const { logDebug, getSettingsSchema } = Me.imports.utils; + + +var GtkVariantsSettings = class { + + constructor() { + logDebug('Initializing GTK variants settings...'); + this.settings = compat.getSettings(getSettingsSchema('gtk-variants')); + logDebug('GTK variants settings initialized.'); + } + + enable() { + logDebug('Connecting GTK variants settings signals...'); + this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this)); + this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this)); + this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this)); + this._manualChangedConnect = this.settings.connect('changed::manual', this._onManualChanged.bind(this)); + logDebug('GTK variants settings signals connected.'); + } + + disable() { + logDebug('Disconnecting GTK variants settings signals...'); + this.settings.disconnect(this._enabledChangedConnect); + this.settings.disconnect(this._dayChangedConnect); + this.settings.disconnect(this._nightChangedConnect); + this.settings.disconnect(this._manualChangedConnect); + logDebug('GTK variants settings signals disconnected.'); + } + + + get enabled() { + return this.settings.get_boolean('enabled'); + } + + set enabled(value) { + if (value !== this.enabled) + this.settings.set_boolean('enabled', value); + } + + get day() { + return this.settings.get_string('day'); + } + + set day(value) { + if (value !== this.day) { + this.settings.set_string('day', value); + logDebug(`The GTK day variant has been set to '${value}'.`); + } + } + + get night() { + return this.settings.get_string('night'); + } + + set night(value) { + if (value !== this.night) { + this.settings.set_string('night', value); + logDebug(`The GTK night variant has been set to '${value}'.`); + } + } + + get manual() { + return this.settings.get_boolean('manual'); + } + + set manual(value) { + if (value !== this.manual) + this.settings.set_boolean('manual', value); + } + + + _onEnabledChanged(_settings, _changedKey) { + logDebug(`GTK variants have been ${this.enabled ? 'ena' : 'disa'}bled.`); + this.emit('status-changed', this.enabled); + } + + _onDayChanged(_settings, _changedKey) { + logDebug(`GTK day variant has changed to '${this.day}'.`); + this.emit('variant-changed', 'day'); + } + + _onNightChanged(_settings, _changedKey) { + logDebug(`GTK night variant has changed to '${this.night}'.`); + this.emit('variant-changed', 'night'); + } + + _onManualChanged(_settings, _changedKey) { + logDebug(`Manual GTK variants have been ${this.manual ? 'ena' : 'disa'}bled.`); + this.emit('manual-changed', this.manual); + } + +}; +Signals.addSignalMethods(GtkVariantsSettings.prototype); diff --git a/src/settings/IconVariants.js b/src/settings/IconVariants.js new file mode 100644 index 0000000..ecbef7c --- /dev/null +++ b/src/settings/IconVariants.js @@ -0,0 +1,101 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { extensionUtils } = imports.misc; +const Signals = imports.signals; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; +const { logDebug, getSettingsSchema } = Me.imports.utils; + + +var IconVariantsSettings = class { + + constructor() { + logDebug('Initializing icon variants settings...'); + this.settings = compat.getSettings(getSettingsSchema('icon-variants')); + logDebug('Icon variants settings initialized.'); + } + + enable() { + logDebug('Connecting icon variants settings signals...'); + this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this)); + this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this)); + this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this)); + logDebug('Icon variants settings signals connected.'); + } + + disable() { + logDebug('Disconnecting icon variants settings signals...'); + this.settings.disconnect(this._enabledChangedConnect); + this.settings.disconnect(this._dayChangedConnect); + this.settings.disconnect(this._nightChangedConnect); + logDebug('Icon variants settings signals disconnected.'); + } + + + get enabled() { + return this.settings.get_boolean('enabled'); + } + + set enabled(value) { + if (value !== this.enabled) + this.settings.set_boolean('enabled', value); + } + + get day() { + return this.settings.get_string('day'); + } + + set day(value) { + if (value !== this.day) { + this.settings.set_string('day', value); + logDebug(`The icon day variant has been set to '${value}'.`); + } + } + + get night() { + return this.settings.get_string('night'); + } + + set night(value) { + if (value !== this.night) { + this.settings.set_string('night', value); + logDebug(`The icon night variant has been set to '${value}'.`); + } + } + + + _onEnabledChanged(_settings, _changedKey) { + logDebug(`Icon variants have been ${this.enabled ? 'ena' : 'disa'}bled.`); + this.emit('status-changed', this.enabled); + } + + _onDayChanged(_settings, _changedKey) { + logDebug(`Icon day variant has changed to '${this.day}'.`); + this.emit('variant-changed', 'day'); + } + + _onNightChanged(_settings, _changedKey) { + logDebug(`Icon night variant has changed to '${this.night}'.`); + this.emit('variant-changed', 'night'); + } + +}; +Signals.addSignalMethods(IconVariantsSettings.prototype); diff --git a/src/settings/Settings.js b/src/settings/Settings.js new file mode 100644 index 0000000..756a4ec --- /dev/null +++ b/src/settings/Settings.js @@ -0,0 +1,95 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { extensionUtils } = imports.misc; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; + +const { logDebug, notifyError, getSettingsSchema } = Me.imports.utils; +const { BackgroundsSettings } = Me.imports.settings.Backgrounds; +const { CommandsSettings } = Me.imports.settings.Commands; +const { CursorVariantsSettings } = Me.imports.settings.CursorVariants; +const { GtkVariantsSettings } = Me.imports.settings.GtkVariants; +const { IconVariantsSettings } = Me.imports.settings.IconVariants; +const { ShellVariantsSettings } = Me.imports.settings.ShellVariants; +const { SystemSettings } = Me.imports.settings.System; +const { TimeSettings } = Me.imports.settings.Time; + + +var Settings = class { + + constructor() { + logDebug('Initializing settings...'); + this.extension = compat.getExtensionSettings(); + this.backgrounds = new BackgroundsSettings(); + this.commands = new CommandsSettings(); + this.cursorVariants = new CursorVariantsSettings(); + this.gtkVariants = new GtkVariantsSettings(); + this.iconVariants = new IconVariantsSettings(); + this.shellVariants = new ShellVariantsSettings(); + this.system = new SystemSettings(); + this.time = new TimeSettings(); + logDebug('Settings initialized.'); + + this._migrate(); + } + + enable() { + logDebug('Connecting settings signals...'); + this.backgrounds.enable(); + this.commands.enable(); + this.cursorVariants.enable(); + this.gtkVariants.enable(); + this.iconVariants.enable(); + this.shellVariants.enable(); + this.system.enable(); + this.time.enable(); + logDebug('Settings signals connected.'); + } + + disable() { + logDebug('Disconnecting settings signals...'); + this.backgrounds.disable(); + this.commands.disable(); + this.cursorVariants.disable(); + this.gtkVariants.disable(); + this.iconVariants.disable(); + this.shellVariants.disable(); + this.system.disable(); + this.time.disable(); + logDebug('Settings signals disconnected.'); + } + + _migrate() { + const settingsVersion = this.extension.get_int('settings-version'); + + if (settingsVersion === 0) { + try { + logDebug('Migrating settings from v0 to v1...'); + Me.imports.settings.migrations.v0ToV1.migrate(this); + this.extension.set_int('settings-version', 1); + logDebug('Migrated settings from v0 to v1.'); + } catch (e) { + notifyError(e); + } + } + } + +}; diff --git a/src/settings/ShellVariants.js b/src/settings/ShellVariants.js new file mode 100644 index 0000000..8cf32da --- /dev/null +++ b/src/settings/ShellVariants.js @@ -0,0 +1,117 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { extensionUtils } = imports.misc; +const Signals = imports.signals; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; +const { logDebug, getSettingsSchema } = Me.imports.utils; + + +var ShellVariantsSettings = class { + + constructor() { + logDebug('Initializing shell variants settings...'); + this.settings = compat.getSettings(getSettingsSchema('shell-variants')); + logDebug('Shell variants settings initialized.'); + } + + enable() { + logDebug('Connecting shell variants settings signals...'); + this._enabledChangedConnect = this.settings.connect('changed::enabled', this._onEnabledChanged.bind(this)); + this._dayChangedConnect = this.settings.connect('changed::day', this._onDayChanged.bind(this)); + this._nightChangedConnect = this.settings.connect('changed::night', this._onNightChanged.bind(this)); + this._manualChangedConnect = this.settings.connect('changed::manual', this._onManualChanged.bind(this)); + logDebug('Shell variants settings signals connected.'); + } + + disable() { + logDebug('Disconnecting shell variants settings signals...'); + this.settings.disconnect(this._enabledChangedConnect); + this.settings.disconnect(this._dayChangedConnect); + this.settings.disconnect(this._nightChangedConnect); + this.settings.disconnect(this._manualChangedConnect); + logDebug('Shell variants settings signals disconnected.'); + } + + + get enabled() { + return this.settings.get_boolean('enabled'); + } + + set enabled(value) { + if (value !== this.enabled) + this.settings.set_boolean('enabled', value); + } + + get day() { + return this.settings.get_string('day'); + } + + set day(value) { + if (value !== this.day) { + this.settings.set_string('day', value); + logDebug(`The shell day variant has been set to '${value}'.`); + } + } + + get night() { + return this.settings.get_string('night'); + } + + set night(value) { + if (value !== this.night) { + this.settings.set_string('night', value); + logDebug(`The shell night variant has been set to '${value}'.`); + } + } + + get manual() { + return this.settings.get_boolean('manual'); + } + + set manual(value) { + if (value !== this.manual) + this.settings.set_boolean('manual', value); + } + + + _onEnabledChanged(_settings, _changedKey) { + logDebug(`Shell variants have been ${this.enabled ? 'ena' : 'disa'}bled.`); + this.emit('status-changed', this.enabled); + } + + _onDayChanged(_settings, _changedKey) { + logDebug(`Shell day variant has changed to '${this.day}'.`); + this.emit('variant-changed', 'day'); + } + + _onNightChanged(_settings, _changedKey) { + logDebug(`Shell night variant has changed to '${this.night}'.`); + this.emit('variant-changed', 'night'); + } + + _onManualChanged(_settings, _changedKey) { + logDebug(`Manual Shell variants have been ${this.manual ? 'ena' : 'disa'}bled.`); + this.emit('manual-changed', this.manual); + } + +}; +Signals.addSignalMethods(ShellVariantsSettings.prototype); diff --git a/src/settings/System.js b/src/settings/System.js new file mode 100644 index 0000000..7e12342 --- /dev/null +++ b/src/settings/System.js @@ -0,0 +1,177 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { Gio } = imports.gi; +const { extensionUtils } = imports.misc; +const Signals = imports.signals; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; +const { logDebug, getUserthemesExtension, getUserthemesSettings } = Me.imports.utils; + + +/** + * The Settings Manager centralizes all the different settings the extension + * needs. It handles getting and settings values as well as signaling any + * changes. + */ +var SystemSettings = class { + + constructor() { + logDebug('Initializing system settings...'); + this.colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' }); + this.locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' }); + this.interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' }); + this.backgroundSettings = new Gio.Settings({ schema: 'org.gnome.desktop.background' }); + this.userthemesSettings = getUserthemesSettings(); + logDebug('System settings initialized.'); + } + + enable() { + logDebug('Connecting system settings signals...'); + this._nightlightStatusConnect = this.colorSettings.connect('changed::night-light-enabled', this._onNightlightStatusChanged.bind(this)); + this._locationStatusConnect = this.locationSettings.connect('changed::enabled', this._onLocationStatusChanged.bind(this)); + this._gtkThemeChangedConnect = this.interfaceSettings.connect('changed::gtk-theme', this._onGtkThemeChanged.bind(this)); + this._iconThemeChangedConnect = this.interfaceSettings.connect('changed::icon-theme', this._onIconThemeChanged.bind(this)); + this._cursorThemeChangedConnect = this.interfaceSettings.connect('changed::cursor-theme', this._onCursorThemeChanged.bind(this)); + this._backgroundChangedConnect = this.backgroundSettings.connect('changed::picture-uri', this._onBackgroundChanged.bind(this)); + if (this.userthemesSettings) + this._shell_theme_changed_connect = this.userthemesSettings.connect('changed::name', this._onShellThemeChanged.bind(this)); + logDebug('System settings signals connected.'); + } + + disable() { + logDebug('Disconnecting system settings signals...'); + this.colorSettings.disconnect(this._nightlightStatusConnect); + this.locationSettings.disconnect(this._locationStatusConnect); + this.interfaceSettings.disconnect(this._gtkThemeChangedConnect); + this.interfaceSettings.disconnect(this._iconThemeChangedConnect); + this.interfaceSettings.disconnect(this._cursorThemeChangedConnect); + this.backgroundSettings.disconnect(this._backgroundChangedConnect); + if (this.userthemesSettings) + this.userthemesSettings.disconnect(this._shell_theme_changed_connect); + logDebug('System settings signals disconnected.'); + } + + + get nightlightEnabled() { + return this.colorSettings.get_boolean('night-light-enabled'); + } + + get locationEnabled() { + return this.locationSettings.get_boolean('enabled'); + } + + get gtkTheme() { + return this.interfaceSettings.get_string('gtk-theme'); + } + + set gtkTheme(value) { + if (value !== this.gtkTheme) { + this.interfaceSettings.set_string('gtk-theme', value); + logDebug(`GTK theme has been set to '${value}'.`); + } + } + + get shellTheme() { + if (this.userthemesSettings) + return this.userthemesSettings.get_string('name'); + else + return ''; + } + + set shellTheme(value) { + if (this.userthemesSettings && value !== this.shellTheme) + this.userthemesSettings.set_string('name', value); + } + + get useUserthemes() { + const extension = getUserthemesExtension(); + return extension && extension.state === 1; + } + + get iconTheme() { + return this.interfaceSettings.get_string('icon-theme'); + } + + set iconTheme(value) { + if (value !== this.iconTheme) { + this.interfaceSettings.set_string('icon-theme', value); + logDebug(`Icon theme has been set to '${value}'.`); + } + } + + get cursorTheme() { + return this.interfaceSettings.get_string('cursor-theme'); + } + + set cursorTheme(value) { + if (value !== this.cursorTheme) { + this.interfaceSettings.set_string('cursor-theme', value); + logDebug(`Cursor theme has been set to '${value}'.`); + } + } + + get background() { + return this.backgroundSettings.get_string('picture-uri'); + } + + set background(value) { + if (value !== this.background) + this.backgroundSettings.set_string('picture-uri', value); + } + + + _onNightlightStatusChanged(_settings, _changedKey) { + logDebug(`Night Light has been ${this.nightlightEnabled ? 'ena' : 'disa'}bled.`); + this.emit('nightlight-status-changed', this.nightlightEnabled); + } + + _onLocationStatusChanged(_settings, _changedKey) { + logDebug(`Location has been ${this.locationEnabled ? 'ena' : 'disa'}bled.`); + this.emit('location-status-changed', this.locationEnabled); + } + + _onGtkThemeChanged(_settings, _changedKey) { + logDebug(`GTK theme has changed to '${this.gtkTheme}'.`); + this.emit('gtk-theme-changed', this.gtkTheme); + } + + _onShellThemeChanged(_settings, _changedKey) { + logDebug(`Shell theme has changed to '${this.shellTheme}'.`); + this.emit('shell-theme-changed', this.shellTheme); + } + + _onIconThemeChanged(_settings, _changedKey) { + logDebug(`Cursor theme has changed to '${this.iconTheme}'.`); + this.emit('icon-theme-changed', this.iconTheme); + } + + _onCursorThemeChanged(_settings, _changedKey) { + logDebug(`Cursor theme has changed to '${this.cursorTheme}'.`); + this.emit('cursor-theme-changed', this.cursorTheme); + } + + _onBackgroundChanged(_settings, _changedKey) { + logDebug(`Background has changed to '${this.background}'.`); + this.emit('background-changed', this.background); + } + +}; +Signals.addSignalMethods(SystemSettings.prototype); diff --git a/src/settings/Time.js b/src/settings/Time.js new file mode 100644 index 0000000..41c5fcb --- /dev/null +++ b/src/settings/Time.js @@ -0,0 +1,147 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { extensionUtils } = imports.misc; +const Signals = imports.signals; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; +const { logDebug, getSettingsSchema } = Me.imports.utils; + + +var TimeSettings = class { + + constructor() { + logDebug('Initializing time settings...'); + this.settings = compat.getSettings(getSettingsSchema('time')); + logDebug('Time settings initialized.'); + } + + enable() { + logDebug('Connecting time settings signals...'); + 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._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)); + logDebug('System time signals connected.'); + } + + disable() { + logDebug('Disconnecting time settings signals...'); + this.settings.disconnect(this._timeSourceChangedConnect); + this.settings.disconnect(this._manualTimeSourceChangedConnect); + this.settings.disconnect(this._ondemandKeybindingChangedConnect); + this.settings.disconnect(this._ondemandButtonPlacementChangedConnect); + logDebug('Time settings signals disconnected.'); + } + + + get timeSource() { + return this.settings.get_string('time-source'); + } + + set timeSource(value) { + if (value !== this.timeSource) { + this.settings.set_string('time-source', value); + logDebug(`The time source has been set to ${value}.`); + } + } + + get manualTimeSource() { + return this.settings.get_boolean('manual-time-source'); + } + + set manualTimeSource(value) { + if (value !== this.manualTimeSource) + this.settings.set_boolean('manual-time-source', value); + } + + get ondemandTime() { + return this.settings.get_string('ondemand-time'); + } + + set ondemandTime(value) { + if (value !== this.ondemandTime) { + this.settings.set_string('ondemand-time', value); + logDebug(`The on-demand time has been set to ${value}.`); + } + } + + get ondemandKeybinding() { + return this.settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0]; + } + + set ondemandKeybinding(keybinding) { + this.settings.set_strv('nightthemeswitcher-ondemand-keybinding', [keybinding]); + } + + get ondemandButtonPlacement() { + return this.settings.get_string('ondemand-button-placement'); + } + + set ondemandButtonPlacement(value) { + if (value !== this.ondemandButtonPlacement) + this.settings.set_boolean('ondemand-button-placement', value); + } + + get scheduleSunrise() { + return this.settings.get_double('schedule-sunrise'); + } + + set scheduleSunrise(value) { + if (value !== this.scheduleSunrise) + this.settings.set_double('schedule-sunrise', value); + } + + get scheduleSunset() { + return this.settings.get_double('schedule-sunset'); + } + + set scheduleSunset(value) { + if (value !== this.scheduleSunset) + this.settings.set_double('schedule-sunset', value); + } + + + _onTimeSourceChanged(_settings, _changedKey) { + logDebug(`Time source has changed to ${this.timeSource}.`); + this.emit('time-source-changed', this.timeSource); + } + + _onManualTimeSourceChanged(_settings, _changedKey) { + logDebug(`Manual time source has been ${this.manualTimeSource ? 'ena' : 'disa'}bled.`); + this.emit('manual-time-source-changed', this.manualTimeSource); + } + + _onOndemandKeybindingChanged(_settings, _changedKey) { + if (this.ondemandKeybinding) + logDebug(`On-demand keybinding has changed to ${this.ondemandKeybinding}.`); + else + logDebug('On-demand keybinding has been cleared.'); + this.emit('ondemand-keybinding-changed', this.ondemandKeybinding); + } + + _onOndemandButtonPlacementChanged(_settings, _changedKey) { + logDebug(`On-demand button placement has changed to ${this.ondemandButtonPlacement}`); + this.emit('ondemand-button-placement-changed', this.ondemandButtonPlacement); + } + + +}; +Signals.addSignalMethods(TimeSettings.prototype); diff --git a/src/settings/migrations/v0ToV1.js b/src/settings/migrations/v0ToV1.js new file mode 100644 index 0000000..bc0b19a --- /dev/null +++ b/src/settings/migrations/v0ToV1.js @@ -0,0 +1,63 @@ +/* +Night Theme Switcher Gnome Shell extension + +Copyright (C) 2020 Romain Vigier + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +*/ + +const { extensionUtils } = imports.misc; + +const Me = extensionUtils.getCurrentExtension(); + +const compat = Me.imports.compat; + +const { getSettingsSchema } = Me.imports.utils; + +function migrate(settings) { + const oldSettings = compat.getSettings(getSettingsSchema('v0')); + + settings.gtkVariants.enabled = oldSettings.get_boolean('gtk-variants-enabled'); + settings.gtkVariants.day = oldSettings.get_string('gtk-variant-day'); + settings.gtkVariants.night = oldSettings.get_string('gtk-variant-night'); + settings.gtkVariants.manual = oldSettings.get_boolean('manual-gtk-variants'); + + settings.shellVariants.enabled = oldSettings.get_boolean('shell-variants-enabled'); + settings.shellVariants.day = oldSettings.get_string('shell-variant-day'); + settings.shellVariants.night = oldSettings.get_string('shell-variant-night'); + settings.shellVariants.manual = oldSettings.get_boolean('manual-shell-variants'); + + settings.iconVariants.enabled = oldSettings.get_boolean('icon-variants-enabled'); + settings.iconVariants.day = oldSettings.get_string('icon-variant-day'); + settings.iconVariants.night = oldSettings.get_string('icon-variant-night'); + + settings.cursorVariants.enabled = oldSettings.get_boolean('cursor-variants-enabled'); + settings.cursorVariants.day = oldSettings.get_string('cursor-variant-day'); + settings.cursorVariants.night = oldSettings.get_string('cursor-variant-night'); + + settings.commands.enabled = oldSettings.get_boolean('commands-enabled'); + settings.commands.sunrise = oldSettings.get_string('command-sunrise'); + settings.commands.sunset = oldSettings.get_string('command-sunset'); + + settings.backgrounds.enabled = oldSettings.get_boolean('backgrounds-enabled'); + settings.backgrounds.day = oldSettings.get_string('background-day'); + settings.backgrounds.night = oldSettings.get_string('background-night'); + + settings.time.timeSource = oldSettings.get_string('time-source'); + settings.time.ondemandTime = oldSettings.get_string('ondemand-time'); + settings.time.ondemandKeybinding = oldSettings.get_strv('nightthemeswitcher-ondemand-keybinding')[0]; + settings.time.ondemandButtonPlacement = oldSettings.get_string('ondemand-button-placement'); + settings.time.manualTimeSource = oldSettings.get_boolean('manual-time-source'); + settings.time.scheduleSunrise = oldSettings.get_double('schedule-sunrise'); + settings.time.scheduleSunset = oldSettings.get_double('schedule-sunset'); +} diff --git a/src/utils.js b/src/utils.js index ba30841..1760b9e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -47,6 +47,15 @@ function notifyError(error) { imports.ui.main.notifyError(Me.metadata.name, error.message); } +/** + * Build the full settings schema from a subschema. + * @param {string} subSchema The subschema to get. + * @returns {string} The full schema. + */ +function getSettingsSchema(subSchema) { + return subSchema ? `${Me.metadata['settings-schema']}.${subSchema}` : Me.metadata['settings-schema']; +} + /** * Get all the directories of the system for a resource. * @param {string} resource The resource to get the directories.