SwitcherThemeShell: Listen to extensions state to update settings
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
const { Gio } = imports.gi;
|
const { Gio } = imports.gi;
|
||||||
const { extensionUtils } = imports.misc;
|
const { extensionUtils } = imports.misc;
|
||||||
|
const { extensionManager } = imports.ui.main;
|
||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
@@ -71,6 +72,10 @@ var SwitcherTheme = class extends Switcher {
|
|||||||
super.disable();
|
super.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set systemSettings(settings) {
|
||||||
|
this.#systemSettings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
#connectSettings() {
|
#connectSettings() {
|
||||||
console.debug(`Connecting ${this.#name} switcher to settings...`);
|
console.debug(`Connecting ${this.#name} switcher to settings...`);
|
||||||
this.#settingsConnections.push({
|
this.#settingsConnections.push({
|
||||||
@@ -186,6 +191,7 @@ var SwitcherThemeShell = class extends SwitcherTheme {
|
|||||||
themeKey: 'name',
|
themeKey: 'name',
|
||||||
noSettingsUpdateSystemThemeCallback: time => this.#noSettingsUpdateSystemThemeCallback(time),
|
noSettingsUpdateSystemThemeCallback: time => this.#noSettingsUpdateSystemThemeCallback(time),
|
||||||
});
|
});
|
||||||
|
extensionManager.connect('extension-state-changed', this.#onExtensionStateChanged.bind(this));
|
||||||
this.#settings = settings;
|
this.#settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,4 +200,8 @@ var SwitcherThemeShell = class extends SwitcherTheme {
|
|||||||
const stylesheet = utils.getShellThemeStylesheet(shellTheme);
|
const stylesheet = utils.getShellThemeStylesheet(shellTheme);
|
||||||
utils.applyShellStylesheet(stylesheet);
|
utils.applyShellStylesheet(stylesheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#onExtensionStateChanged() {
|
||||||
|
this.systemSettings = utils.getUserthemesSettings();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+3
-1
@@ -9,6 +9,8 @@ const Me = extensionUtils.getCurrentExtension();
|
|||||||
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
const { ExtensionState } = extensionUtils;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the full settings schema from a subschema.
|
* Build the full settings schema from a subschema.
|
||||||
@@ -153,7 +155,7 @@ function getUserthemesExtension() {
|
|||||||
*/
|
*/
|
||||||
function getUserthemesSettings() {
|
function getUserthemesSettings() {
|
||||||
let extension = getUserthemesExtension();
|
let extension = getUserthemesExtension();
|
||||||
if (!extension)
|
if (!extension || extension.state !== ExtensionState.ENABLED)
|
||||||
return null;
|
return null;
|
||||||
const schemaDir = extension.dir.get_child('schemas');
|
const schemaDir = extension.dir.get_child('schemas');
|
||||||
const GioSSS = Gio.SettingsSchemaSource;
|
const GioSSS = Gio.SettingsSchemaSource;
|
||||||
|
|||||||
Reference in New Issue
Block a user