shellDBus: Add new OpenExtensionPrefs method

Unlike any other methods in the Extensions API, LaunchExtensionPrefs()
opens what appears to be an application dialog, except that it is
really a separate application that the caller has no control over.

In order to address that, add a new OpenExtensionPrefs() method that
takes additional parameters (modelled after the desktop portal APIs)
that will make it possible to improve the behavior in the future.

The new parameters are ignored for now, but pushing the API out now
will allow us to fill in the functionality post the .0 release.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1074
This commit is contained in:
Florian Müllner 2020-03-05 02:00:57 +01:00 committed by Florian Müllner
parent 3a39fb5ab8
commit fda938175e
2 changed files with 30 additions and 3 deletions

View File

@ -199,14 +199,37 @@
<!--
LaunchExtensionPrefs:
@uuid: The UUID of the extension
Launch preferences of an extension.
Deprecated for OpenExtensionPrefs
-->
<method name="LaunchExtensionPrefs">
<arg type="s" direction="in" name="uuid"/>
</method>
<!--
OpenExtensionPrefs:
@uuid: The UUID of the extension
@parent_window: Identifier for the application window
@options: Vardict with further options
Opens the prefs dialog of extension @uuid.
The following @options are recognized:
<variablelist>
<varlistentry>
<term>modal b</term>
<listitem>
<para>Whether the prefs window should be modal, default: false</para>
</listitem>
</varlistentry>
</variablelist>
-->
<method name="OpenExtensionPrefs">
<arg type="s" direction="in" name="uuid"/>
<arg type="s" direction="in" name="parent_window"/>
<arg type="a{sv}" direction="in" name="options"/>
</method>
<!--
CheckForUpdates:
Update all extensions for which updates are available

View File

@ -312,6 +312,10 @@ var GnomeShellExtensions = class {
}
LaunchExtensionPrefs(uuid) {
this.OpenExtensionPrefs(uuid, '', {});
}
OpenExtensionPrefs(uuid, _parentWindow, _options) {
let appSys = Shell.AppSystem.get_default();
let app = appSys.lookup_app('org.gnome.Extensions.desktop');
let info = app.get_app_info();