[gnome-documents] searchbar: let unhandled events fall through to other widgets



commit 29a33abe727c44f966e6bf155a478a6b7197ca6a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Nov 1 23:22:22 2011 -0400

    searchbar: let unhandled events fall through to other widgets
    
    If the search entry doesn't handle the event, let it fall through instead
    of eating it in MainWindow.

 src/mainWindow.js |    2 +-
 src/searchbar.js  |   21 ++++++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 68373f1..75d1369 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -269,7 +269,7 @@ MainWindow.prototype = {
 
         if (!Global.searchController.getSearchIn()) {
             Global.searchController.deliverEvent(event);
-            return true;
+            return Global.searchController.getEventHandled();
         }
 
         return false;
diff --git a/src/searchbar.js b/src/searchbar.js
index 9a76e6c..6a5b65d 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -140,6 +140,7 @@ SearchController.prototype = {
         this._searchVisible = false;
         this._searchIn = false;
         this._dropdownState = false;
+        this._eventHandled = false;
         this._string = '';
     },
 
@@ -196,6 +197,14 @@ SearchController.prototype = {
 
     deliverEvent: function(event) {
         this.emit('deliver-event', event);
+    },
+
+    setEventHandled: function(handled) {
+        this._eventHandled = handled;
+    },
+
+    getEventHandled: function() {
+        return this._eventHandled;
     }
 };
 Signals.addSignalMethods(SearchController.prototype);
@@ -378,6 +387,8 @@ Searchbar.prototype = {
         if (!this._searchEntry.get_realized())
             this._searchEntry.realize();
 
+        let handled = false;
+
         let preeditChanged = false;
         let preeditChangedId =
             this._searchEntry.connect('preedit-changed', Lang.bind(this,
@@ -391,10 +402,14 @@ Searchbar.prototype = {
 
         this._searchEntry.disconnect(preeditChangedId);
 
-        if (((res && (newText != oldText)) || preeditChanged) &&
-            !Global.searchController.getSearchIn()) {
-            Global.searchController.setSearchVisible(true);
+        if (((res && (newText != oldText)) || preeditChanged)) {
+            handled = true;
+
+            if (!Global.searchController.getSearchIn())
+                Global.searchController.setSearchVisible(true);
         }
+
+        Global.searchController.setEventHandled(handled);
     },
 
     _moveIn: function(eventDevice) {



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