#!/usr/bin/env python
import gtk
import pygtk

def quit_cb(widget, data = None):
    if data:
        data.set_visible(False)
    gtk.main_quit()

def popup_menu_cb(widget, button, time, data = None):
    if button == 3:
        if data:
            data.show_all()
            data.popup(None, None, None, 3, time)

statusIcon = gtk.StatusIcon()

menu = gtk.Menu()
menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
menuItem.connect('activate', quit_cb, statusIcon)
menu.append(menuItem)

statusIcon.set_from_stock(gtk.STOCK_HOME)
statusIcon.set_tooltip("StatusIcon test")
statusIcon.connect('popup-menu', popup_menu_cb, menu)
statusIcon.set_visible(True)

gtk.main()
