[gnome-documents] mainToolbar: Don't forward key presses to the search bar on load-error



commit 983f439c8348ca04eff6b911c5a05ca52e7bd872
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon May 27 16:27:51 2013 +0200

    mainToolbar: Don't forward key presses to the search bar on load-error
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700716

 src/mainToolbar.js |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 44e9b03..c83d399 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -39,6 +39,7 @@ const MainToolbar = new Lang.Class({
 
     _init: function() {
         this._model = null;
+        this._handleEvent = true;
 
         this.widget = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
         this.widget.show();
@@ -50,9 +51,23 @@ const MainToolbar = new Lang.Class({
         this._searchbar = this.createSearchbar();
         if (this._searchbar)
             this.widget.add(this._searchbar.widget);
+
+        Application.documentManager.connect('load-started', Lang.bind(this,
+            function() {
+                this._handleEvent = true;
+            }));
+
+        Application.documentManager.connect('load-error', Lang.bind(this, this._onLoadErrorOrPassword));
+    },
+
+    _onLoadErrorOrPassword: function() {
+        this._handleEvent = false;
     },
 
     handleEvent: function(event) {
+        if (!this._handleEvent)
+            return false;
+
         let res = this._searchbar.handleEvent(event);
         return res;
     },


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