viewSelector: stop launching app from empty search

In the overview, when there is no text in the search entry, this._searchActive
will be set to false. Moving the Clutter.Return code block ensures that
pressing enter in the search field after deleting the characters of a search
will no longer launch the #1 application for the previous search.

https://bugzilla.gnome.org/show_bug.cgi?id=692391
This commit is contained in:
Hashem Nasarat 2013-01-27 14:00:59 -05:00 committed by Rui Matos
parent 1db353a0fc
commit 8ca25aed8b

View File

@ -368,15 +368,6 @@ const ViewSelector = new Lang.Class({
this.reset(); this.reset();
return true; return true;
} }
} else if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
// We can't connect to 'activate' here because search providers
// might want to do something with the modifiers in activateDefault.
if (this._searchTimeoutId > 0) {
Mainloop.source_remove(this._searchTimeoutId);
this._doSearch();
}
this._searchResults.activateDefault();
return true;
} else if (this._searchActive) { } else if (this._searchActive) {
let arrowNext, nextDirection; let arrowNext, nextDirection;
if (entry.get_text_direction() == Clutter.TextDirection.RTL) { if (entry.get_text_direction() == Clutter.TextDirection.RTL) {
@ -401,6 +392,15 @@ const ViewSelector = new Lang.Class({
} else if (symbol == arrowNext && this._text.position == -1) { } else if (symbol == arrowNext && this._text.position == -1) {
this._searchResults.navigateFocus(nextDirection); this._searchResults.navigateFocus(nextDirection);
return true; return true;
} else if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
// We can't connect to 'activate' here because search providers
// might want to do something with the modifiers in activateDefault.
if (this._searchTimeoutId > 0) {
Mainloop.source_remove(this._searchTimeoutId);
this._doSearch();
}
this._searchResults.activateDefault();
return true;
} }
} }
return false; return false;