/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to notify.py

  • Committer: Jelmer Vernooij
  • Date: 2010-05-25 17:09:02 UTC
  • mto: This revision was merged to the branch mainline in revision 691.
  • Revision ID: jelmer@samba.org-20100525170902-3to8g5iw7ovw79kh
Split out olive into a separate directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
"""Notification area icon and notification for Bazaar."""
18
18
 
19
 
from gi.repository import Gtk
 
19
try:
 
20
    import pygtk
 
21
    pygtk.require("2.0")
 
22
except:
 
23
    pass
 
24
 
 
25
import gtk
20
26
import bzrlib
21
27
 
22
28
 
28
34
    return (getattr(bzrlib.plugins, "avahi", None) is not None)
29
35
 
30
36
 
31
 
class NotifyPopupMenu(Gtk.Menu):
32
 
 
 
37
class NotifyPopupMenu(gtk.Menu):
33
38
    def __init__(self):
34
39
        super(NotifyPopupMenu, self).__init__()
35
40
        self.create_items()
36
41
 
37
42
    def create_items(self):
38
43
        from bzrlib import errors
39
 
        item = Gtk.CheckMenuItem.new_with_mnemonic('_Gateway to LAN')
 
44
        item = gtk.CheckMenuItem('_Gateway to LAN')
40
45
        item.connect('toggled', self.toggle_lan_gateway)
41
46
        self.append(item)
42
 
        self.append(Gtk.SeparatorMenuItem())
 
47
        self.append(gtk.SeparatorMenuItem())
43
48
        try:
44
49
            from bzrlib.plugins.dbus.activity import LanGateway
45
50
            self.langateway = LanGateway()
50
55
            # process is already running.
51
56
            item.set_sensitive(False)
52
57
 
53
 
        item = Gtk.CheckMenuItem.new_with_mnemonic(
54
 
            'Announce _branches on LAN')
 
58
        item = gtk.CheckMenuItem('Announce _branches on LAN')
55
59
        item.connect('toggled', self.toggle_announce_branches)
56
60
        self.append(item)
57
 
        self.append(Gtk.SeparatorMenuItem())
 
61
        self.append(gtk.SeparatorMenuItem())
58
62
        try:
59
63
            from bzrlib.plugins.avahi.share import ZeroConfServer
60
64
            from bzrlib import urlutils
62
66
        except ImportError:
63
67
            item.set_sensitive(False)
64
68
 
65
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_PREFERENCES, None)
 
69
        item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES, None)
66
70
        item.connect('activate', self.show_preferences)
67
71
        self.append(item)
68
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_ABOUT, None)
 
72
        item = gtk.ImageMenuItem(gtk.STOCK_ABOUT, None)
69
73
        item.connect('activate', self.show_about)
70
74
        self.append(item)
71
 
        self.append(Gtk.SeparatorMenuItem())
72
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_QUIT, None)
73
 
        item.connect('activate', Gtk.main_quit)
 
75
        self.append(gtk.SeparatorMenuItem())
 
76
        item = gtk.ImageMenuItem(gtk.STOCK_QUIT, None)
 
77
        item.connect('activate', gtk.main_quit)
74
78
        self.append(item)
75
79
        self.show_all()
76
80
 
77
81
    def display(self, icon, event_button, event_time):
78
 
        self.popup(None, None, Gtk.status_icon_position_menu, 
 
82
        self.popup(None, None, gtk.status_icon_position_menu, 
79
83
               event_button, event_time, icon)
80
84
 
81
85
    def toggle_lan_gateway(self, item):