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
This commit is contained in:
Florian Müllner 2010-02-15 23:11:09 +01:00
parent 94f32030e6
commit 97e19d7d4a
2 changed files with 14 additions and 1 deletions

View File

@ -236,6 +236,16 @@ BaseAppSearchProvider.prototype = {
}, },
activateResult: function(id) { 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); let app = this._appSys.get_app(id);
app.launch(); app.launch();
} }

View File

@ -390,7 +390,10 @@ SearchResult.prototype = {
}, },
shellWorkspaceLaunch: function() { 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);
} }
} }