gnome-shell/js/extensions/extension.js
Florian Müllner 1354d2cf56 extensions: Unify how manager is injected into shared module
We unified most code paths earlier, but the common code will still
import Main locally if no extension manager was injected before.

Now that the old extensionUtils was split between extension and
preferences, each of those modules can simply import the manager
from its corresponding environment, and then inject it into the
shared module.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
2023-07-15 13:16:42 +02:00

25 lines
586 B
JavaScript

import {getCurrentExtension, setExtensionManager} from './sharedInternals.js';
export {
getSettings,
initTranslations,
gettext,
ngettext,
pgettext
} from './sharedInternals.js';
const {extensionManager} = imports.ui.main;
setExtensionManager(extensionManager);
/**
* Open the preference dialog of the current extension
*/
export function openPrefs() {
const extension = getCurrentExtension();
if (!extension)
throw new Error('openPrefs() can only be called from extensions');
extensionManager.openExtensionPrefs(extension.uuid, '', {});
}