[tasque/transition: 103/213] Add Task.CreateNote method for NoteDialog to work
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque/transition: 103/213] Add Task.CreateNote method for NoteDialog to work
- Date: Wed, 29 Aug 2012 18:42:41 +0000 (UTC)
commit 280ded8c0824bae36645777cb45e4b968ca950ef
Author: Antonius Riha <antoniusriha gmail com>
Date: Thu Aug 16 13:42:44 2012 +0200
Add Task.CreateNote method for NoteDialog to work
* DummyTask: add CreateNote
src/Addins/DummyBackend/DummyTask.cs | 5 +++++
src/Tasque.Gtk/NoteDialog.cs | 14 ++++----------
src/libtasque/Task.cs | 2 ++
3 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/Addins/DummyBackend/DummyTask.cs b/src/Addins/DummyBackend/DummyTask.cs
index 39614f0..24c069a 100644
--- a/src/Addins/DummyBackend/DummyTask.cs
+++ b/src/Addins/DummyBackend/DummyTask.cs
@@ -55,5 +55,10 @@ namespace Tasque.Backends.Dummy
State = TaskState.Deleted;
}
#endregion
+
+ public override TaskNote CreateNote (string text)
+ {
+ return new DummyNote (text);
+ }
}
}
diff --git a/src/Tasque.Gtk/NoteDialog.cs b/src/Tasque.Gtk/NoteDialog.cs
index 402dfcf..cbe2dcf 100644
--- a/src/Tasque.Gtk/NoteDialog.cs
+++ b/src/Tasque.Gtk/NoteDialog.cs
@@ -137,22 +137,16 @@ namespace Tasque
{
NoteWidget nWidget = sender as NoteWidget;
- // if null, add a note, else, modify it
- if(nWidget.Note == null) {
+ // if null, add a note
+ if (nWidget.Note == null) {
try {
- TaskNote note = task.CreateNote(nWidget.Text);
+ var note = task.CreateNote (nWidget.Text);
+ task.AddNote (note);
nWidget.Note = note;
} catch(Exception e) {
Debug.WriteLine("Unable to create a note");
Debug.WriteLine(e.ToString());
}
- } else {
- try {
- task.SaveNote(nWidget.Note);
- } catch(Exception e) {
- Debug.WriteLine("Unable to save note");
- Debug.WriteLine(e.ToString());
- }
}
}
#endregion // Event Handlers
diff --git a/src/libtasque/Task.cs b/src/libtasque/Task.cs
index 40215cd..69b714e 100644
--- a/src/libtasque/Task.cs
+++ b/src/libtasque/Task.cs
@@ -165,6 +165,8 @@ namespace Tasque
}
public abstract void Complete ();
+
+ public abstract TaskNote CreateNote (string text);
public abstract void Delete ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]