82237a398f
This allows the Extension/Preferences classes to provide the UUID -> extension lookup without exposing the underlying extension manager. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
33 lines
781 B
JavaScript
33 lines
781 B
JavaScript
import {ExtensionBase, GettextWrapper, setExtensionManager} from './sharedInternals.js';
|
|
|
|
const {extensionManager} = imports.ui.main;
|
|
setExtensionManager(extensionManager);
|
|
|
|
export class Extension extends ExtensionBase {
|
|
static lookupByUUID(uuid) {
|
|
return extensionManager.lookup(uuid)?.stateObj ?? null;
|
|
}
|
|
|
|
static defineTranslationFunctions(url) {
|
|
const wrapper = new GettextWrapper(this, url);
|
|
return wrapper.defineTranslationFunctions();
|
|
}
|
|
|
|
enable() {
|
|
}
|
|
|
|
disable() {
|
|
}
|
|
|
|
/**
|
|
* Open the extension's preferences window
|
|
*/
|
|
openPreferences() {
|
|
extensionManager.openExtensionPrefs(this.uuid, '', {});
|
|
}
|
|
}
|
|
|
|
export const {
|
|
gettext, ngettext, pgettext,
|
|
} = Extension.defineTranslationFunctions();
|