private void OnNewNotebookNote (object sender, EventArgs args)
{
Notebooks.Notebook notebook = GetSelectedNotebook ();
if (notebook == null || notebook is Notebooks.SpecialNotebook) {
// Just create a standard note (not in a notebook)
Tomboy.ActionManager ["NewNoteAction"].Activate ();
return;
}
// Look for the template note and create a new note
Note templateNote = notebook.GetTemplateNote ();
Note note;
note = manager.Create ();
if (templateNote != null) {
// Use the body from the template note
string xmlContent = templateNote.XmlContent.Replace (XmlEncoder.Encode (templateNote.Title),
XmlEncoder.Encode (note.Title));
xmlContent = NoteManager.SanitizeXmlContent (xmlContent);
note.XmlContent = xmlContent;
}
note.AddTag (notebook.Tag);
note.Window.Show ();
}