[tomboy/autosync: 12/15] Add NoteManager.ReadOnly, use it in NotD add-in and RemoteControl
- From: Sanford Armstrong <sharm src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tomboy/autosync: 12/15] Add NoteManager.ReadOnly, use it in NotD add-in and RemoteControl
- Date: Mon, 8 Feb 2010 08:52:31 +0000 (UTC)
commit c12663432eee6f4b4f150b55acf0f2caada40a39
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date: Mon Feb 8 00:47:08 2010 -0800
Add NoteManager.ReadOnly, use it in NotD add-in and RemoteControl
.../NoteOfTheDay/NoteOfTheDayApplicationAddin.cs | 2 +-
Tomboy/NoteManager.cs | 5 +++++
Tomboy/RemoteControl.cs | 18 ++++++++++++++++++
3 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/Tomboy/Addins/NoteOfTheDay/NoteOfTheDayApplicationAddin.cs b/Tomboy/Addins/NoteOfTheDay/NoteOfTheDayApplicationAddin.cs
index 5858de0..783feae 100644
--- a/Tomboy/Addins/NoteOfTheDay/NoteOfTheDayApplicationAddin.cs
+++ b/Tomboy/Addins/NoteOfTheDay/NoteOfTheDayApplicationAddin.cs
@@ -19,7 +19,7 @@ namespace Tomboy.NoteOfTheDay
void CheckNewDay (object sender, EventArgs args)
{
Note notd = NoteOfTheDay.GetNoteByDate (manager, DateTime.Today);
- if (notd == null) {
+ if (notd == null && !manager.ReadOnly) {
NoteOfTheDay.CleanupOld (manager);
// Create a new NotD if the day has changed
diff --git a/Tomboy/NoteManager.cs b/Tomboy/NoteManager.cs
index c2850ea..d6b1374 100644
--- a/Tomboy/NoteManager.cs
+++ b/Tomboy/NoteManager.cs
@@ -48,6 +48,11 @@ namespace Tomboy
get; private set;
}
+ // TODO: Decide if/how to enforce
+ public bool ReadOnly {
+ get; set;
+ }
+
/// <summary>
/// Use Gtk.Application.Invoke to invoke the Action delegate
/// once this NoteManager is initialized. If this NoteManager
diff --git a/Tomboy/RemoteControl.cs b/Tomboy/RemoteControl.cs
index d5e60cd..fb4c236 100644
--- a/Tomboy/RemoteControl.cs
+++ b/Tomboy/RemoteControl.cs
@@ -98,6 +98,8 @@ namespace Tomboy
public string CreateNote ()
{
+ if (note_manager.ReadOnly)
+ return string.Empty;
try {
Note note = note_manager.Create ();
note.QueueSave (ChangeType.ContentChanged);
@@ -109,6 +111,8 @@ namespace Tomboy
public string CreateNamedNote (string linked_title)
{
+ if (note_manager.ReadOnly)
+ return string.Empty;
Note note;
note = note_manager.Find (linked_title);
@@ -126,6 +130,8 @@ namespace Tomboy
public string CreateNamedNoteWithUri (string linked_title, string uri)
{
+ if (note_manager.ReadOnly)
+ return string.Empty;
Note note;
string guid;
try {
@@ -156,6 +162,8 @@ namespace Tomboy
public bool DeleteNote (string uri)
{
+ if (note_manager.ReadOnly)
+ return false;
Note note;
note = note_manager.FindByUri (uri);
@@ -253,6 +261,8 @@ namespace Tomboy
public bool SetNoteContents (string uri, string text_contents)
{
+ if (note_manager.ReadOnly)
+ return false;
Note note;
note = note_manager.FindByUri (uri);
if (note == null)
@@ -263,6 +273,8 @@ namespace Tomboy
public bool SetNoteContentsXml (string uri, string xml_contents)
{
+ if (note_manager.ReadOnly)
+ return false;
Note note;
note = note_manager.FindByUri (uri);
if (note == null)
@@ -277,6 +289,8 @@ namespace Tomboy
/// </summary>
public bool SetNoteCompleteXml (string uri, string xml_contents)
{
+ if (note_manager.ReadOnly)
+ return false;
Note note;
note = note_manager.FindByUri (uri);
if (note == null)
@@ -298,6 +312,8 @@ namespace Tomboy
public bool AddTagToNote (string uri, string tag_name)
{
+ if (note_manager.ReadOnly)
+ return false;
Note note = note_manager.FindByUri (uri);
if (note == null)
return false;
@@ -343,6 +359,8 @@ namespace Tomboy
public bool AddNoteToNotebook (string uri, string notebook_name)
{
+ if (note_manager.ReadOnly)
+ return false;
Note note = note_manager.FindByUri (uri);
if (note == null)
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]