[longomatch] Fix plays filtering
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix plays filtering
- Date: Sat, 11 Aug 2012 15:05:01 +0000 (UTC)
commit 8aed845d8a3c0b9f05b8d06858e8cc874b11e274
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sat Aug 11 12:24:03 2012 +0200
Fix plays filtering
LongoMatch.Core/Common/PlaysFilter.cs | 14 ++++++++++++--
LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs | 7 +++++++
2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Core/Common/PlaysFilter.cs b/LongoMatch.Core/Common/PlaysFilter.cs
index c52c2c4..1559b7a 100644
--- a/LongoMatch.Core/Common/PlaysFilter.cs
+++ b/LongoMatch.Core/Common/PlaysFilter.cs
@@ -100,9 +100,19 @@ namespace LongoMatch.Common
} else if (o is Category) {
return VisibleCategories.Contains(o as Category);
} else if (o is Play) {
+ bool cat_match, player_match;
Play play = o as Play;
- return VisiblePlayers.Intersect(play.Players.GetTagsValues()).Count() != 0 &&
- VisibleCategories.Contains(play.Category);
+
+ cat_match = VisibleCategories.Contains(play.Category);
+ if (!cat_match)
+ return false;
+
+ if (play.Players.Tags.Count == 0)
+ player_match = true;
+ else
+ player_match = VisiblePlayers.Intersect(play.Players.GetTagsValues()).Count() != 0;
+
+ return player_match && cat_match;
} else {
return false;
}
diff --git a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
index 9146e24..02636b7 100644
--- a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
+++ b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
@@ -102,11 +102,17 @@ namespace LongoMatch.Gui.Component
set {
filter = value;
filter.FilterUpdated += OnFilterUpdated;
+ Refilter();
}
get {
return filter;
}
}
+
+ public void Refilter() {
+ if (modelFilter != null)
+ modelFilter.Refilter();
+ }
new public TreeStore Model {
set {
@@ -342,6 +348,7 @@ namespace LongoMatch.Gui.Component
protected void OnTag(object obj, EventArgs args) {
if(TagPlay != null)
TagPlay((Play)GetValueFromPath(Selection.GetSelectedRows()[0]));
+ Refilter();
}
protected void OnSnapshot(object obj, EventArgs args) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]