/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: 2012-03-29 13:15:14 UTC
  • mfrom: (786.1.1 register-lazy)
  • Revision ID: jelmer@samba.org-20120329131514-knrl1w2wzntx89rv
Use lazy registration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
class NotifyPopupMenu(Gtk.Menu):
32
32
 
 
33
    SHOW_WIDGETS = True
 
34
 
33
35
    def __init__(self):
34
36
        super(NotifyPopupMenu, self).__init__()
35
37
        self.create_items()
36
38
 
37
39
    def create_items(self):
38
40
        from bzrlib import errors
39
 
        item = Gtk.CheckMenuItem('_Gateway to LAN')
 
41
        item = Gtk.CheckMenuItem.new_with_mnemonic('_Gateway to LAN')
40
42
        item.connect('toggled', self.toggle_lan_gateway)
41
43
        self.append(item)
42
44
        self.append(Gtk.SeparatorMenuItem())
46
48
        except ImportError:
47
49
            item.set_sensitive(False)
48
50
        except errors.BzrError:
49
 
            # FIXME: Should only catch errors that indicate a lan-notify 
 
51
            # FIXME: Should only catch errors that indicate a lan-notify
50
52
            # process is already running.
51
53
            item.set_sensitive(False)
52
54
 
53
 
        item = Gtk.CheckMenuItem('Announce _branches on LAN')
 
55
        item = Gtk.CheckMenuItem.new_with_mnemonic(
 
56
            'Announce _branches on LAN')
54
57
        item.connect('toggled', self.toggle_announce_branches)
55
58
        self.append(item)
56
59
        self.append(Gtk.SeparatorMenuItem())
61
64
        except ImportError:
62
65
            item.set_sensitive(False)
63
66
 
64
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_PREFERENCES, None)
 
67
        item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES, None)
65
68
        item.connect('activate', self.show_preferences)
66
69
        self.append(item)
67
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_ABOUT, None)
 
70
        item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
68
71
        item.connect('activate', self.show_about)
69
72
        self.append(item)
70
73
        self.append(Gtk.SeparatorMenuItem())
71
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_QUIT, None)
 
74
        item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
72
75
        item.connect('activate', Gtk.main_quit)
73
76
        self.append(item)
74
 
        self.show_all()
 
77
        if self.SHOW_WIDGETS:
 
78
            self.show_all()
75
79
 
76
80
    def display(self, icon, event_button, event_time):
77
 
        self.popup(None, None, Gtk.status_icon_position_menu, 
 
81
        self.popup(None, None, Gtk.status_icon_position_menu,
78
82
               event_button, event_time, icon)
79
83
 
80
84
    def toggle_lan_gateway(self, item):
98
102
        from bzrlib.plugins.gtk.preferences import PreferencesWindow
99
103
        prefs = PreferencesWindow()
100
104
        prefs.run()
101