extensionPrefs: Override getCurrentExtension() for extensions

Extensions are used to calling the getCurrentExtension() utility function,
both from the extension itself and from its preferences. For the latter,
that relies on the extensions map in ExtensionUtils being populated from
the separated extension-prefs process just like from gnome-shell.

This won't be the case anymore when we switch to the extensions D-Bus API,
but as we know which extension we are showing the prefs dialog for, we
can patch in a simple replacement that gives extensions the expected API.

https://bugzilla.gnome.org/show_bug.cgi?id=789852
This commit is contained in:
Florian Müllner 2019-07-06 01:48:05 +02:00 committed by Florian Müllner
parent a7ec7583aa
commit 1c63893c4b

View File

@ -604,6 +604,9 @@ class ExtensionRow extends Gtk.ListBoxRow {
if (!this._prefsModule) {
ExtensionUtils.installImporter(this._extension);
// give extension prefs access to their own extension object
ExtensionUtils.getCurrentExtension = () => this._extension;
this._prefsModule = this._extension.imports.prefs;
this._prefsModule.init(this._extension.metadata);
}