
from gi.repository import Gtk


def quit(*args):
	Gtk.main_quit()

menu = Gtk.Menu()
menu.add(Gtk.MenuItem(label="Item 1"))
quit_item = Gtk.MenuItem(label="Quit")
quit_item.connect("activate", quit)
menu.add(quit_item)

tray_widget = Gtk.StatusIcon.new_from_file("./tray.png")
tray_widget.set_visible(True)

def popup_menu(widget, button, time, *args):
	menu.show_all()
	menu.popup(None, None, None, None, button, time)

def activate_menu(*args):
	print "activate_menu(%s)" % str(args)

tray_widget.connect('popup-menu', popup_menu)
tray_widget.connect('activate', activate_menu)

Gtk.main()
