[gnome-documents] searchbar: update for latest GdTaggedEntryTag API
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] searchbar: update for latest GdTaggedEntryTag API
- Date: Tue, 6 Aug 2013 14:50:29 +0000 (UTC)
commit f77aba9e18d28ead210880841900cb9179e8aefd
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Aug 6 14:18:12 2013 +0200
searchbar: update for latest GdTaggedEntryTag API
src/searchbar.js | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/searchbar.js b/src/searchbar.js
index a419e0d..ae2aec2 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -286,6 +286,10 @@ const OverviewSearchbar = new Lang.Class({
this._searchEntry.connect('tag-clicked',
Lang.bind(this, this._onTagClicked));
+ this._sourceTag = new Gd.TaggedEntryTag();
+ this._typeTag = new Gd.TaggedEntryTag();
+ this._matchTag = new Gd.TaggedEntryTag();
+
// connect to search string changes in the controller
this._searchChangedId = Application.searchController.connect('search-string-changed',
Lang.bind(this, this._onSearchStringChanged));
@@ -345,35 +349,34 @@ const OverviewSearchbar = new Lang.Class({
}
},
- _onActiveChangedCommon: function(id, manager) {
+ _onActiveChangedCommon: function(id, manager, tag) {
let item = manager.getActiveItem();
if (item.id == 'all') {
- this._searchEntry.remove_tag(id);
+ this._searchEntry.remove_tag(tag);
} else {
- let res = this._searchEntry.add_tag(id, item.name);
+ 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');
}));
- } else {
- this._searchEntry.set_tag_label(id, item.name);
}
}
},
_onActiveSourceChanged: function() {
- this._onActiveChangedCommon('source', Application.sourceManager);
+ this._onActiveChangedCommon('source', Application.sourceManager, this._sourceTag);
},
_onActiveTypeChanged: function() {
- this._onActiveChangedCommon('type', Application.searchTypeManager);
+ this._onActiveChangedCommon('type', Application.searchTypeManager, this._typeTag);
},
_onActiveMatchChanged: function() {
- this._onActiveChangedCommon('match', Application.searchMatchManager);
+ this._onActiveChangedCommon('match', Application.searchMatchManager, this._matchTag);
},
_onTagClicked: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]