[gnome-documents] searchbar: fix clicking on a tag's close button



commit 7833236a61bfd0af72fa8f25c5d20f9984e5335e
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Aug 20 09:37:07 2013 -0700

    searchbar: fix clicking on a tag's close button

 src/searchbar.js |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/searchbar.js b/src/searchbar.js
index ae2aec2..3439880 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -285,6 +285,8 @@ const OverviewSearchbar = new Lang.Class({
         this._searchEntry = new Gd.TaggedEntry({ width_request: 500 });
         this._searchEntry.connect('tag-clicked',
             Lang.bind(this, this._onTagClicked));
+        this._searchEntry.connect('tag-button-clicked',
+            Lang.bind(this, this._onTagButtonClicked));
 
         this._sourceTag = new Gd.TaggedEntryTag();
         this._typeTag = new Gd.TaggedEntryTag();
@@ -356,14 +358,7 @@ const OverviewSearchbar = new Lang.Class({
             this._searchEntry.remove_tag(tag);
         } else {
             tag.set_label(item.name);
-            let res = this._searchEntry.add_tag(tag);
-
-            if (res) {
-                this._searchEntry.connect('tag-button-clicked::' + id, Lang.bind(this,
-                    function() {
-                        manager.setActiveItemById('all');
-                    }));
-            }
+            this._searchEntry.add_tag(tag);
         }
     },
 
@@ -379,6 +374,22 @@ const OverviewSearchbar = new Lang.Class({
         this._onActiveChangedCommon('match', Application.searchMatchManager, this._matchTag);
     },
 
+    _onTagButtonClicked: function(entry, tag) {
+        let manager = null;
+
+        if (tag == this._matchTag) {
+            manager = Application.searchMatchManager;
+        } else if (tag == this._typeTag) {
+            manager = Application.searchTypeManager;
+        } else if (tag == this._sourceTag) {
+            manager = Application.sourceManager;
+        }
+
+        if (manager) {
+            manager.setActiveItemById('all');
+        }
+    },
+
     _onTagClicked: function() {
         this._dropdownButton.set_active(true);
     },


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