/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: 2008-10-28 16:02:01 UTC
  • Revision ID: jelmer@samba.org-20081028160201-5t1bznxbbgoqj5or
Add notifications tab in preferences dialog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Notification area icon and notification for Bazaar."""
18
18
 
19
19
import gtk
 
20
import bzrlib.plugins.dbus
 
21
 
 
22
def has_dbus():
 
23
    return (getattr(bzrlib.plugins, "dbus", None) is not None)
 
24
 
 
25
def has_avahi():
 
26
    return (getattr(bzrlib.plugins, "avahi", None) is not None)
20
27
 
21
28
class NotifyPopupMenu(gtk.Menu):
22
29
    def __init__(self):
24
31
        self.create_items()
25
32
 
26
33
    def create_items(self):
 
34
        item = gtk.CheckMenuItem('_Gateway to LAN')
 
35
        item.connect('toggled', self.toggle_lan_gateway)
 
36
        self.append(item)
 
37
        self.append(gtk.SeparatorMenuItem())
27
38
        try:
28
39
            from bzrlib.plugins.dbus.activity import LanGateway
29
40
            self.langateway = LanGateway()
30
 
            item = gtk.CheckMenuItem('_Gateway to LAN')
31
 
            item.connect('toggled', self.toggle_lan_gateway)
32
 
            self.append(item)
33
 
            self.append(gtk.SeparatorMenuItem())
34
41
        except ImportError:
35
 
            pass
 
42
            item.set_sensitive(False)
36
43
 
 
44
        item = gtk.CheckMenuItem('Announce _branches on LAN')
 
45
        item.connect('toggled', self.toggle_announce_branches)
 
46
        self.append(item)
 
47
        self.append(gtk.SeparatorMenuItem())
37
48
        try:
38
49
            from bzrlib.plugins.avahi.share import ZeroConfServer
39
50
            from bzrlib import urlutils
40
51
            self.zeroconfserver = ZeroConfServer(urlutils.normalize_url('.'))
41
 
            item = gtk.CheckMenuItem('Announce _branches on LAN')
42
 
            item.connect('toggled', self.toggle_announce_branches)
43
 
            self.append(item)
44
 
            self.append(gtk.SeparatorMenuItem())
45
52
        except ImportError:
46
 
            pass
 
53
            item.set_sensitive(False)
47
54
 
48
55
        item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES, None)
49
56
        item.connect('activate', self.show_preferences)