? exportAll.patch
Index: Plugins/ExportToHTML.cs
===================================================================
RCS file: /cvs/gnome/tomboy/Tomboy/Plugins/ExportToHTML.cs,v
retrieving revision 1.21
diff -u -p -r1.21 ExportToHTML.cs
--- Plugins/ExportToHTML.cs	20 Sep 2006 19:05:46 -0000	1.21
+++ Plugins/ExportToHTML.cs	21 Oct 2006 03:07:14 -0000
@@ -15,6 +15,7 @@ public class ExportToHTMLPlugin : NotePl
 {
 	const string stylesheet_name = "ExportToHTML.xsl";
 	static XslTransform xsl;
+	static ArrayList written = null;
 
 	static ExportToHTMLPlugin ()
 	{
@@ -75,6 +76,7 @@ public class ExportToHTMLPlugin : NotePl
 		Logger.Log ("Exporting Note '{0}' to '{1}'...", Note.Title, output_path);
 
 		StreamWriter writer = null;
+		written = new ArrayList();
 		string error_message = null;
 
 		try {
@@ -85,7 +87,10 @@ public class ExportToHTMLPlugin : NotePl
 			}
 
 			writer = new StreamWriter (output_path);
-			WriteHTMLForNote (writer, Note, dialog.ExportLinked);
+			if (dialog.ExportAll == true)
+				WriteHTMLForNotes(writer, Note.Manager.Notes);
+			else
+				WriteHTMLForNote (writer, Note, dialog.ExportLinked);
 			
 			// Save the dialog preferences now that the note has
 			// successfully been exported
@@ -154,6 +159,14 @@ public class ExportToHTMLPlugin : NotePl
 			dialog.Destroy ();
 	}
 
+	public void WriteHTMLForNotes(TextWriter writer, ArrayList notes) {
+		foreach (Note n in notes) 
+		{
+			if (!written.Contains (n))
+				WriteHTMLForNote (writer, n, false);
+		}
+	}
+
 	public void WriteHTMLForNote (TextWriter writer, 
 			       Note note,
 			       bool export_linked) 
@@ -163,6 +176,7 @@ public class ExportToHTMLPlugin : NotePl
 		// XPathDocument is faster.
 		StringWriter s_writer = new StringWriter ();
 		NoteArchiver.Write (s_writer, note.Data);
+		written.Add (note);
 		StringReader reader = new StringReader (s_writer.ToString ());
 		s_writer.Close ();
 		XPathDocument doc = new XPathDocument (reader);
@@ -256,6 +270,8 @@ class NoteNameResolver : XmlResolver
 class ExportToHTMLDialog : Gtk.FileChooserDialog
 {
 	Gtk.CheckButton export_linked;
+	Gtk.CheckButton export_all;
+	Gtk.HButtonBox box;
 
 	public ExportToHTMLDialog (string default_file) : 
 		base (Catalog.GetString ("Destination for HTML Export"),
@@ -267,7 +283,12 @@ class ExportToHTMLDialog : Gtk.FileChoos
 		DefaultResponse = Gtk.ResponseType.Ok;
 		
 		export_linked = new Gtk.CheckButton (Catalog.GetString ("Export linked notes"));
-		ExtraWidget = export_linked;
+		export_all = new Gtk.CheckButton (Catalog.GetString ("Export all notes"));
+		
+		box = new Gtk.HButtonBox();
+		box.Add (export_linked);
+		box.Add (export_all);
+		ExtraWidget = box;
 		
 		DoOverwriteConfirmation = true;
 		LocalOnly = true;
@@ -280,6 +301,12 @@ class ExportToHTMLDialog : Gtk.FileChoos
 	{
 		get { return export_linked.Active; }
 		set { export_linked.Active = value; }
+	}
+
+	public bool ExportAll
+	{
+		get { return export_all.Active; }
+		set { export_all.Active = value; }
 	}
 	
 	public void SavePreferences () 
