public static NoteRecentChanges GetInstance (NoteManager manager) { if (instance == null) instance = new NoteRecentChanges (manager); System.Diagnostics.Debug.Assert ( instance.manager == manager, "Multiple NoteManagers not supported"); return instance; }
void OnCloseWindow (object sender, EventArgs args) { // Disconnect external signal handlers to prevent bloweup manager.NoteDeleted -= OnNotesChanged; manager.NoteAdded -= OnNotesChanged; manager.NoteRenamed -= OnNoteRenamed; manager.NoteSaved -= OnNoteSaved; Notebooks.NotebookManager.NoteAddedToNotebook -= OnNoteAddedToNotebook; Notebooks.NotebookManager.NoteRemovedFromNotebook -= OnNoteRemovedFromNotebook; // The following code has to be done for the MenuBar to // appear properly the next time this window is opened. if (menu_bar != null) { content_vbox.Remove (menu_bar); ActionManager am = Tomboy.ActionManager; am ["OpenNoteAction"].Activated -= OnOpenNote; am ["DeleteNoteAction"].Activated -= OnDeleteNote; am ["NewNotebookAction"].Activated -= OnNewNotebook; am ["DeleteNotebookAction"].Activated -= OnDeleteNotebook; am ["NewNotebookNoteAction"].Activated -= OnNewNotebookNote; am ["OpenNotebookTemplateNoteAction"].Activated -= OnOpenNotebookTemplateNote; am ["CloseWindowAction"].Activated -= OnCloseWindow; } SavePosition (); Tomboy.ExitingEvent -= OnExitingEvent; Hide (); Destroy (); instance = null; #if !MAC if (Tomboy.TrayIconShowing == false && (bool) Preferences.Get (Preferences.ENABLE_TRAY_ICON)) Tomboy.ActionManager ["QuitTomboyAction"].Activate (); #endif }