[gnome-shell] dbusServices/extensions: Give extensions access to the prefs window



commit e07bc62fbd528010b6c7cbc0cdbf43c7863c9e4d
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 30 10:12:11 2021 +0200

    dbusServices/extensions: Give extensions access to the prefs window
    
    The current preference API - buildPrefsWidget() - predates client-side
    decorations. While extension authors have been finding ways around
    the limitation of not having access to the window/titlebar, the change
    to the new Adwaita API seems like a good time for an updated API that
    officially provides that access (as far as allowed by libadwaita).
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>

 js/dbusServices/extensions/extensionPrefsDialog.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/js/dbusServices/extensions/extensionPrefsDialog.js 
b/js/dbusServices/extensions/extensionPrefsDialog.js
index 85e1364da8..4e90da4e70 100644
--- a/js/dbusServices/extensions/extensionPrefsDialog.js
+++ b/js/dbusServices/extensions/extensionPrefsDialog.js
@@ -23,9 +23,16 @@ var ExtensionPrefsDialog = GObject.registerClass({
             const prefsModule = extension.imports.prefs;
             prefsModule.init(extension.metadata);
 
-            const widget = prefsModule.buildPrefsWidget();
-            const page = this._wrapWidget(widget);
-            this.add(page);
+            if (prefsModule.fillPreferencesWindow) {
+                prefsModule.fillPreferencesWindow(this);
+
+                if (!this.visible_page)
+                    throw new Error('Extension did not provide any UI');
+            } else {
+                const widget = prefsModule.buildPrefsWidget();
+                const page = this._wrapWidget(widget);
+                this.add(page);
+            }
         } catch (e) {
             this._showErrorPage(e);
             logError(e, 'Failed to open preferences');


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