
import gtk


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

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

tray_widget = gtk.status_icon_new_from_file("./tray.png")
tray_widget.set_tooltip("hello")
tray_widget.set_tooltip("hello tooltip")
tray_widget.set_visible(True)

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

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()
