/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: Curtis Hovey
  • Date: 2012-02-05 05:14:11 UTC
  • mto: This revision was merged to the branch mainline in revision 775.
  • Revision ID: sinzui.is@verizon.net-20120205051411-y9ra08wae1wsfv52
Remove unneeded gtksourceview1 support.

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