[tasque/transition: 81/213] Add default category.
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque/transition: 81/213] Add default category.
- Date: Wed, 29 Aug 2012 18:40:50 +0000 (UTC)
commit 644f31b4200f6649135629fcb2f7a810ddf11086
Author: Antonius Riha <antoniusriha gmail com>
Date: Thu Jul 26 17:14:39 2012 +0200
Add default category.
* This makes life in the ViewModel *much* easier.
src/libtasque/Backend.cs | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/libtasque/Backend.cs b/src/libtasque/Backend.cs
index e5320b3..8ba6e2e 100644
--- a/src/libtasque/Backend.cs
+++ b/src/libtasque/Backend.cs
@@ -49,6 +49,13 @@ namespace Tasque
categoriesChangedSources = new List<INotifyCollectionChanged> ();
Categories = new SortedNotifyCollection<Category> ();
+
+ // create default category here, because it is required for the model to be there. Overwrite
+ // default category preferably in child class constructor with more appropriate value
+ var defaultCategory = new Category ("Default");
+ Categories.Add (defaultCategory);
+ DefaultCategory = defaultCategory;
+
Categories.CollectionChanged += HandleCategoriesChanged;
}
@@ -64,6 +71,17 @@ namespace Tasque
/// be shown so the user can configure the backend.
/// </value>
public abstract bool Configured { get; }
+
+ public Category DefaultCategory {
+ get { return defaultCategory; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ if (!Categories.Contains (value))
+ throw new ArgumentException ("Value must be an element of Backend.Categories.", "value");
+ defaultCategory = value;
+ }
+ }
/// <value>
/// Inidication that the backend is initialized
@@ -237,6 +255,7 @@ namespace Tasque
}
List<INotifyCollectionChanged> categoriesChangedSources;
+ Category defaultCategory;
SortedNotifyCollection<Task> tasks;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]