summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2019-01-08 22:03:13 +0100
committerFlorian Müllner <fmuellner@gnome.org>2019-01-08 22:40:56 +0100
commit078a1bda1414c6bb4565b294f0b8f0a7025b85f0 (patch)
tree468edca19afe5183570da0e50caaf9033b4b30f0
parent5edceba5883641fbf8ae5f7810be9fbce81a59f7 (diff)
downloadgnome-shell-wip/fmuellner/focus-app-error.tar.gz
shellDBus: Return error on invalid app IDswip/fmuellner/focus-app-error
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
-rw-r--r--js/ui/shellDBus.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index a200a1bdd..c1d604fa2 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -101,9 +101,20 @@ var GnomeShell = new Lang.Class({
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();
Main.overview.viewSelector.appDisplay.selectApp(id);
+ invocation.return_value(null);
},
ShowApplications() {