[gnome-shell] search: Factor out a function



commit 991179835e344d8d9a141e3f9fb9094e4582346c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Sep 30 00:19:28 2014 -0600

    search: Factor out a function

 js/ui/search.js |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/search.js b/js/ui/search.js
index 8e6b1dd..ec00bae 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -452,6 +452,13 @@ const SearchResults = new Lang.Class({
         this._updateResults(provider, results);
     },
 
+    _clearSearchTimeout: function() {
+        if (this._searchTimeoutId > 0) {
+            GLib.source_remove(this._searchTimeoutId);
+            this._searchTimeoutId = 0;
+        }
+    },
+
     _doSearch: function() {
         this._startingSearch = false;
 
@@ -470,10 +477,7 @@ const SearchResults = new Lang.Class({
 
         this._updateSearchProgress();
 
-        if (this._searchTimeoutId > 0) {
-            GLib.source_remove(this._searchTimeoutId);
-            this._searchTimeoutId = 0;
-        }
+        this._clearSearchTimeout();
     },
 
     _onSearchTimeout: function() {
@@ -489,10 +493,7 @@ const SearchResults = new Lang.Class({
         this._cancellable.reset();
 
         if (!terms) {
-            if (this._searchTimeoutId > 0) {
-                GLib.source_remove(this._searchTimeoutId);
-                this._searchTimeoutId = 0;
-            }
+            this._clearSearchTimeout();
             return;
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]