[gnome-shell/eos3.8: 95/255] remoteSearch: Activate the app context before the result



commit f696a45c690de3237687e4dcd2ef3650b9d05e81
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Thu Jul 13 12:16:01 2017 +0200

    remoteSearch: Activate the app context before the result
    
    The reason for this is that showing the search results in an app can
    take some time, and thus its speedwagon should be shown if needed (which
    accomplished by activating the app context).
    
    Also, prevent activating the app twice by not calling activate() on the
    AppActivationContext, since we already call the remote search method.
    
    https://phabricator.endlessm.com/T3968

 js/ui/remoteSearch.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js
index f939a6595c..735b74feaf 100644
--- a/js/ui/remoteSearch.js
+++ b/js/ui/remoteSearch.js
@@ -3,6 +3,7 @@
 
 const { GdkPixbuf, Gio, GLib, Shell, St } = imports.gi;
 
+const AppActivation = imports.ui.appActivation;
 const FileUtils = imports.misc.fileUtils;
 const IconGridLayout = imports.ui.iconGridLayout;
 
@@ -327,6 +328,8 @@ var RemoteSearchProvider = class {
     }
 
     activateResult(id) {
+        // Activate the app so the splash is shown if needed
+        this.activateAppContext();
         this.proxy.ActivateResultRemote(id);
     }
 
@@ -334,7 +337,13 @@ var RemoteSearchProvider = class {
         // the provider is not compatible with the new version of the interface, launch
         // the app itself but warn so we can catch the error in logs
         log(`Search provider ${this.appInfo.get_id()} does not implement LaunchSearch`);
-        this.appInfo.launch([], global.create_app_launch_context(0, -1));
+        this.activateAppContext();
+    }
+
+    activateAppContext() {
+        let app = Shell.AppSystem.get_default().lookup_app(this.appInfo.get_id());
+        let context = new AppActivation.AppActivationContext(app);
+        context.showSplash();
     }
 };
 
@@ -346,10 +355,14 @@ var RemoteSearchProvider2 = class extends RemoteSearchProvider {
     }
 
     activateResult(id, terms) {
+        // Activate the app so the splash is shown if needed
+        this.activateAppContext();
         this.proxy.ActivateResultRemote(id, terms, global.get_current_time());
     }
 
     launchSearch(terms) {
+        // Activate the app so the splash is shown if needed
+        this.activateAppContext();
         this.proxy.LaunchSearchRemote(terms, global.get_current_time());
     }
 };


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