-
Notifications
You must be signed in to change notification settings - Fork 0
/
indicator.py
61 lines (49 loc) · 1.75 KB
/
indicator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
#
# Copyright 2009 Canonical Ltd.
#
# Authors: Neil Jagdish Patel <neil.patel@canonical.com>
# Jono Bacon <jono@ubuntu.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of either or both of the following licenses:
#
# 1) the GNU Lesser General Public License version 3, as published by the
# Free Software Foundation; and/or
# 2) the GNU Lesser General Public License version 2.1, as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the applicable version of the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of both the GNU Lesser General Public
# License version 3 and version 2.1 along with this program. If not, see
# <http://www.gnu.org/licenses>
#
import gobject
import gtk
import appindicator
def menuitem_response(w, buf):
print buf
if __name__ == "__main__":
ind = appindicator.Indicator ("example-simple-client",
"indicator-messages",
appindicator.CATEGORY_APPLICATION_STATUS)
ind.set_status (appindicator.STATUS_ACTIVE)
ind.set_attention_icon ("indicator-messages-new")
# create a menu
menu = gtk.Menu()
# create some
for i in range(3):
buf = "Test-undermenu - %d" % i
menu_items = gtk.MenuItem(buf)
menu.append(menu_items)
# this is where you would connect your menu item up with a function:
# menu_items.connect("activate", menuitem_response, buf)
# show the items
menu_items.show()
ind.set_menu(menu)
gtk.main()