private void OnNotebookSelectionChanged (object sender, EventArgs args)
{
RestoreMatchesWindow ();
Notebooks.Notebook notebook = GetSelectedNotebook ();
if (notebook == null) {
// Clear out the currently selected tags so that no notebook is selected
selected_tags.Clear ();
// Select the "All Notes" item without causing
// this handler to be called again
notebooksTree.Selection.Changed -= OnNotebookSelectionChanged;
SelectAllNotesNotebook ();
Tomboy.ActionManager ["DeleteNotebookAction"].Sensitive = false;
notebooksTree.Selection.Changed += OnNotebookSelectionChanged;
} else {
selected_tags.Clear ();
if (notebook.Tag != null)
selected_tags.Add (notebook.Tag, notebook.Tag);
if (notebook is Notebooks.SpecialNotebook) {
Tomboy.ActionManager ["DeleteNotebookAction"].Sensitive = false;
} else {
Tomboy.ActionManager ["DeleteNotebookAction"].Sensitive = true;
}
}
UpdateResults ();
}