/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: 2011-02-18 13:01:03 UTC
  • Revision ID: jelmer@samba.org-20110218130103-fiyk203auk28thpn
Remove some unused imports, fix some formatting.

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
 
from gi.repository import Gtk
 
19
try:
 
20
    import pygtk
 
21
    pygtk.require("2.0")
 
22
except:
 
23
    pass
 
24
 
 
25
import gtk
20
26
import bzrlib
21
27
 
22
28
 
28
34
    return (getattr(bzrlib.plugins, "avahi", None) is not None)
29
35
 
30
36
 
31
 
class NotifyPopupMenu(Gtk.Menu):
 
37
class NotifyPopupMenu(gtk.Menu):
32
38
 
33
39
    def __init__(self):
34
40
        super(NotifyPopupMenu, self).__init__()
36
42
 
37
43
    def create_items(self):
38
44
        from bzrlib import errors
39
 
        item = Gtk.CheckMenuItem.new_with_mnemonic('_Gateway to LAN')
 
45
        item = gtk.CheckMenuItem('_Gateway to LAN')
40
46
        item.connect('toggled', self.toggle_lan_gateway)
41
47
        self.append(item)
42
 
        self.append(Gtk.SeparatorMenuItem())
 
48
        self.append(gtk.SeparatorMenuItem())
43
49
        try:
44
50
            from bzrlib.plugins.dbus.activity import LanGateway
45
51
            self.langateway = LanGateway()
50
56
            # process is already running.
51
57
            item.set_sensitive(False)
52
58
 
53
 
        item = Gtk.CheckMenuItem.new_with_mnemonic(
54
 
            'Announce _branches on LAN')
 
59
        item = gtk.CheckMenuItem('Announce _branches on LAN')
55
60
        item.connect('toggled', self.toggle_announce_branches)
56
61
        self.append(item)
57
 
        self.append(Gtk.SeparatorMenuItem())
 
62
        self.append(gtk.SeparatorMenuItem())
58
63
        try:
59
64
            from bzrlib.plugins.avahi.share import ZeroConfServer
60
65
            from bzrlib import urlutils
62
67
        except ImportError:
63
68
            item.set_sensitive(False)
64
69
 
65
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_PREFERENCES, None)
 
70
        item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES, None)
66
71
        item.connect('activate', self.show_preferences)
67
72
        self.append(item)
68
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_ABOUT, None)
 
73
        item = gtk.ImageMenuItem(gtk.STOCK_ABOUT, None)
69
74
        item.connect('activate', self.show_about)
70
75
        self.append(item)
71
 
        self.append(Gtk.SeparatorMenuItem())
72
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_QUIT, None)
73
 
        item.connect('activate', Gtk.main_quit)
 
76
        self.append(gtk.SeparatorMenuItem())
 
77
        item = gtk.ImageMenuItem(gtk.STOCK_QUIT, None)
 
78
        item.connect('activate', gtk.main_quit)
74
79
        self.append(item)
75
80
        self.show_all()
76
81
 
77
82
    def display(self, icon, event_button, event_time):
78
 
        self.popup(None, None, Gtk.status_icon_position_menu, 
 
83
        self.popup(None, None, gtk.status_icon_position_menu, 
79
84
               event_button, event_time, icon)
80
85
 
81
86
    def toggle_lan_gateway(self, item):