[tasque/viewmodel: 28/78] WiP



commit f893fbef34ab204c593bff45af78e4272eae741a
Author: Antonius Riha <antoniusriha gmail com>
Date:   Sun Jul 29 01:53:41 2012 +0200

    WiP
    
    * Updated usings
    * adjusted some parts to new model API

 src/Tasque.Gtk/CompletedTaskGroup.cs       |    9 +++++----
 src/Tasque.Gtk/NoteWidget.cs               |    1 +
 src/Tasque.Gtk/Preferences.cs              |    1 +
 src/Tasque.Gtk/PreferencesDialog.cs        |    5 +++--
 src/Tasque.Gtk/TaskGroup.cs                |    7 ++++---
 src/Tasque.Gtk/TaskWindow.cs               |    2 +-
 src/Tasque.Gtk/Tasque.Gtk.csproj           |    8 ++++++++
 src/libtasqueui/CompletedTaskGroupModel.cs |    4 ++--
 src/libtasqueui/TaskGroupModel.cs          |    4 ++--
 src/libtasqueui/TaskGroupModelFactory.cs   |    8 ++++----
 10 files changed, 31 insertions(+), 18 deletions(-)
---
diff --git a/src/Tasque.Gtk/CompletedTaskGroup.cs b/src/Tasque.Gtk/CompletedTaskGroup.cs
index ecfc74e..da568a1 100644
--- a/src/Tasque.Gtk/CompletedTaskGroup.cs
+++ b/src/Tasque.Gtk/CompletedTaskGroup.cs
@@ -36,6 +36,7 @@ using System.Collections;
 using CollectionTransforms;
 using System.ComponentModel;
 using Tasque.UIModel.Legacy;
+using System.Collections.Generic;
 
 namespace Tasque
 {
@@ -46,7 +47,7 @@ namespace Tasque
 		/// completed tasks in reverse order (i.e., most recently completed tasks
 		/// at the top of the list).
 		/// </summary>
-		static IEnumerable GetSortedTasks (IEnumerable tasks)
+		static IEnumerable<Task> GetSortedTasks (IEnumerable<Task> tasks)
 		{
 			var cv = new CollectionView<Task> (tasks);
 			cv.SortDescriptions.Add (new SortDescription ("CompletionDate", ListSortDirection.Descending));
@@ -58,7 +59,7 @@ namespace Tasque
 		CompletionDateRange currentRange;
 		
 		public CompletedTaskGroup (string groupName, DateTime rangeStart,
-								   DateTime rangeEnd, IEnumerable tasks)
+								   DateTime rangeEnd, IEnumerable<Task> tasks)
 			: base (groupName, rangeStart, rangeEnd, GetSortedTasks (tasks))
 		{
 			// Don't hide this group when it's empty because then the range
@@ -108,7 +109,7 @@ namespace Tasque
 
 		protected override TaskGroupModel CreateModel (DateTime rangeStart,
 		                                               DateTime rangeEnd,
-		                                               IEnumerable tasks)
+		                                               IEnumerable<Task> tasks)
 		{
 			return new CompletedTaskGroupModel (rangeStart, rangeEnd, tasks);
 		}
@@ -130,7 +131,7 @@ namespace Tasque
 			
 			string cat = Application.Preferences.Get (Preferences.SelectedCategoryKey);
 			if (cat != null) {
-				var categories = Application.Backend.Categories2;
+				var categories = Application.Backend.Categories;
 				foundCategory = categories.SingleOrDefault (c => c.Name == cat);
 			}
 			
diff --git a/src/Tasque.Gtk/NoteWidget.cs b/src/Tasque.Gtk/NoteWidget.cs
index 97830a5..bfebfc9 100644
--- a/src/Tasque.Gtk/NoteWidget.cs
+++ b/src/Tasque.Gtk/NoteWidget.cs
@@ -4,6 +4,7 @@
 using System;
 using Mono.Unix;
 using Gtk;
+using System.Diagnostics;
 
 namespace Tasque
 {
diff --git a/src/Tasque.Gtk/Preferences.cs b/src/Tasque.Gtk/Preferences.cs
index 4e2b23a..cbf1d65 100644
--- a/src/Tasque.Gtk/Preferences.cs
+++ b/src/Tasque.Gtk/Preferences.cs
@@ -32,6 +32,7 @@ using System;
 using System.Collections.Generic;
 using System.Xml;
 using System.IO;
+using System.Diagnostics;
 
 namespace Tasque 
 {
diff --git a/src/Tasque.Gtk/PreferencesDialog.cs b/src/Tasque.Gtk/PreferencesDialog.cs
index e6f31b3..070f77a 100644
--- a/src/Tasque.Gtk/PreferencesDialog.cs
+++ b/src/Tasque.Gtk/PreferencesDialog.cs
@@ -30,8 +30,9 @@ using System;
 using System.Collections.Generic;
 using Gtk;
 using Mono.Unix;
-using Tasque.Backends;
+using Tasque;
 using CollectionTransforms;
+using System.Diagnostics;
 
 namespace Tasque
 {
@@ -596,7 +597,7 @@ namespace Tasque
 			Backend backend = backendComboMap [selectedBackend];
 			filteredCategories = new CollectionView<Category> (backend.Categories);
 			// Filter out the AllCategory
-			filteredCategories.Filter = c => c != null && !(c is AllCategory);
+			filteredCategories.Filter = c => c != null && !(c == null);
 			var adapter = new TreeModelListAdapter<Category> (filteredCategories);
 			categoriesTree.Model = adapter;
 		}
diff --git a/src/Tasque.Gtk/TaskGroup.cs b/src/Tasque.Gtk/TaskGroup.cs
index b989fa3..138f422 100644
--- a/src/Tasque.Gtk/TaskGroup.cs
+++ b/src/Tasque.Gtk/TaskGroup.cs
@@ -29,6 +29,7 @@ using System;
 using System.Collections;
 using System.Linq;
 using Gtk;
+using System.Collections.Generic;
 
 namespace Tasque
 {
@@ -49,7 +50,7 @@ namespace Tasque
 		
 		#region Constructor
 		public TaskGroup (string groupName, DateTime rangeStart,
-						  DateTime rangeEnd, IEnumerable tasks)
+						  DateTime rangeEnd, IEnumerable<Task> tasks)
 		{
 			hideWhenEmpty = true;
 						
@@ -353,7 +354,7 @@ namespace Tasque
 
 		protected virtual TaskGroupModel CreateModel (DateTime rangeStart,
 		                                               DateTime rangeEnd,
-		                                               IEnumerable tasks)
+		                                               IEnumerable<Task> tasks)
 		{
 			return new TaskGroupModel (rangeStart, rangeEnd, tasks);
 		}
@@ -384,7 +385,7 @@ namespace Tasque
 				Application.Preferences.Get (Preferences.SelectedCategoryKey);
 			
 			if (selectedCategoryName != null) {
-				var categories = Application.Backend.Categories2;
+				var categories = Application.Backend.Categories;
 				return categories.SingleOrDefault (c => c.Name == selectedCategoryName);
 			}
 			
diff --git a/src/Tasque.Gtk/TaskWindow.cs b/src/Tasque.Gtk/TaskWindow.cs
index a2e1419..80a2484 100644
--- a/src/Tasque.Gtk/TaskWindow.cs
+++ b/src/Tasque.Gtk/TaskWindow.cs
@@ -34,7 +34,7 @@ using Gdk;
 using Gtk;
 using Mono.Unix;
 
-using Tasque.Backends;
+using Tasque;
 using CollectionTransforms;
 using System.Collections;
 
diff --git a/src/Tasque.Gtk/Tasque.Gtk.csproj b/src/Tasque.Gtk/Tasque.Gtk.csproj
index b95c064..2c83a0b 100644
--- a/src/Tasque.Gtk/Tasque.Gtk.csproj
+++ b/src/Tasque.Gtk/Tasque.Gtk.csproj
@@ -144,6 +144,14 @@
       <Project>{DB8F01D5-0161-48E0-B68A-14AEFD22328F}</Project>
       <Name>libtasqueui</Name>
     </ProjectReference>
+    <ProjectReference Include="..\ObservableTransformCollections\CollectionView\CollectionView.csproj">
+      <Project>{A5AAD70F-F4E8-4CAE-A000-01C2D0A10B92}</Project>
+      <Name>CollectionView</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\ObservableTransformCollections\TreeModelListAdapter\TreeModelListAdapter.csproj">
+      <Project>{95B669DC-0F9F-4C26-B31E-34CFA54112E8}</Project>
+      <Name>TreeModelListAdapter</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
diff --git a/src/libtasqueui/CompletedTaskGroupModel.cs b/src/libtasqueui/CompletedTaskGroupModel.cs
index 932187c..700da8b 100644
--- a/src/libtasqueui/CompletedTaskGroupModel.cs
+++ b/src/libtasqueui/CompletedTaskGroupModel.cs
@@ -24,13 +24,13 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 namespace Tasque
 {
 	public class CompletedTaskGroupModel : TaskGroupModel
 	{
-		public CompletedTaskGroupModel (DateTime rangeStart, DateTime rangeEnd, IEnumerable tasks)
+		public CompletedTaskGroupModel (DateTime rangeStart, DateTime rangeEnd, IEnumerable<Task> tasks)
 			: base (rangeStart, rangeEnd, tasks)
 		{
 		}
diff --git a/src/libtasqueui/TaskGroupModel.cs b/src/libtasqueui/TaskGroupModel.cs
index 67959a5..f34ebaf 100644
--- a/src/libtasqueui/TaskGroupModel.cs
+++ b/src/libtasqueui/TaskGroupModel.cs
@@ -24,8 +24,8 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 using System;
-using System.Collections;
 using CollectionTransforms;
+using System.Collections.Generic;
 
 namespace Tasque
 {
@@ -46,7 +46,7 @@ namespace Tasque
 		
 		public DateTime TimeRangeEnd { get; private set; }
 		
-		public TaskGroupModel (DateTime rangeStart, DateTime rangeEnd, IEnumerable tasks)
+		public TaskGroupModel (DateTime rangeStart, DateTime rangeEnd, IEnumerable<Task> tasks)
 			: base (tasks)
 		{
 			TimeRangeStart = rangeStart;
diff --git a/src/libtasqueui/TaskGroupModelFactory.cs b/src/libtasqueui/TaskGroupModelFactory.cs
index e67e857..f99f3ba 100644
--- a/src/libtasqueui/TaskGroupModelFactory.cs
+++ b/src/libtasqueui/TaskGroupModelFactory.cs
@@ -24,13 +24,13 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 using System;
-using System.Collections;
+using System.Collections.Generic;
 
 namespace Tasque
 {
 	public static class TaskGroupModelFactory
 	{
-		public static TaskGroupModel CreateTodayModel (IEnumerable tasks)
+		public static TaskGroupModel CreateTodayModel (IEnumerable<Task> tasks)
 		{
 			DateTime rangeStart = DateTime.Now;
 			rangeStart = new DateTime (rangeStart.Year, rangeStart.Month,
@@ -41,7 +41,7 @@ namespace Tasque
 			return new TaskGroupModel (rangeStart, rangeEnd, tasks);
 		}
 
-		public static TaskGroupModel CreateOverdueModel (IEnumerable tasks)
+		public static TaskGroupModel CreateOverdueModel (IEnumerable<Task> tasks)
 		{
 			DateTime rangeStart = DateTime.MinValue;
 			DateTime rangeEnd = DateTime.Now.AddDays (-1);
@@ -51,7 +51,7 @@ namespace Tasque
 			return new TaskGroupModel (rangeStart, rangeEnd, tasks);
 		}
 
-		public static TaskGroupModel CreateTomorrowModel (IEnumerable tasks)
+		public static TaskGroupModel CreateTomorrowModel (IEnumerable<Task> tasks)
 		{
 			DateTime rangeStart = DateTime.Now.AddDays (1);
 			rangeStart = new DateTime (rangeStart.Year, rangeStart.Month,



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