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)
21
37
class NotifyPopupMenu(gtk.Menu):
22
38
def __init__(self):
24
40
self.create_items()
26
42
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())
28
49
from bzrlib.plugins.dbus.activity import LanGateway
29
50
self.langateway = LanGateway()
30
item = gtk.CheckMenuItem('_Gateway to LAN')
31
item.connect('toggled', self.toggle_lan_gateway)
33
self.append(gtk.SeparatorMenuItem())
34
51
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())
38
63
from bzrlib.plugins.avahi.share import ZeroConfServer
39
64
from bzrlib import urlutils
40
65
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())
45
66
except ImportError:
67
item.set_sensitive(False)
48
69
item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES, None)
49
70
item.connect('activate', self.show_preferences)