[gnome-shell/wip/rstrode/login-screen-extensions: 44/134] extensionPrefs: Override getCurrentExtension() for extensions




commit c8d1daf79ce0bd75155560890dad97b2d8d973be
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Jul 6 01:48:05 2019 +0200

    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 7e7b2dcc7e..29de8202a5 100644
--- a/js/extensionPrefs/main.js
+++ b/js/extensionPrefs/main.js
@@ -599,6 +599,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);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]