[search] Fix activation of results from custom renderers

The previous commit broke activation when selecting an actor
from a custom renderer.  Fix this by explicitly defining a method
activateSelected on the search renderer.
This commit is contained in:
Colin Walters 2010-03-04 15:08:24 -05:00
parent 83f11870da
commit fbb88da134
3 changed files with 23 additions and 3 deletions

View File

@ -251,6 +251,14 @@ AppSearchResultDisplay.prototype = {
targetActor._delegate.setSelected(true); targetActor._delegate.setSelected(true);
this.selectionIndex = index; this.selectionIndex = index;
return true; return true;
},
activateSelected: function() {
if (this.selectionIndex < 0)
return;
let children = this._container.get_children();
let targetActor = children[this.selectionIndex];
this.provider.activateResult(targetActor._delegate.app.get_id())
} }
} }

View File

@ -432,6 +432,12 @@ OverflowSearchResults.prototype = {
targetActor._delegate.setSelected(true); targetActor._delegate.setSelected(true);
this.selectionIndex = index; this.selectionIndex = index;
return true; return true;
},
activateSelected: function() {
let children = this.actor.get_children();
let targetActor = children[this.selectionIndex];
targetActor._delegate.activate();
} }
} }
@ -597,9 +603,8 @@ SearchResults.prototype = {
return; return;
let meta = this._providerMeta[current]; let meta = this._providerMeta[current];
let resultDisplay = meta.resultDisplay; let resultDisplay = meta.resultDisplay;
let children = resultDisplay.actor.get_children(); resultDisplay.activateSelected();
let targetActor = children[resultDisplay.getSelectionIndex()]; Main.overview.hide();
targetActor._delegate.activate();
} }
} }

View File

@ -80,6 +80,13 @@ SearchResultDisplay.prototype = {
*/ */
selectIndex: function() { selectIndex: function() {
throw new Error("not implemented"); throw new Error("not implemented");
},
/**
* Activate the currently selected search result.
*/
activateSelected: function() {
throw new Error("not implemented");
} }
}; };