/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: 2009-05-04 20:06:58 UTC
  • Revision ID: jelmer@samba.org-20090504200658-n6hsag1soygn3n1o
Use _get_nick(local=True) rather than .nick to get at a branches' nick, since 
the previous might check the nickname of the master branch, which will be slow.

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
 
21
 
 
22
 
 
23
def has_dbus():
 
24
    return (getattr(bzrlib.plugins, "dbus", None) is not None)
 
25
 
 
26
 
 
27
def has_avahi():
 
28
    return (getattr(bzrlib.plugins, "avahi", None) is not None)
 
29
 
20
30
 
21
31
class NotifyPopupMenu(gtk.Menu):
22
32
    def __init__(self):
24
34
        self.create_items()
25
35
 
26
36
    def create_items(self):
 
37
        item = gtk.CheckMenuItem('_Gateway to LAN')
 
38
        item.connect('toggled', self.toggle_lan_gateway)
 
39
        self.append(item)
 
40
        self.append(gtk.SeparatorMenuItem())
27
41
        try:
28
42
            from bzrlib.plugins.dbus.activity import LanGateway
29
43
            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
44
        except ImportError:
35
 
            pass
 
45
            item.set_sensitive(False)
36
46
 
 
47
        item = gtk.CheckMenuItem('Announce _branches on LAN')
 
48
        item.connect('toggled', self.toggle_announce_branches)
 
49
        self.append(item)
 
50
        self.append(gtk.SeparatorMenuItem())
37
51
        try:
38
52
            from bzrlib.plugins.avahi.share import ZeroConfServer
39
53
            from bzrlib import urlutils
40
54
            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
55
        except ImportError:
46
 
            pass
 
56
            item.set_sensitive(False)
47
57
 
48
58
        item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES, None)
49
59
        item.connect('activate', self.show_preferences)
74
84
            self.zeroconfserver.close()
75
85
 
76
86
    def show_about(self, item):
77
 
        from about import AboutDialog
 
87
        from bzrlib.plugins.gtk.about import AboutDialog
78
88
        dialog = AboutDialog()
79
89
        dialog.run()
80
90
 
81
91
    def show_preferences(self, item):
82
 
        from preferences import PreferencesWindow
 
92
        from bzrlib.plugins.gtk.preferences import PreferencesWindow
83
93
        prefs = PreferencesWindow()
84
94
        prefs.run()
85
95