void OnNotebooksKeyPressed (object sender, Gtk.KeyPressEventArgs args)
{
switch (args.Event.Key) {
case Gdk.Key.Escape:
// Allow Escape to close the window
OnCloseWindow (this, EventArgs.Empty);
break;
case Gdk.Key.Menu:
// Pop up the context menu if a notebook is selected
Notebooks.Notebook notebook = GetSelectedNotebook ();
if (notebook == null || notebook is Notebooks.SpecialNotebook)
return; // Don't pop open a submenu
Gtk.Menu menu = Tomboy.ActionManager.GetWidget (
"/NotebooksTreeContextMenu") as Gtk.Menu;
PopupContextMenuAtLocation (menu, 0, 0);
break;
}
}