[tasque] Query model for task number instead of view



commit 3bdfbd53b207d572a5d5da3b65132236625de81f
Author: Antonius Riha <antoniusriha gmail com>
Date:   Thu Jan 10 14:08:45 2013 +0100

    Query model for task number instead of view

 src/Gtk.Tasque/TaskGroup.cs |    6 ++----
 src/Gtk.Tasque/TaskView.cs  |    5 -----
 2 files changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/src/Gtk.Tasque/TaskGroup.cs b/src/Gtk.Tasque/TaskGroup.cs
index d8b4df6..3685d66 100644
--- a/src/Gtk.Tasque/TaskGroup.cs
+++ b/src/Gtk.Tasque/TaskGroup.cs
@@ -330,8 +330,7 @@ namespace Tasque
 		{
 			base.OnRealized ();
 			
-			if (taskView.GetNumberOfTasks () == 0
-					&& (!Model.ShowCompletedTasks || hideWhenEmpty))
+			if (!Model.Any () && (!Model.ShowCompletedTasks || hideWhenEmpty))
 				Hide ();
 			else
 				Show ();
@@ -416,8 +415,7 @@ namespace Tasque
 		{
 			//Logger.Debug ("TaskGroup (\"{0}\").OnNumberOfTasksChanged ()", DisplayName);
 			// Check to see whether this group should be hidden or shown.
-			if (taskView.GetNumberOfTasks () == 0
-					&& (!Model.ShowCompletedTasks || hideWhenEmpty))
+			if (!Model.Any () && (!Model.ShowCompletedTasks || hideWhenEmpty))
 				Hide ();
 			else
 				Show ();
diff --git a/src/Gtk.Tasque/TaskView.cs b/src/Gtk.Tasque/TaskView.cs
index 5a187e8..c6ad1c3 100644
--- a/src/Gtk.Tasque/TaskView.cs
+++ b/src/Gtk.Tasque/TaskView.cs
@@ -123,11 +123,6 @@ namespace Gtk.Tasque
 			modelFilter.Refilter ();
 		}
 		
-		public int GetNumberOfTasks ()
-		{
-			return modelFilter.IterNChildren ();
-		}
-		
 		public ITaskColumn GetColumn (Type taskColumnType)
 		{
 			return columns.SingleOrDefault (c => c.GetType () == taskColumnType);



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