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

            GLib.Idle.Add(delegate {
                var chatView = (ChatView)CreateChatView(e.ChatModel,
                                                        e.ChatType,
                                                        e.ProtocolManagerType);
                chatView.ID       = e.ChatID;
                chatView.Name     = e.ChatID;
                chatView.Position = e.ChatPosition;
                f_Chats.Add(chatView);

                if (f_Config != null)
                {
                    chatView.ApplyConfig(f_Config);
                }

                // POSSIBLE REMOTING CALL
                int idx = GetSortedChatPosition(chatView);
#if LOG4NET
                f_Logger.Debug("OnChatAdded(): adding " +
                               "<" + chatView.ID + "> at: " + idx);
#endif
                if (idx == -1)
                {
                    f_Notebook.AppendPage(chatView, chatView.LabelWidget);
                }
                else
                {
                    f_Notebook.InsertPage(chatView, chatView.LabelWidget, idx);
                }

                // notify the sync manager that the ChatView is ready to be synced
                SyncManager.ReleaseSync(chatView);

#if GTK_SHARP_2_10
                f_Notebook.SetTabReorderable(chatView, true);
#endif
                chatView.ShowAll();

                if (ChatAdded != null)
                {
                    ChatAdded(this, new ChatViewManagerChatAddedEventArgs(chatView));
                }
                return(false);
            });
        }
Пример #2
0
        void OnChatAdded(object sender, ChatViewAddedEventArgs e)
        {
            Trace.Call(sender, e);

            GLib.Idle.Add(delegate {
                var chatView = (ChatView)CreateChatView(e.ChatModel,
                                                        e.ChatType,
                                                        e.ProtocolManagerType);
                chatView.ID              = e.ChatID;
                chatView.Name            = e.ChatID;
                chatView.Position        = e.ChatPosition;
                chatView.ProtocolManager = e.ProtocolManager;
                f_Chats.Add(chatView);

                if (f_Config != null)
                {
                    chatView.ApplyConfig(f_Config);
                }

                // POSSIBLE REMOTING CALL
                int idx = GetSortedChatPosition(chatView);
#if LOG4NET
                f_Logger.Debug("OnChatAdded(): adding " +
                               "<" + chatView.ID + "> at: " + idx);
#endif
                if (idx == -1)
                {
                    f_Notebook.AppendPage(chatView, chatView.LabelWidget);
                }
                else
                {
                    f_Notebook.InsertPage(chatView, chatView.LabelWidget, idx);
                }
                TreeView.Append(chatView);

                // notify the sync manager that the ChatView is ready to be synced
                SyncManager.ReleaseSync(chatView);

#if GTK_SHARP_2_10
                f_Notebook.SetTabReorderable(chatView, true);
#endif

                // we can't do auto switch for remote engines for now as that
                // kills all unseen highlights, see:
                // https://www.smuxi.org/issues/show/866
                if (Frontend.IsLocalEngine)
                {
                    if ((chatView is PersonChatView && AutoSwitchPersonChats) ||
                        (chatView is GroupChatView && AutoSwitchGroupChats))
                    {
                        CurrentChatNumber = idx;
                    }
                }

                if (ChatAdded != null)
                {
                    ChatAdded(this, new ChatViewManagerChatAddedEventArgs(chatView));
                }
                return(false);
            });
        }