Example #1
0
        public IrcGroupChatView(GroupChatModel groupChat) : base(groupChat)
        {
            Trace.Call(groupChat);

            if (PersonTreeView != null)
            {
                Gtk.CellRendererText cellr = new Gtk.CellRendererText();
                // HACK: for some reason GTK is giving the space of 2 chars which
                // we workaround using a char width of 0
                cellr.WidthChars = 0;
                Gtk.TreeViewColumn column = new Gtk.TreeViewColumn(String.Empty, cellr);
                column.Spacing       = 0;
                column.SortIndicator = false;
                column.Sizing        = Gtk.TreeViewColumnSizing.GrowOnly;
                column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(RenderIrcGroupPersonMode));

                PersonTreeView.AppendColumn(column);
                PersonTreeView.MoveColumnAfter(IdentityNameColumn, column);
            }
        }
Example #2
0
        protected override void OnPersonMenuShown(object sender, EventArgs e)
        {
            Trace.Call(sender, e);

            foreach (var child in PersonMenu.Children)
            {
                PersonMenu.Remove(child);
            }

            base.OnPersonMenuShown(sender, e);

            // minimum version of any command below
            if (Frontend.EngineProtocolVersion < new Version(0, 8, 9))
            {
                return;
            }

            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 9))
            {
                Gtk.ImageMenuItem query_item = new Gtk.ImageMenuItem(_("Query"));
                query_item.Activated += _OnUserListMenuQueryActivated;
                PersonMenu.Append(query_item);
            }

            PersonMenu.Append(new Gtk.SeparatorMenuItem());

            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12))
            {
                Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois"));
                whois_item.Activated += _OnUserListMenuWhoisActivated;
                PersonMenu.Append(whois_item);
            }

            if (!IsContactList && Frontend.EngineProtocolVersion >= new Version(0, 8, 11))
            {
                var add_to_contacts_item = new Gtk.ImageMenuItem(_("Add To Contacts"));
                add_to_contacts_item.Activated += _OnMenuAddToContactsItemActivated;
                PersonMenu.Append(add_to_contacts_item);
            }

            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12))
            {
                Gtk.MenuItem invite_to_item      = new Gtk.MenuItem(_("Invite to"));
                Gtk.Menu     invite_to_menu_item = new InviteToMenu(
                    XmppProtocolManager,
                    Frontend.MainWindow.ChatViewManager,
                    GetSelectedPersons()
                    );
                invite_to_item.Submenu = invite_to_menu_item;
                PersonMenu.Append(invite_to_item);
            }

            if (IsContactList && Frontend.EngineProtocolVersion >= new Version(0, 8, 11))
            {
                // cleanup old handlers
                IdentityNameCellRenderer.EditingStarted -= OnPersonRenameEditingStarted;
                IdentityNameCellRenderer.Edited         -= OnPersonRenameEdited;

                IdentityNameCellRenderer.EditingStarted += OnPersonRenameEditingStarted;
                IdentityNameCellRenderer.Edited         += OnPersonRenameEdited;

                var rename_item = new Gtk.ImageMenuItem(_("Rename"));
                rename_item.Activated += (o, args) => {
                    var paths = PersonTreeView.Selection.GetSelectedRows();
                    if (paths == null || paths.Length == 0)
                    {
                        return;
                    }
                    var path = paths[0];
                    IdentityNameCellRenderer.Editable = true;
                    PersonTreeView.SetCursor(path, IdentityNameColumn, true);
                };
                PersonMenu.Append(rename_item);

                Gtk.ImageMenuItem remove_item = new Gtk.ImageMenuItem(_("Remove"));
                remove_item.Activated += OnUserListMenuRemoveActivated;
                PersonMenu.Append(remove_item);
            }

            PersonMenu.ShowAll();
        }