[tasque/transition: 159/213] [libtasque] Make Task manipulation methods concrete; add change hooks
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque/transition: 159/213] [libtasque] Make Task manipulation methods concrete; add change hooks
- Date: Wed, 29 Aug 2012 18:47:23 +0000 (UTC)
commit 5b01a1116b293ac8fd199bb74af2b9de6bde459d
Author: Antonius Riha <antoniusriha gmail com>
Date: Sat Aug 18 19:58:14 2012 +0200
[libtasque] Make Task manipulation methods concrete; add change hooks
src/libtasque/Task.cs | 39 +++++++++++++++++++++++++++++++++++----
1 files changed, 35 insertions(+), 4 deletions(-)
---
diff --git a/src/libtasque/Task.cs b/src/libtasque/Task.cs
index 62dedac..bfb1cc0 100644
--- a/src/libtasque/Task.cs
+++ b/src/libtasque/Task.cs
@@ -122,10 +122,26 @@ namespace Tasque
#endregion
#region Methods
- public abstract void Activate ();
+ public void Activate ()
+ {
+ Debug.WriteLine ("Task.Activate ()");
+ CompletionDate = DateTime.MinValue;
+ State = TaskState.Active;
+ OnActivate ();
+ }
+
+ protected virtual void OnActivate () {}
- public abstract void Inactivate ();
+ public void Inactivate ()
+ {
+ Debug.WriteLine ("Task.Inactivate ()");
+ CompletionDate = DateTime.Now;
+ State = TaskState.Inactive;
+ OnInactivate ();
+ }
+ protected virtual void OnInactivate () {}
+
public void AddNote (TaskNote note)
{
if (note == null)
@@ -168,11 +184,26 @@ namespace Tasque
return CompareToByPriorityAndName (task);
}
- public abstract void Complete ();
+ public void Complete ()
+ {
+ Debug.WriteLine ("Task.Complete ()");
+ CompletionDate = DateTime.Now;
+ State = TaskState.Completed;
+ OnComplete ();
+ }
+
+ protected virtual void OnComplete () {}
public abstract TaskNote CreateNote (string text);
- public abstract void Delete ();
+ public void Delete ()
+ {
+ Debug.WriteLine ("Task.Delete ()");
+ State = TaskState.Deleted;
+ OnDelete ();
+ }
+
+ protected virtual void OnDelete () {}
public bool RemoveNote (TaskNote note)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]