[tasque] Fix 'task not filtered out from task group'
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque] Fix 'task not filtered out from task group'
- Date: Sat, 19 Jan 2013 20:27:44 +0000 (UTC)
commit 0f94cfc87544024d240cc5338334972fe7d53d78
Author: Antonius Riha <antoniusriha gmail com>
Date: Sat Jan 19 21:21:55 2013 +0100
Fix 'task not filtered out from task group'
src/Addins/Backends/Dummy/DummyTask.cs | 15 ++++++++++++---
src/Addins/Backends/Rtm/RtmTask.cs | 17 +++++++++++++----
src/Addins/Backends/Sqlite/SqliteTask.cs | 2 ++
3 files changed, 27 insertions(+), 7 deletions(-)
---
diff --git a/src/Addins/Backends/Dummy/DummyTask.cs b/src/Addins/Backends/Dummy/DummyTask.cs
index 83d979d..855a565 100644
--- a/src/Addins/Backends/Dummy/DummyTask.cs
+++ b/src/Addins/Backends/Dummy/DummyTask.cs
@@ -129,21 +129,21 @@ Logger.Debug ("Setting new task priority");
public override void Activate ()
{
Logger.Debug ("DummyTask.Activate ()");
- state = TaskState.Active;
+ SetState (TaskState.Active);
CompletionDate = DateTime.MinValue;
}
public override void Complete ()
{
Logger.Debug ("DummyTask.Complete ()");
- state = TaskState.Completed;
+ SetState (TaskState.Completed);
CompletionDate = DateTime.Now;
}
public override void Delete ()
{
Logger.Debug ("DummyTask.Delete ()");
- state = TaskState.Deleted;
+ SetState (TaskState.Deleted);
backend.DeleteTask (this);
}
@@ -161,5 +161,14 @@ Logger.Debug ("DummyTask.Delete ()");
}
#endregion // Public Methods
+
+ void SetState (TaskState value)
+ {
+ if (value == state)
+ return;
+ OnPropertyChanging ("State");
+ state = value;
+ OnPropertyChanged ("State");
+ }
}
}
diff --git a/src/Addins/Backends/Rtm/RtmTask.cs b/src/Addins/Backends/Rtm/RtmTask.cs
index c36b707..f050562 100644
--- a/src/Addins/Backends/Rtm/RtmTask.cs
+++ b/src/Addins/Backends/Rtm/RtmTask.cs
@@ -247,7 +247,7 @@ namespace Tasque.Backends.Rtm
public override void Activate ()
{
Logger.Debug("Activating Task: " + Name);
- state = TaskState.Active;
+ SetState (TaskState.Active);
CompletionDate = DateTime.MinValue;
}
@@ -256,8 +256,8 @@ namespace Tasque.Backends.Rtm
/// </summary>
public override void Complete ()
{
- Logger.Debug("Completing Task: " + Name);
- state = TaskState.Completed;
+ Logger.Debug("Completing Task: " + Name);
+ SetState (TaskState.Completed);
if(CompletionDate == DateTime.MinValue)
CompletionDate = DateTime.Now;
}
@@ -267,7 +267,7 @@ namespace Tasque.Backends.Rtm
/// </summary>
public override void Delete ()
{
- state = TaskState.Deleted;
+ SetState (TaskState.Deleted);
rtmBackend.DeleteTask (this);
}
@@ -318,5 +318,14 @@ namespace Tasque.Backends.Rtm
}
#endregion // Public Methods
+
+ void SetState (TaskState value)
+ {
+ if (value == state)
+ return;
+ OnPropertyChanging ("State");
+ state = value;
+ OnPropertyChanged ("State");
+ }
}
}
diff --git a/src/Addins/Backends/Sqlite/SqliteTask.cs b/src/Addins/Backends/Sqlite/SqliteTask.cs
index c12c8a5..43c2e78 100644
--- a/src/Addins/Backends/Sqlite/SqliteTask.cs
+++ b/src/Addins/Backends/Sqlite/SqliteTask.cs
@@ -144,9 +144,11 @@ namespace Tasque.Backends.Sqlite
{
get { return (TaskState) this.state; }
set {
+ OnPropertyChanging ("State");
this.state = (int) value;
string command = String.Format("UPDATE Tasks set State='{0}' where ID='{1}'", this.state, id);
backend.Database.ExecuteScalar(command);
+ OnPropertyChanged ("State");
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]