Пример #1
0
        protected void OnChatViewManagerChatAdded(object sender, ChatViewManagerChatAddedEventArgs e)
        {
            Trace.Call(sender, e);

            e.ChatView.MessageHighlighted += OnChatViewMessageHighlighted;
            e.ChatView.StatusChanged      += (o, args) => {
                ChatTreeView.Render(e.ChatView);
            };
            e.ChatView.OutputMessageTextView.FocusInEvent += delegate {
                if (CaretMode)
                {
                    return;
                }
                Entry.GrabFocus();
            };
            if (e.ChatView is GroupChatView)
            {
                var groupChatView = (GroupChatView)e.ChatView;
                groupChatView.ParticipantsChanged += (o, args) => {
                    if (ChatViewManager.CurrentChatView != groupChatView)
                    {
                        return;
                    }
                    UpdateTitle(groupChatView, null);
                };
                groupChatView.OutputHPaned.Position = (WindowWidth / 7) * 5;
            }
            UpdateProgressBar();
        }
Пример #2
0
        protected virtual void OnFocusInEvent(object sender, EventArgs e)
        {
            Trace.Call(sender, e);

            try {
                UrgencyHint = false;

                // HACK: users sometimes click into the person list by accident
                // when they try to bring the focus back to the Smuxi window.
                // We try to be nice and do what they probably meant and move
                // the focus to the input entry instead.
                // HACK: we have to use a timeout here as the ButtonPressEvent
                // is directly raised _after_ the FocusInEvent. The idle loop
                // turned out to be too racy and works only sometimes.
                GLib.Timeout.Add(10, delegate {
                    Entry.GrabFocus();
                    return(false);
                });

                if (Notebook.IsBrowseModeEnabled)
                {
                    return;
                }

                var chatView = ChatViewManager.CurrentChatView;
                if (chatView != null)
                {
                    // clear activity and highlight
                    chatView.HasHighlight = false;
                    chatView.HasActivity  = false;
                    chatView.HasEvent     = false;
                    var lastMsg = chatView.OutputMessageTextView.LastMessage;
                    if (lastMsg == null || Frontend.UseLowBandwidthMode)
                    {
                        return;
                    }
                    // update last seen highlight
                    ThreadPool.QueueUserWorkItem(delegate {
                        try {
                            // REMOTING CALL 1
                            chatView.ChatModel.LastSeenHighlight = lastMsg.TimeStamp;
                        } catch (Exception ex) {
#if LOG4NET
                            f_Logger.Error("OnFocusInEvent(): Exception", ex);
#endif
                        }
                    });
                }
            } catch (Exception ex) {
                Frontend.ShowException(this, ex);
            }
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
        protected void OnChatViewManagerChatAdded(object sender, ChatViewManagerChatAddedEventArgs e)
        {
            Trace.Call(sender, e);

            e.ChatView.MessageHighlighted += OnChatViewMessageHighlighted;
            e.ChatView.StatusChanged      += (o, args) => {
                ChatTreeView.Render(e.ChatView);
            };
            e.ChatView.OutputMessageTextView.FocusInEvent += delegate {
                if (CaretMode)
                {
                    return;
                }
                Entry.GrabFocus();
            };
            UpdateProgressBar();
        }
Пример #5
0
 protected virtual void OnNotebookFocusInEvent(object sender, Gtk.FocusInEventArgs e)
 {
     // HACK: having the focus in the notebook doesn't make any sense,
     // so move focus back to the entry
     Entry.GrabFocus();
 }