[gnome-shell/T27795: 115/138] remoteSearch: Activate the app context before the result
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/T27795: 115/138] remoteSearch: Activate the app context before the result
- Date: Tue, 1 Oct 2019 23:39:00 +0000 (UTC)
commit 2001a7815d6bdc85fee6faaed90f4375086c3c40
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 668ac7402e..2ecd8b6432 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;
@@ -326,6 +327,8 @@ var RemoteSearchProvider = class {
}
activateResult(id) {
+ // Activate the app so the splash is shown if needed
+ this.activateAppContext();
this.proxy.ActivateResultRemote(id);
}
@@ -333,7 +336,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();
}
};
@@ -345,10 +354,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]