/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: Jasper Groenewegen
  • Author(s): Didier Roche
  • Date: 2008-08-06 14:25:18 UTC
  • mto: This revision was merged to the branch mainline in revision 598.
  • Revision ID: colbrac@xs4all.nl-20080806142518-q0nl17asx0om341z
Change Olive desktop file details

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
"""Notification area icon and notification for Bazaar."""
18
18
 
19
 
try:
20
 
    import pygtk
21
 
    pygtk.require("2.0")
22
 
except:
23
 
    pass
24
 
 
25
19
import gtk
26
 
import bzrlib
27
 
 
28
 
 
29
 
def has_dbus():
30
 
    return (getattr(bzrlib.plugins, "dbus", None) is not None)
31
 
 
32
 
 
33
 
def has_avahi():
34
 
    return (getattr(bzrlib.plugins, "avahi", None) is not None)
35
 
 
36
20
 
37
21
class NotifyPopupMenu(gtk.Menu):
38
22
    def __init__(self):
40
24
        self.create_items()
41
25
 
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)
46
 
        self.append(item)
47
 
        self.append(gtk.SeparatorMenuItem())
48
27
        try:
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)
 
32
            self.append(item)
 
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)
 
35
            pass
57
36
 
58
 
        item = gtk.CheckMenuItem('Announce _branches on LAN')
59
 
        item.connect('toggled', self.toggle_announce_branches)
60
 
        self.append(item)
61
 
        self.append(gtk.SeparatorMenuItem())
62
37
        try:
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)
 
43
            self.append(item)
 
44
            self.append(gtk.SeparatorMenuItem())
66
45
        except ImportError:
67
 
            item.set_sensitive(False)
 
46
            pass
68
47
 
69
48
        item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES, None)
70
49
        item.connect('activate', self.show_preferences)