From 1c63893c4b069a3a4af53a6c6a798a4ccc019c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 6 Jul 2019 01:48:05 +0200 Subject: [PATCH] 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 --- js/extensionPrefs/main.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js index 0f7e6d76b..0f0b4b06f 100644 --- a/js/extensionPrefs/main.js +++ b/js/extensionPrefs/main.js @@ -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); }