[gnome-shell/wip/re-search-v2: 22/29] viewSelector: this.active --> this._searchActive
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/re-search-v2: 22/29] viewSelector: this.active --> this._searchActive
- Date: Tue, 4 Dec 2012 18:40:10 +0000 (UTC)
commit b2a98b25c554110a037cb238e1fa6cea63b9e7f3
Author: Tanner Doshier <doshitan gmail com>
Date: Fri Aug 24 11:24:49 2012 -0500
viewSelector: this.active --> this._searchActive
'active' isn't terribly clear about just what is active; also, make it
private, remove an useless extra object state we were saving, and
refactor some messy code.
https://bugzilla.gnome.org/show_bug.cgi?id=682050
js/ui/viewSelector.js | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 6136914..02e5347 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -52,8 +52,7 @@ const ViewSelector = new Lang.Class({
this._activePage = null;
- this.active = false;
- this._searchPending = false;
+ this._searchActive = false;
this._searchTimeoutId = 0;
this._searchSystem = new Search.SearchSystem();
@@ -226,7 +225,7 @@ const ViewSelector = new Lang.Class({
},
_onShowAppsButtonToggled: function() {
- if (this.active)
+ if (this._searchActive)
this.reset();
else
this._showPage(this._showAppsButton.checked ? this._appsPage
@@ -247,7 +246,7 @@ const ViewSelector = new Lang.Class({
let symbol = event.get_key_symbol();
if (symbol == Clutter.Escape) {
- if (this.active)
+ if (this._searchActive)
this.reset();
else if (this._showAppsButton.checked)
this._resetShowAppsButton();
@@ -255,9 +254,9 @@ const ViewSelector = new Lang.Class({
Main.overview.hide();
return true;
} else if (Clutter.keysym_to_unicode(symbol) ||
- (symbol == Clutter.BackSpace && this.active)) {
+ (symbol == Clutter.BackSpace && this._searchActive)) {
this.startSearch(event);
- } else if (!this.active) {
+ } else if (!this._searchActive) {
if (symbol == Clutter.Tab || symbol == Clutter.Down) {
this._activePage.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
return true;
@@ -331,13 +330,15 @@ const ViewSelector = new Lang.Class({
},
_onTextChanged: function (se, prop) {
- let searchPreviouslyActive = this.active;
- this.active = this._entry.get_text() != '';
- this._searchPending = this.active && !searchPreviouslyActive;
- if (this._searchPending) {
+ let searchPreviouslyActive = this._searchActive;
+ this._searchActive = this._entry.get_text() != '';
+
+ let startSearch = this._searchActive && !searchPreviouslyActive;
+ if (startSearch) {
this._searchResults.startingSearch();
}
- if (this.active) {
+
+ if (this._searchActive) {
this._entry.set_secondary_icon(this._activeIcon);
if (this._iconClickedId == 0) {
@@ -353,14 +354,14 @@ const ViewSelector = new Lang.Class({
this._entry.set_secondary_icon(this._inactiveIcon);
this._searchCancelled();
- }
- if (!this.active) {
+
if (this._searchTimeoutId > 0) {
Mainloop.source_remove(this._searchTimeoutId);
this._searchTimeoutId = 0;
}
return;
}
+
if (this._searchTimeoutId > 0)
return;
this._searchTimeoutId = Mainloop.timeout_add(150, Lang.bind(this, this._doSearch));
@@ -382,7 +383,7 @@ const ViewSelector = new Lang.Class({
}
this._searchResults.activateDefault();
return true;
- } else if (this.active) {
+ } else if (this._searchActive) {
let arrowNext, nextDirection;
if (entry.get_text_direction() == Clutter.TextDirection.RTL) {
arrowNext = Clutter.Left;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]