protected virtual void OnNotebookSwitchPage(object sender, EventArgs e)
{
try {
var chatView = ChatViewManager.CurrentChatView;
if (chatView == null) {
return;
}
if (!Frontend.IsMacOSX) {
MenuWidget.CloseChatAction.Sensitive = !(chatView is SessionChatView);
}
MenuWidget.FindGroupChatAction.Sensitive = !(chatView is SessionChatView);
if (Frontend.IsLocalEngine) {
var logExists = File.Exists(chatView.ChatModel.LogFile);
MenuWidget.OpenLogAction.Sensitive = logExists;
MenuWidget.OpenLogToolAction.Sensitive = logExists;
}
// find protocol chat parent and update join bar
foreach (var view in ChatViewManager.Chats) {
if (!(view is ProtocolChatView) ||
view.ProtocolManager == null) {
continue;
}
if (chatView.ProtocolManager == view.ProtocolManager) {
var pView = (ProtocolChatView) view;
MenuWidget.JoinWidget.ActiveNetwork = pView.NetworkID;
break;
}
}
// HACK: Gtk.Notebook moves the focus to the child after the
// page has been switched, so move the focus back to the entry
if (!Notebook.IsBrowseModeEnabled) {
GLib.Idle.Add(delegate {
Entry.GrabFocus();
return false;
});
}
} catch (Exception ex) {
Frontend.ShowException(this, ex);
}
}