[gnome-shell] shellDBus: Implement all methods asynchronously



commit 3adad0da810c39e9c7cd175c689aafca973e1705
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jun 17 15:29:42 2021 +0200

    shellDBus: Implement all methods asynchronously
    
    In order to restrict callers, we will need access to the invocation,
    not just the unpacked method parameters.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970>

 js/ui/shellDBus.js | 40 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 2f21ba41d7..62c840094b 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -72,11 +72,26 @@ var GnomeShell = class {
         return [success, returnValue];
     }
 
-    FocusSearch() {
+    /**
+     * Focus the overview's search entry
+     *
+     * @param {...any} params - method parameters
+     * @param {Gio.DBusMethodInvocation} invocation - the invocation
+     * @returns {void}
+     */
+    FocusSearchAsync(params, invocation) {
         Main.overview.focusSearch();
+        invocation.return_value(null);
     }
 
-    ShowOSD(params) {
+    /**
+     * Show OSD with the specified parameters
+     *
+     * @param {...any} params - method parameters
+     * @param {Gio.DBusMethodInvocation} invocation - the invocation
+     * @returns {void}
+     */
+    ShowOSDAsync([params], invocation) {
         for (let param in params)
             params[param] = params[param].deep_unpack();
 
@@ -97,14 +112,31 @@ var GnomeShell = class {
             icon = Gio.Icon.new_for_string(serializedIcon);
 
         Main.osdWindowManager.show(monitorIndex, icon, label, level, maxLevel);
+        invocation.return_value(null);
     }
 
-    FocusApp(id) {
+    /**
+     * Focus specified app in the overview's app grid
+     *
+     * @param {string} id - an application ID
+     * @param {Gio.DBusMethodInvocation} invocation - the invocation
+     * @returns {void}
+     */
+    FocusAppAsync([id], invocation) {
         Main.overview.selectApp(id);
+        invocation.return_value(null);
     }
 
-    ShowApplications() {
+    /**
+     * Show the overview's app grid
+     *
+     * @param {...any} params - method parameters
+     * @param {Gio.DBusMethodInvocation} invocation - the invocation
+     * @returns {void}
+     */
+    ShowApplicationsAsync(params, invocation) {
         Main.overview.show(ControlsState.APP_GRID);
+        invocation.return_value(null);
     }
 
     GrabAcceleratorAsync(params, invocation) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]