~ubuntu-branches/ubuntu/utopic/smuxi/utopic

« back to all changes in this revision

Viewing changes to src/Frontend-GNOME-IRC/IrcPersonChatView.cs

  • Committer: Package Import Robot
  • Author(s): Mirco Bauer
  • Date: 2014-02-16 20:08:23 UTC
  • mfrom: (34.1.4 trusty)
  • Revision ID: package-import@ubuntu.com-20140216200823-tyfr2gem2w3lxepv
Tags: 0.11~rc2-1
* [1fb9a2c] Imported Upstream version 0.11~rc2
* [0d91af1] Dropped remove_wcf_references.patch, already applied upstream
* [97b452a] Refreshed patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Smuxi - Smart MUltipleXed Irc
3
3
 *
4
4
 * Copyright (c) 2008, 2010-2011 Mirco Bauer <meebey@meebey.net>
 
5
 * Copyright (c) 2013 Andrés G. Aragoneses <knocte@gmail.com>
5
6
 *
6
7
 * Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
7
8
 *
21
22
 */
22
23
 
23
24
using System;
 
25
using System.Collections.Generic;
24
26
using System.Threading;
25
 
using System.Globalization;
26
27
using Smuxi.Engine;
27
28
using Smuxi.Common;
28
29
 
50
51
            IrcProtocolManager = (IrcProtocolManager) ProtocolManager;
51
52
        }
52
53
 
 
54
        protected override void OnTabMenuShown(object sender, EventArgs e)
 
55
        {
 
56
            base.OnTabMenuShown(sender, e);
 
57
 
 
58
            var stack = new Stack<Gtk.MenuItem>();
 
59
            foreach (var menu_item in CreateContextMenuItems()) {
 
60
                stack.Push(menu_item);
 
61
            }
 
62
            TabMenu.Prepend(new Gtk.SeparatorMenuItem());
 
63
            while (stack.Count != 0) {
 
64
                TabMenu.Prepend(stack.Pop());
 
65
            }
 
66
            TabMenu.ShowAll();
 
67
        }
 
68
 
53
69
        void OnOutputMessageTextViewPopulatePopup(object o, Gtk.PopulatePopupArgs args)
54
70
        {
55
71
            if (OutputMessageTextView.IsAtUrlTag) {
59
75
            Gtk.Menu popup = args.Menu;
60
76
 
61
77
            popup.Append(new Gtk.SeparatorMenuItem());
62
 
 
 
78
            foreach (var menu_item in CreateContextMenuItems()) {
 
79
                popup.Append(menu_item);
 
80
            }
 
81
 
 
82
            popup.ShowAll();
 
83
        }
 
84
 
 
85
        IEnumerable<Gtk.MenuItem> CreateContextMenuItems()
 
86
        {
63
87
            Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois"));
64
88
            whois_item.Activated += OnMenuWhoisItemActivated;
65
 
            popup.Append(whois_item);
 
89
            yield return whois_item;
66
90
 
67
91
            Gtk.ImageMenuItem ctcp_item = new Gtk.ImageMenuItem(_("CTCP"));
68
92
            Gtk.Menu ctcp_menu_item = new CtcpMenu(IrcProtocolManager,
69
93
                                                   Frontend.MainWindow.ChatViewManager,
70
94
                                                   PersonModel);
71
95
            ctcp_item.Submenu = ctcp_menu_item;
72
 
            popup.Append(ctcp_item);
 
96
            yield return ctcp_item;
73
97
 
74
98
            Gtk.ImageMenuItem invite_to_item = new Gtk.ImageMenuItem(_("Invite to"));
75
99
            Gtk.Menu invite_to_menu_item = new InviteToMenu(IrcProtocolManager,
76
100
                                                            Frontend.MainWindow.ChatViewManager,
77
101
                                                            PersonModel);
78
102
            invite_to_item.Submenu = invite_to_menu_item;
79
 
            popup.Append(invite_to_item);
80
 
 
81
 
            popup.ShowAll();
 
103
            yield return invite_to_item;
82
104
        }
83
105
 
84
106
        void OnMenuWhoisItemActivated(object sender, EventArgs e)