[tomboy/xdg-migration: 2/4] In LoadForeignNoteXml, only add/remove tags when necessary to prevent excess notifications.
- From: Sanford Armstrong <sharm src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tomboy/xdg-migration: 2/4] In LoadForeignNoteXml, only add/remove tags when necessary to prevent excess notifications.
- Date: Mon, 24 Aug 2009 01:59:49 +0000 (UTC)
commit 43687026745c514804f36d1181d9d028c57e9be2
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date: Sat May 2 19:24:15 2009 -0700
In LoadForeignNoteXml, only add/remove tags when necessary to prevent excess notifications.
Tomboy/Note.cs | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/Tomboy/Note.cs b/Tomboy/Note.cs
index 0ab1586..8ae6caf 100644
--- a/Tomboy/Note.cs
+++ b/Tomboy/Note.cs
@@ -808,8 +808,7 @@ namespace Tomboy
// Remove tags now, since a note with no tags has
// no "tags" element in the XML
- foreach (Tag tag in Tags)
- RemoveTag (tag);
+ List<Tag> newTags = new List<Tag> ();
while (xml.Read ()) {
switch (xml.NodeType) {
@@ -838,7 +837,7 @@ namespace Tomboy
List<string> tag_strings = ParseTags (doc.ReadNode (xml.ReadSubtree ()));
foreach (string tag_str in tag_strings) {
Tag tag = TagManager.GetOrCreateTag (tag_str);
- AddTag (tag);
+ newTags.Add (tag);
}
break;
case "open-on-startup":
@@ -851,6 +850,12 @@ namespace Tomboy
xml.Close ();
+ foreach (Tag oldTag in Tags)
+ if (!newTags.Contains (oldTag))
+ RemoveTag (oldTag);
+ foreach (Tag newTag in newTags)
+ AddTag (newTag);
+
// Allow method caller to specify ChangeType (mostly needed by sync)
QueueSave (changeType);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]