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