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:
parent
2b517e352d
commit
d76162c1c0
@ -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;
|
||||||
|
@ -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);
|
||||||
|
this._prefsDialog.set({ transient_for: this, modal: true });
|
||||||
|
|
||||||
if (this.visible)
|
this._prefsDialog.connect('destroy', () => (this._prefsDialog = null));
|
||||||
this._prefsDialog.set({ transient_for: this, modal: true });
|
|
||||||
|
|
||||||
this._prefsDialog.connect('destroy', () => {
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user