[tasque/transition: 90/213] Some adjustments to new model API
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque/transition: 90/213] Some adjustments to new model API
- Date: Wed, 29 Aug 2012 18:41:35 +0000 (UTC)
commit 25c24ffceb1dfdac6512ea8e7ac27cd6daba4d21
Author: Antonius Riha <antoniusriha gmail com>
Date: Sun Jul 29 01:53:41 2012 +0200
Some adjustments to new model API
src/Tasque.Gtk/CompletedTaskGroup.cs | 9 +++++----
.../CompletedTaskGroupModel.cs | 4 ++--
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 => Tasque.Gtk}/TaskGroupModel.cs | 4 ++--
.../TaskGroupModelFactory.cs | 8 ++++----
src/Tasque.Gtk/TaskWindow.cs | 2 +-
src/Tasque.Gtk/Tasque.Gtk.csproj | 8 ++++++++
10 files changed, 31 insertions(+), 18 deletions(-)
---
diff --git a/src/Tasque.Gtk/CompletedTaskGroup.cs b/src/Tasque.Gtk/CompletedTaskGroup.cs
index c917f75..a1eee31 100644
--- a/src/Tasque.Gtk/CompletedTaskGroup.cs
+++ b/src/Tasque.Gtk/CompletedTaskGroup.cs
@@ -13,6 +13,7 @@ using System.Linq;
using System.Collections;
using CollectionTransforms;
using System.ComponentModel;
+using System.Collections.Generic;
namespace Tasque
{
@@ -32,7 +33,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));
@@ -44,7 +45,7 @@ namespace Tasque
ShowCompletedRange 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
@@ -94,7 +95,7 @@ namespace Tasque
protected override TaskGroupModel CreateModel (DateTime rangeStart,
DateTime rangeEnd,
- IEnumerable tasks)
+ IEnumerable<Task> tasks)
{
return new CompletedTaskGroupModel (rangeStart, rangeEnd, tasks);
}
@@ -116,7 +117,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/CompletedTaskGroupModel.cs b/src/Tasque.Gtk/CompletedTaskGroupModel.cs
similarity index 97%
rename from src/tasque/CompletedTaskGroupModel.cs
rename to src/Tasque.Gtk/CompletedTaskGroupModel.cs
index 932187c..700da8b 100644
--- a/src/tasque/CompletedTaskGroupModel.cs
+++ b/src/Tasque.Gtk/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/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/TaskGroupModel.cs b/src/Tasque.Gtk/TaskGroupModel.cs
similarity index 98%
rename from src/tasque/TaskGroupModel.cs
rename to src/Tasque.Gtk/TaskGroupModel.cs
index 67959a5..f34ebaf 100644
--- a/src/tasque/TaskGroupModel.cs
+++ b/src/Tasque.Gtk/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/tasque/TaskGroupModelFactory.cs b/src/Tasque.Gtk/TaskGroupModelFactory.cs
similarity index 89%
rename from src/tasque/TaskGroupModelFactory.cs
rename to src/Tasque.Gtk/TaskGroupModelFactory.cs
index e67e857..f99f3ba 100644
--- a/src/tasque/TaskGroupModelFactory.cs
+++ b/src/Tasque.Gtk/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,
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 7b63b30..aadc3fd 100644
--- a/src/Tasque.Gtk/Tasque.Gtk.csproj
+++ b/src/Tasque.Gtk/Tasque.Gtk.csproj
@@ -141,6 +141,14 @@
<Project>{784C9AA8-2B28-400B-8CC4-DCDC48CA37F0}</Project>
<Name>libtasque</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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]