extensionUtils: Move isOutOfDate() into manager
It hasn't been used anywhere else since the old prefs-tool stopped implementing its own extension loading. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
This commit is contained in:
parent
df350cab0a
commit
4a0b0e26c7
@ -1,8 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
/* exported ExtensionState, ExtensionType, getCurrentExtension,
|
/* exported ExtensionState, ExtensionType, getCurrentExtension,
|
||||||
getSettings, initTranslations, gettext, ngettext, pgettext,
|
getSettings, initTranslations, gettext, ngettext, pgettext,
|
||||||
openPrefs, isOutOfDate, serializeExtension,
|
openPrefs, serializeExtension, deserializeExtension, setExtensionManager */
|
||||||
deserializeExtension, setExtensionManager */
|
|
||||||
|
|
||||||
// Common utils for the extension system and the extension
|
// Common utils for the extension system and the extension
|
||||||
// preferences tool
|
// preferences tool
|
||||||
@ -242,11 +241,6 @@ function openPrefs() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isOutOfDate(extension) {
|
|
||||||
const [major] = Config.PACKAGE_VERSION.split('.');
|
|
||||||
return !extension.metadata['shell-version'].some(v => v.startsWith(major));
|
|
||||||
}
|
|
||||||
|
|
||||||
function serializeExtension(extension) {
|
function serializeExtension(extension) {
|
||||||
let obj = { ...extension.metadata };
|
let obj = { ...extension.metadata };
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ const FileUtils = imports.misc.fileUtils;
|
|||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const MessageTray = imports.ui.messageTray;
|
const MessageTray = imports.ui.messageTray;
|
||||||
|
|
||||||
|
const Config = imports.misc.config;
|
||||||
|
|
||||||
const { ExtensionState, ExtensionType } = ExtensionUtils;
|
const { ExtensionState, ExtensionType } = ExtensionUtils;
|
||||||
|
|
||||||
const ENABLED_EXTENSIONS_KEY = 'enabled-extensions';
|
const ENABLED_EXTENSIONS_KEY = 'enabled-extensions';
|
||||||
@ -431,11 +433,16 @@ var ExtensionManager = class extends Signals.EventEmitter {
|
|||||||
return extension.metadata.version === version;
|
return extension.metadata.version === version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_isOutOfDate(extension) {
|
||||||
|
const [major] = Config.PACKAGE_VERSION.split('.');
|
||||||
|
return !extension.metadata['shell-version'].some(v => v.startsWith(major));
|
||||||
|
}
|
||||||
|
|
||||||
async loadExtension(extension) {
|
async loadExtension(extension) {
|
||||||
// Default to error, we set success as the last step
|
// Default to error, we set success as the last step
|
||||||
extension.state = ExtensionState.ERROR;
|
extension.state = ExtensionState.ERROR;
|
||||||
|
|
||||||
if (this._checkVersion && ExtensionUtils.isOutOfDate(extension)) {
|
if (this._checkVersion && this._isOutOfDate(extension)) {
|
||||||
extension.state = ExtensionState.OUT_OF_DATE;
|
extension.state = ExtensionState.OUT_OF_DATE;
|
||||||
} else if (!this._canLoad(extension)) {
|
} else if (!this._canLoad(extension)) {
|
||||||
this.logExtensionError(extension.uuid, new Error(
|
this.logExtensionError(extension.uuid, new Error(
|
||||||
|
Loading…
Reference in New Issue
Block a user