/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()
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
 
62
64
        except ImportError:
63
65
            item.set_sensitive(False)
64
66
 
65
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_PREFERENCES, None)
 
67
        item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES, None)
66
68
        item.connect('activate', self.show_preferences)
67
69
        self.append(item)
68
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_ABOUT, None)
 
70
        item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
69
71
        item.connect('activate', self.show_about)
70
72
        self.append(item)
71
73
        self.append(Gtk.SeparatorMenuItem())
72
 
        item = Gtk.ImageMenuItem(Gtk.STOCK_QUIT, None)
 
74
        item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
73
75
        item.connect('activate', Gtk.main_quit)
74
76
        self.append(item)
75
 
        self.show_all()
 
77
        if self.SHOW_WIDGETS:
 
78
            self.show_all()
76
79
 
77
80
    def display(self, icon, event_button, event_time):
78
 
        self.popup(None, None, Gtk.status_icon_position_menu, 
 
81
        self.popup(None, None, Gtk.status_icon_position_menu,
79
82
               event_button, event_time, icon)
80
83
 
81
84
    def toggle_lan_gateway(self, item):
99
102
        from bzrlib.plugins.gtk.preferences import PreferencesWindow
100
103
        prefs = PreferencesWindow()
101
104
        prefs.run()
102