[tasque] Introduced NoteSupport property on ITask
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque] Introduced NoteSupport property on ITask
- Date: Sat, 26 Jan 2013 19:12:14 +0000 (UTC)
commit 3e8f66e2a2cf1f14c3927a8edc15630c2699a9c4
Author: Antonius Riha <antoniusriha gmail com>
Date: Sat Jan 26 20:11:48 2013 +0100
Introduced NoteSupport property on ITask
src/Addins/Backends/Dummy/DummyTask.cs | 4 +-
src/Addins/Backends/Rtm/RtmTask.cs | 4 +-
src/Addins/Backends/Sqlite/SqliteTask.cs | 4 +-
src/Gtk.Tasque/NoteDialog.cs | 2 +-
src/libtasque/AbstractTask.cs | 2 +-
src/libtasque/ITask.cs | 12 ++++----
src/libtasque/NoteSupport.cs | 48 ++++++++++++++++++++++++++++++
src/libtasque/TaskGroupModel.cs | 4 +-
src/libtasque/libtasque.csproj | 1 +
9 files changed, 65 insertions(+), 16 deletions(-)
---
diff --git a/src/Addins/Backends/Dummy/DummyTask.cs b/src/Addins/Backends/Dummy/DummyTask.cs
index 855a565..fb3423c 100644
--- a/src/Addins/Backends/Dummy/DummyTask.cs
+++ b/src/Addins/Backends/Dummy/DummyTask.cs
@@ -100,9 +100,9 @@ Logger.Debug ("Setting new task priority");
get { return true; }
}
- public override bool SupportsMultipleNotes
+ public override NoteSupport NoteSupport
{
- get { return true; }
+ get { return NoteSupport.Multiple; }
}
public override TaskState State
diff --git a/src/Addins/Backends/Rtm/RtmTask.cs b/src/Addins/Backends/Rtm/RtmTask.cs
index f050562..850ac8e 100644
--- a/src/Addins/Backends/Rtm/RtmTask.cs
+++ b/src/Addins/Backends/Rtm/RtmTask.cs
@@ -176,9 +176,9 @@ namespace Tasque.Backends.Rtm
/// <value>
/// Returns if the task supports multiple notes
/// </value>
- public override bool SupportsMultipleNotes
+ public override NoteSupport NoteSupport
{
- get { return true; }
+ get { return NoteSupport.Multiple; }
}
/// <value>
diff --git a/src/Addins/Backends/Sqlite/SqliteTask.cs b/src/Addins/Backends/Sqlite/SqliteTask.cs
index 43c2e78..44eea90 100644
--- a/src/Addins/Backends/Sqlite/SqliteTask.cs
+++ b/src/Addins/Backends/Sqlite/SqliteTask.cs
@@ -130,9 +130,9 @@ namespace Tasque.Backends.Sqlite
}
}
- public override bool SupportsMultipleNotes
+ public override NoteSupport NoteSupport
{
- get { return true; }
+ get { return NoteSupport.Multiple; }
}
public override TaskState State
diff --git a/src/Gtk.Tasque/NoteDialog.cs b/src/Gtk.Tasque/NoteDialog.cs
index af10b8e..96ce789 100644
--- a/src/Gtk.Tasque/NoteDialog.cs
+++ b/src/Gtk.Tasque/NoteDialog.cs
@@ -61,7 +61,7 @@ namespace Tasque
VBox.PackStart (sw, true, true, 0);
- if(task.SupportsMultipleNotes) {
+ if(task.NoteSupport == NoteSupport.Multiple) {
addButton = new Gtk.Button(Gtk.Stock.Add);
addButton.Show();
this.ActionArea.PackStart(addButton);
diff --git a/src/libtasque/AbstractTask.cs b/src/libtasque/AbstractTask.cs
index fca91d4..5675fd8 100644
--- a/src/libtasque/AbstractTask.cs
+++ b/src/libtasque/AbstractTask.cs
@@ -51,7 +51,7 @@ namespace Tasque
get;
}
- public abstract bool SupportsMultipleNotes
+ public abstract NoteSupport NoteSupport
{
get;
}
diff --git a/src/libtasque/ITask.cs b/src/libtasque/ITask.cs
index fd2e593..29adb2e 100644
--- a/src/libtasque/ITask.cs
+++ b/src/libtasque/ITask.cs
@@ -72,14 +72,14 @@ namespace Tasque
{
get;
}
-
+
+ /// <summary>
+ /// Gets the type of note support of this task/backend.
+ /// </summary>
/// <value>
- /// Should be true if the task supports having multiple notes.
+ /// The note support.
/// </value>
- bool SupportsMultipleNotes
- {
- get;
- }
+ NoteSupport NoteSupport { get; }
/// <value>
/// The state of the task. Note: sreeves' LOVES source code comments
diff --git a/src/libtasque/NoteSupport.cs b/src/libtasque/NoteSupport.cs
new file mode 100644
index 0000000..fcc5f3b
--- /dev/null
+++ b/src/libtasque/NoteSupport.cs
@@ -0,0 +1,48 @@
+//
+// NoteSupport.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2013 Antonius Riha
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+namespace Tasque
+{
+ /// <summary>
+ /// The note support of a task/backend.
+ /// </summary>
+ public enum NoteSupport
+ {
+ /// <summary>
+ /// Notes are not supported.
+ /// </summary>
+ None,
+
+ /// <summary>
+ /// Single note support.
+ /// </summary>
+ Single,
+
+ /// <summary>
+ /// Multiple note support.
+ /// </summary>
+ Multiple
+ }
+}
diff --git a/src/libtasque/TaskGroupModel.cs b/src/libtasque/TaskGroupModel.cs
index 23eead6..1ab1040 100644
--- a/src/libtasque/TaskGroupModel.cs
+++ b/src/libtasque/TaskGroupModel.cs
@@ -274,7 +274,7 @@ namespace Tasque
IsComplete = originalTask.IsComplete;
Priority = originalTask.Priority;
HasNotes = originalTask.HasNotes;
- SupportsMultipleNotes = originalTask.SupportsMultipleNotes;
+ NoteSupport = originalTask.NoteSupport;
State = originalTask.State;
Category = originalTask.Category;
TimerID = originalTask.TimerID;
@@ -298,7 +298,7 @@ namespace Tasque
public bool HasNotes { get; private set; }
- public bool SupportsMultipleNotes { get; private set; }
+ public NoteSupport NoteSupport { get; private set; }
public TaskState State { get; private set; }
diff --git a/src/libtasque/libtasque.csproj b/src/libtasque/libtasque.csproj
index 1ce5d7f..50fd545 100644
--- a/src/libtasque/libtasque.csproj
+++ b/src/libtasque/libtasque.csproj
@@ -80,6 +80,7 @@
<Compile Include="AllCategory.cs" />
<Compile Include="IPreferences.cs" />
<Compile Include="PreferencesKeys.cs" />
+ <Compile Include="NoteSupport.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="DateFormatters\" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]