extensionSystem: Add method for opening extension prefs

Extension that want to expose their own preferences (for example as menu
items) do that by passing their UUID to gnome-shell-extension-prefs.

But since 3.36.1 the app is optional and no longer accepts arguments on
the command line. To adjust, extensions now need to make a D-Bus call
the extensions portal, just like the app and gnome-shell.

We will add a convenience method for that purpose, so it makes
sense to share the existing code. As it's extension-related, the
extension manager looks like the right place ...

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1163
This commit is contained in:
Florian Müllner 2020-04-01 21:04:03 +02:00
parent 51a913730e
commit 45bc850715
2 changed files with 19 additions and 10 deletions

View File

@ -215,6 +215,24 @@ var ExtensionManager = class {
return true; return true;
} }
openExtensionPrefs(uuid, parentWindow, options) {
const extension = this.lookup(uuid);
if (!extension || !extension.hasPrefs)
return false;
Gio.DBus.session.call(
'org.gnome.Shell.Extensions',
'/org/gnome/Shell/Extensions',
'org.gnome.Shell.Extensions',
'OpenExtensionPrefs',
new GLib.Variant('(ssa{sv})', [uuid, parentWindow, options]),
null,
Gio.DBusCallFlags.NONE,
-1,
null);
return true;
}
notifyExtensionUpdate(uuid) { notifyExtensionUpdate(uuid) {
let extension = this.lookup(uuid); let extension = this.lookup(uuid);
if (!extension) if (!extension)

View File

@ -316,16 +316,7 @@ var GnomeShellExtensions = class {
} }
OpenExtensionPrefs(uuid, parentWindow, options) { OpenExtensionPrefs(uuid, parentWindow, options) {
Gio.DBus.session.call( Main.extensionManager.openExtensionPrefs(uuid, parentWindow, options);
'org.gnome.Shell.Extensions',
'/org/gnome/Shell/Extensions',
'org.gnome.Shell.Extensions',
'OpenExtensionPrefs',
new GLib.Variant('(ssa{sv})', [uuid, parentWindow, options]),
null,
Gio.DBusCallFlags.NONE,
-1,
null);
} }
ReloadExtensionAsync(params, invocation) { ReloadExtensionAsync(params, invocation) {