Compare commits

...

1 Commits

Author SHA1 Message Date
Florian Müllner
078a1bda14 shellDBus: Return error on invalid app IDs
When passing an invalid or unknown app ID to FocusApp(), we currently
open the app picker and silently fail to select the desired app.
Instead of half-working like that, make it clear that the argument
was invalid by returning an appropriate error. (It's easy to get the
ID wrong, as unlike appstream/flatpak IDs, we include the ".desktop"
suffix).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/337
2019-01-08 22:40:56 +01:00

View File

@ -101,9 +101,20 @@ var GnomeShell = new Lang.Class({
Main.osdWindowManager.show(monitorIndex, icon, label, level, maxLevel); Main.osdWindowManager.show(monitorIndex, icon, label, level, maxLevel);
}, },
FocusApp(id) { FocusAppAsync(params, invocation) {
let [id] = params;
let appSys = Shell.AppSystem.get_default();
if (appSys.lookup_app(id) == null) {
invocation.return_error_literal(
Gio.DBusError,
Gio.DBusError.FILE_NOT_FOUND,
`No application with ID ${id}`);
return;
}
this.ShowApplications(); this.ShowApplications();
Main.overview.viewSelector.appDisplay.selectApp(id); Main.overview.viewSelector.appDisplay.selectApp(id);
invocation.return_value(null);
}, },
ShowApplications() { ShowApplications() {