tomboy r2140 - in trunk: . Tomboy



Author: sharm
Date: Mon Sep 15 02:25:42 2008
New Revision: 2140
URL: http://svn.gnome.org/viewvc/tomboy?rev=2140&view=rev

Log:
* Tomboy/Note.cs: Remove hack that saved notes (unnecessarily) whenever
  GetCompleteNoteXml was called.  Fixes bug #543593, patch courtesy
  of the illustrious John Carr.

Modified:
   trunk/ChangeLog
   trunk/Tomboy/Note.cs

Modified: trunk/Tomboy/Note.cs
==============================================================================
--- trunk/Tomboy/Note.cs	(original)
+++ trunk/Tomboy/Note.cs	Mon Sep 15 02:25:42 2008
@@ -784,25 +784,7 @@
 		/// </summary>
 		public string GetCompleteNoteXml ()
 		{
-			if (!File.Exists (filepath))
-				return null;
-
-			// Make sure file contents are up to date
-			save_needed = true; // HACK: Catches newly created notes
-			Save ();
-
-			StreamReader reader = null;
-			try {
-				reader = new StreamReader (filepath);
-				return reader.ReadToEnd ();
-			} catch (Exception e) {
-				Logger.Error ("Error received while attempting to read " +
-				              filepath + ": " + e.Message);
-				return null;
-			} finally {
-				if (reader != null)
-					reader.Close ();
-			}
+			return NoteArchiver.WriteString (data.GetDataSynchronized ());
 		}
 
 		// Reload note data from a complete note XML string
@@ -1243,6 +1225,16 @@
 			return note;
 		}
 
+		public static string WriteString(NoteData note)
+		{
+			StringWriter str = new StringWriter ();
+			XmlTextWriter xml = new XmlTextWriter (str);
+			Instance.Write (xml, note);
+			xml.Close ();
+			str.Flush();
+			return str.ToString ();
+		}
+
 		public static void Write (string write_file, NoteData note)
 		{
 			Instance.WriteFile (write_file, note);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]