extensionPrefs: Stop handling UUIDs on the command line

We are jumping through quite some hoops to support showing only the
preference dialog when given a UUID on the command line.

As gnome-shell is about to stop calling out to us for the prefs dialog,
the reason for supporting this is going away, so remove all the special
handling.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1106
This commit is contained in:
Florian Müllner 2020-03-05 19:44:28 +01:00 committed by Florian Müllner
parent 2b517e352d
commit d76162c1c0
2 changed files with 5 additions and 54 deletions

View File

@ -4,7 +4,7 @@ Name=Extensions
# Translators: Do NOT translate or transliterate this text (this is an icon file name)! # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=@app_id@ Icon=@app_id@
Comment=Configure GNOME Shell Extensions Comment=Configure GNOME Shell Extensions
Exec=@bindir@/@prgname@ %u Exec=@bindir@/@prgname@
DBusActivatable=true DBusActivatable=true
Categories=GNOME;GTK; Categories=GNOME;GTK;
OnlyShowIn=GNOME; OnlyShowIn=GNOME;

View File

@ -29,12 +29,6 @@ function loadInterfaceXML(iface) {
return null; return null;
} }
function stripPrefix(string, prefix) {
if (string.slice(0, prefix.length) == prefix)
return string.slice(prefix.length);
return string;
}
function toggleState(action) { function toggleState(action) {
let state = action.get_state(); let state = action.get_state();
action.change_state(new GLib.Variant('b', !state.get_boolean())); action.change_state(new GLib.Variant('b', !state.get_boolean()));
@ -44,10 +38,7 @@ var Application = GObject.registerClass(
class Application extends Gtk.Application { class Application extends Gtk.Application {
_init() { _init() {
GLib.set_prgname('gnome-shell-extension-prefs'); GLib.set_prgname('gnome-shell-extension-prefs');
super._init({ super._init({ application_id: 'org.gnome.Extensions' });
application_id: 'org.gnome.Extensions',
flags: Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
});
} }
get shellProxy() { get shellProxy() {
@ -76,20 +67,6 @@ class Application extends Gtk.Application {
this._shellProxy = new GnomeShellProxy(Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell'); this._shellProxy = new GnomeShellProxy(Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell');
this._window = new ExtensionsWindow({ application: this }); this._window = new ExtensionsWindow({ application: this });
} }
vfunc_command_line(commandLine) {
let [prgName_, uuid] = commandLine.get_arguments();
if (uuid) {
// Strip off "extension:///" prefix which fakes a URI, if it exists
uuid = stripPrefix(uuid, 'extension:///');
this._window.openPrefs(uuid);
} else {
this.activate();
}
return 0;
}
}); });
var ExtensionsWindow = GObject.registerClass({ var ExtensionsWindow = GObject.registerClass({
@ -108,8 +85,6 @@ var ExtensionsWindow = GObject.registerClass({
_init(params) { _init(params) {
super._init(params); super._init(params);
this._startupUuid = null;
this._loaded = false;
this._prefsDialog = null; this._prefsDialog = null;
this._updatesCheckId = 0; this._updatesCheckId = 0;
@ -177,35 +152,16 @@ var ExtensionsWindow = GObject.registerClass({
} }
openPrefs(uuid) { openPrefs(uuid) {
if (!this._loaded)
this._startupUuid = uuid;
else if (!this._showPrefs(uuid))
this.present();
}
_showPrefs(uuid) {
if (this._prefsDialog) if (this._prefsDialog)
return false; return;
let row = this._findExtensionRow(uuid); let row = this._findExtensionRow(uuid);
if (!row || !row.hasPrefs)
return false;
this._prefsDialog = new ExtensionPrefsDialog(row); this._prefsDialog = new ExtensionPrefsDialog(row);
if (this.visible)
this._prefsDialog.set({ transient_for: this, modal: true }); this._prefsDialog.set({ transient_for: this, modal: true });
this._prefsDialog.connect('destroy', () => { this._prefsDialog.connect('destroy', () => (this._prefsDialog = null));
this._prefsDialog = null;
if (!this.visible)
this.destroy();
});
this._prefsDialog.show(); this._prefsDialog.show();
return true;
} }
_showAbout() { _showAbout() {
@ -359,11 +315,6 @@ var ExtensionsWindow = GObject.registerClass({
_extensionsLoaded() { _extensionsLoaded() {
this._syncListVisibility(); this._syncListVisibility();
this._checkUpdates(); this._checkUpdates();
if (this._startupUuid)
this._showPrefs(this._startupUuid);
this._startupUuid = null;
this._loaded = true;
} }
}); });