forked from RTS2/rts2-gtk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rts2-unity-indicator
executable file
·48 lines (37 loc) · 1.28 KB
/
rts2-unity-indicator
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
#!/usr/bin/env python
import sys
import gtk
import appindicator
import rts2.rtsapi
PING_FREQUENCY = 10 # seconds
class CheckGMail:
def __init__(self):
self.ind = appindicator.Indicator("new-gmail-indicator",
"indicator-messages",
appindicator.CATEGORY_APPLICATION_STATUS)
self.ind.set_status(appindicator.STATUS_ACTIVE)
self.ind.set_attention_icon("new-messages-red")
self.menu_setup()
self.ind.set_menu(self.menu)
def menu_setup(self):
self.menu = gtk.Menu()
self.quit_item = gtk.MenuItem("Quit")
self.quit_item.connect("activate", self.quit)
self.quit_item.show()
self.menu.append(self.quit_item)
def main(self):
self.check_mail()
gtk.timeout_add(PING_FREQUENCY * 1000, self.check_mail)
gtk.main()
def quit(self, widget):
sys.exit(0)
def check_mail(self):
self.ind.set_status(appindicator.STATUS_ATTENTION)
#if unread > 0:
# self.ind.set_status(appindicator.STATUS_ATTENTION)
#else:
# self.ind.set_status(appindicator.STATUS_ACTIVE)
return True
if __name__ == "__main__":
indicator = CheckGMail()
indicator.main()