ticket146.patch

David Paleino, 01/03/2009 11:57 AM

Download (4.3 KB)

 
b/src/Frontend-GNOME-IRC/IrcPersonChatView.cs
30 30
using System.Globalization;
31 31
using Smuxi.Engine;
32 32
using Smuxi.Common;
33
using Gtk;
33 34

  
34 35
namespace Smuxi.Frontend.Gnome
35 36
{
36 37
    [ChatViewInfo(ChatType = ChatType.Person, ProtocolManagerType = typeof(IrcProtocolManager))]
37 38
    public class IrcPersonChatView : PersonChatView
38 39
    {
40
        private PersonChatModel    _personChat;
41
        private IrcProtocolManager _IrcProtocolManager;
42

  
39 43
        public IrcPersonChatView(PersonChatModel personChat) : base(personChat)
40 44
        {
41 45
            Trace.Call(personChat);
46
            _personChat = personChat;
47
            _IrcProtocolManager = (IrcProtocolManager)personChat.ProtocolManager;
48
            OutputTextView.PopulatePopup += new PopulatePopupHandler(_OnOutputTextViewPopulatePopup, IntPtr.Zero);
42 49
        }
43 50
        
44 51
        public override void Close()
......
50 57
            // BUG: out of scope?
51 58
            Frontend.Session.RemoveChat(ChatModel);
52 59
        }
60

  
61
        public void _OnOutputTextViewPopulatePopup(object sender, PopulatePopupArgs a)
62
        {
63
            Menu menu = a.Menu;
64

  
65
            ImageMenuItem whois_item = new ImageMenuItem(_("_Whois"));
66
            whois_item.Activated += new EventHandler(_OnContextMenuWhois);
67
            menu.Append(whois_item);
68

  
69
            Gtk.ImageMenuItem ctcp_item = new Gtk.ImageMenuItem(_("_CTCP"));
70
            Gtk.Menu ctcp_submenu = new Menu();
71
            Gtk.ImageMenuItem ctcp_version_item = new Gtk.ImageMenuItem(_("_Version"));
72
            ctcp_version_item.Activated += _OnContextMenuCTCPVersionActivated;
73
            ctcp_submenu.Append(ctcp_version_item);
74

  
75
            Gtk.ImageMenuItem ctcp_ping_item = new Gtk.ImageMenuItem(_("_Ping"));
76
            ctcp_ping_item.Activated += _OnContextMenuCTCPPingActivated;
77
            ctcp_submenu.Append(ctcp_ping_item);
78

  
79
            Gtk.ImageMenuItem ctcp_time_item = new Gtk.ImageMenuItem(_("_Time"));
80
            ctcp_time_item.Activated += _OnContextMenuCTCPTimeActivated;
81
            ctcp_submenu.Append(ctcp_time_item);
82

  
83
            ctcp_item.Submenu = ctcp_submenu;
84
            menu.Append(ctcp_item);
85

  
86
            menu.ShowAll();
87
        }
88

  
89
        private void _OnContextMenuWhois(object sender, EventArgs e)
90
        {
91
            Trace.Call(sender, e);
92

  
93
            _IrcProtocolManager.CommandWhoIs(
94
                new CommandModel(
95
                    Frontend.FrontendManager,
96
                    ChatModel,
97
                    _personChat.Person.ID
98
                )
99
            );
100
        }
101

  
102
        private void _OnContextMenuCTCPVersionActivated(object sender, EventArgs e)
103
        {
104
            Trace.Call(sender, e);
105

  
106
            _IrcProtocolManager.CommandVersion(
107
                new CommandModel(
108
                    Frontend.FrontendManager,
109
                    ChatModel,
110
                    _personChat.Person.ID
111
                )
112
            );
113
        }
114

  
115
        private void _OnContextMenuCTCPPingActivated(object sender, EventArgs e)
116
        {
117
            Trace.Call(sender, e);
118

  
119
            _IrcProtocolManager.CommandPing(
120
                new CommandModel(
121
                    Frontend.FrontendManager,
122
                    ChatModel,
123
                    _personChat.Person.ID
124
                )
125
            );
126
        }
127

  
128
        private void _OnContextMenuCTCPTimeActivated(object sender, EventArgs e)
129
        {
130
            Trace.Call(sender, e);
131

  
132
            _IrcProtocolManager.CommandTime(
133
                new CommandModel(
134
                    Frontend.FrontendManager,
135
                    ChatModel,
136
                    _personChat.Person.ID
137
                )
138
            );
139
        }
53 140
    }
54 141
}
b/src/Frontend-GNOME/Chats/ChatView.cs
765 765
            Close();
766 766
        }
767 767
        
768
        private static string _(string msg)
768
        public static string _(string msg)
769 769
        {
770 770
            return Mono.Unix.Catalog.GetString(msg);
771 771
        }