extensions: Add static lookupByUUID() method

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>
This commit is contained in:
Florian Müllner
2023-07-10 10:33:31 +02:00
parent 931ca5e4ab
commit 82237a398f
3 changed files with 20 additions and 2 deletions

View File

@ -4,6 +4,10 @@ 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();