16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
17
"""Notification area icon and notification for Bazaar."""
30
return (getattr(bzrlib.plugins, "dbus", None) is not None)
34
return (getattr(bzrlib.plugins, "avahi", None) is not None)
37
21
class NotifyPopupMenu(gtk.Menu):
38
22
def __init__(self):
40
24
self.create_items()
42
26
def create_items(self):
43
from bzrlib import errors
44
item = gtk.CheckMenuItem('_Gateway to LAN')
45
item.connect('toggled', self.toggle_lan_gateway)
47
self.append(gtk.SeparatorMenuItem())
49
28
from bzrlib.plugins.dbus.activity import LanGateway
50
29
self.langateway = LanGateway()
30
item = gtk.CheckMenuItem('_Gateway to LAN')
31
item.connect('toggled', self.toggle_lan_gateway)
33
self.append(gtk.SeparatorMenuItem())
51
34
except ImportError:
52
item.set_sensitive(False)
53
except errors.BzrError:
54
# FIXME: Should only catch errors that indicate a lan-notify
55
# process is already running.
56
item.set_sensitive(False)
58
item = gtk.CheckMenuItem('Announce _branches on LAN')
59
item.connect('toggled', self.toggle_announce_branches)
61
self.append(gtk.SeparatorMenuItem())
63
38
from bzrlib.plugins.avahi.share import ZeroConfServer
64
39
from bzrlib import urlutils
65
40
self.zeroconfserver = ZeroConfServer(urlutils.normalize_url('.'))
41
item = gtk.CheckMenuItem('Announce _branches on LAN')
42
item.connect('toggled', self.toggle_announce_branches)
44
self.append(gtk.SeparatorMenuItem())
66
45
except ImportError:
67
item.set_sensitive(False)
69
48
item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES, None)
70
49
item.connect('activate', self.show_preferences)