extensionPrefs: Export parent window for prefs dialog
Now that OpenExtensionPrefs()'s parentWindow parameter is actually supported, export the main application window so it can act as transient parent to the prefs dialog. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1087
This commit is contained in:
parent
a90fcb7ddb
commit
512862f2d7
@ -4,7 +4,7 @@ imports.gi.versions.Gtk = '3.0';
|
|||||||
|
|
||||||
const Gettext = imports.gettext;
|
const Gettext = imports.gettext;
|
||||||
const Package = imports.package;
|
const Package = imports.package;
|
||||||
const { Gdk, GLib, Gio, GObject, Gtk } = imports.gi;
|
const { Gdk, GLib, Gio, GObject, Gtk, Shew } = imports.gi;
|
||||||
|
|
||||||
Package.initFormat();
|
Package.initFormat();
|
||||||
|
|
||||||
@ -15,6 +15,8 @@ const { ExtensionState, ExtensionType } = ExtensionUtils;
|
|||||||
const GnomeShellIface = loadInterfaceXML('org.gnome.Shell.Extensions');
|
const GnomeShellIface = loadInterfaceXML('org.gnome.Shell.Extensions');
|
||||||
const GnomeShellProxy = Gio.DBusProxy.makeProxyWrapper(GnomeShellIface);
|
const GnomeShellProxy = Gio.DBusProxy.makeProxyWrapper(GnomeShellIface);
|
||||||
|
|
||||||
|
Gio._promisify(Shew.WindowExporter.prototype, 'export', 'export_finish');
|
||||||
|
|
||||||
function loadInterfaceXML(iface) {
|
function loadInterfaceXML(iface) {
|
||||||
const uri = 'resource:///org/gnome/Extensions/dbus-interfaces/%s.xml'.format(iface);
|
const uri = 'resource:///org/gnome/Extensions/dbus-interfaces/%s.xml'.format(iface);
|
||||||
const f = Gio.File.new_for_uri(uri);
|
const f = Gio.File.new_for_uri(uri);
|
||||||
@ -89,6 +91,9 @@ var ExtensionsWindow = GObject.registerClass({
|
|||||||
|
|
||||||
this._updatesCheckId = 0;
|
this._updatesCheckId = 0;
|
||||||
|
|
||||||
|
this._exporter = new Shew.WindowExporter({ window: this });
|
||||||
|
this._exportedHandle = '';
|
||||||
|
|
||||||
this._mainBox.set_focus_vadjustment(this._scrolledWindow.vadjustment);
|
this._mainBox.set_focus_vadjustment(this._scrolledWindow.vadjustment);
|
||||||
|
|
||||||
let action;
|
let action;
|
||||||
@ -152,9 +157,17 @@ var ExtensionsWindow = GObject.registerClass({
|
|||||||
dialog.present();
|
dialog.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
openPrefs(uuid) {
|
async openPrefs(uuid) {
|
||||||
|
if (!this._exportedHandle) {
|
||||||
|
try {
|
||||||
|
this._exportedHandle = await this._exporter.export();
|
||||||
|
} catch (e) {
|
||||||
|
log('Failed to export window: %s'.format(e.message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._shellProxy.OpenExtensionPrefsRemote(uuid,
|
this._shellProxy.OpenExtensionPrefsRemote(uuid,
|
||||||
'',
|
this._exportedHandle,
|
||||||
{ modal: new GLib.Variant('b', true) });
|
{ modal: new GLib.Variant('b', true) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user