extensionBase: Stop injecting extensionManager

All extension lookups now happen through the dedicated
Extension/ExtensionPreferences classes, so the shared
code no longer has to access the extensionManager.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
This commit is contained in:
Florian Müllner 2023-07-10 06:04:07 +02:00
parent 82237a398f
commit abdd1346da
3 changed files with 2 additions and 17 deletions

View File

@ -1,7 +1,6 @@
import {ExtensionBase, GettextWrapper, setExtensionManager} from './sharedInternals.js';
import {ExtensionBase, GettextWrapper} from './sharedInternals.js';
const {extensionManager} = imports.ui.main;
setExtensionManager(extensionManager);
export class Extension extends ExtensionBase {
static lookupByUUID(uuid) {

View File

@ -1,10 +1,8 @@
import GObject from 'gi://GObject';
import {ExtensionBase, GettextWrapper, setExtensionManager} from './sharedInternals.js';
import {ExtensionBase, GettextWrapper} from './sharedInternals.js';
import {extensionManager} from '../extensionsService.js';
setExtensionManager(extensionManager);
export class ExtensionPreferences extends ExtensionBase {
static lookupByUUID(uuid) {
return extensionManager.lookup(uuid)?.stateObj ?? null;

View File

@ -6,18 +6,6 @@ import {bindtextdomain} from 'gettext';
const Config = imports.misc.config;
let _extensionManager = null;
/**
* @param {object} extensionManager to use in utilities like `initTranslations()`
*/
export function setExtensionManager(extensionManager) {
if (_extensionManager)
throw new Error('Trying to override existing extension manager');
_extensionManager = extensionManager;
}
export class ExtensionBase {
#gettextDomain;