From 97e19d7d4a0ec4f980b9c30ca3ddd4dc5bf1519c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 15 Feb 2010 23:11:09 +0100 Subject: [PATCH] Adjust behavior of search results to match app well Currently, activating a search result always opens a new window. Change this behavior, so that if an application has open windows, the most recently used one is activated instead. Also change the implementation of dnd of search results to allow providers to treat results activated via dnd differently. https://bugzilla.gnome.org/show_bug.cgi?id=610027 --- js/ui/appDisplay.js | 10 ++++++++++ js/ui/dash.js | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 6e934c2df..1af79941b 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -236,6 +236,16 @@ BaseAppSearchProvider.prototype = { }, activateResult: function(id) { + let app = this._appSys.get_app(id); + let windows = app.get_windows(); + + if (windows.length > 0) + Main.overview.activateWindow(windows[0], global.get_current_time()); + else + app.launch(); + }, + + dragActivateResult: function(id) { let app = this._appSys.get_app(id); app.launch(); } diff --git a/js/ui/dash.js b/js/ui/dash.js index 90c8abe01..38a8590c6 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -390,7 +390,10 @@ SearchResult.prototype = { }, shellWorkspaceLaunch: function() { - this.provider.activateResult(this.metaInfo.id); + if (this.provider.dragActivateResult) + this.provider.dragActivateResult(this.metaInfo.id); + else + this.provider.activateResult(this.metaInfo.id); } }