[gnome-documents] searchbar: update tag name when active item changes



commit da74e1edd54ffd56e28ee0d830e59d165b590f72
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Nov 26 03:06:50 2011 -0500

    searchbar: update tag name when active item changes
    
    Use the new tagged entry method to change the tag label when the active
    item changes.

 src/searchbar.js |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/searchbar.js b/src/searchbar.js
index efdd7ec..c32eb9a 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -520,11 +520,16 @@ Searchbar.prototype = {
         if (item.id == 'all') {
             this._searchEntry.remove_tag(id);
         } else {
-            this._searchEntry.add_tag(id, item.name);
-            this._searchEntry.connect('tag-button-clicked::' + id, Lang.bind(this,
-                function() {
-                    manager.setActiveItemById('all');
-                }));
+            let res = this._searchEntry.add_tag(id, item.name);
+
+            if (res) {
+                this._searchEntry.connect('tag-button-clicked::' + id, Lang.bind(this,
+                    function() {
+                        manager.setActiveItemById('all');
+                    }));
+            } else {
+                this._searchEntry.set_tag_label(id, item.name);
+            }
         }
     },
 



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