#!/usr/bin/env python2.3 import commands import gobject import gtk import string import egg.trayicon as trayicon img = gtk.Image() img.set_from_file("/usr/share/gajim/data/iconsets/stellar/16x16/connecting.gif") eb = gtk.EventBox() #eb.connect('button-press-event', on_clicked) eb.add(img) state = 0 t = trayicon.TrayIcon('Network Status') t.add(eb) t.show_all() def handler(): global state output = commands.getoutput("/usr/sbin/pppoe-status") if string.find(output, "down") > -1: if state == 1: img.set_from_file("/usr/share/gajim/data/iconsets/stellar/16x16/connecting.gif") state = 0 else: if state == 0: img.set_from_file("/usr/share/gajim/data/iconsets/stellar/16x16/online.png") state = 1; gobject.timeout_add(100, handler) gobject.timeout_add(100, handler) gtk.main()