[Glade-users] how to use timeout function in glade?

James Cameron james.cameron@compaq.com
Tue, 05 Jun 2001 10:07:28 +1000


"z..jy" wrote:
> gtk_main() will sleep until timeout and others wake it up, does it
> mean gtk_timeout_add() should be filled into callbacks.c?

No, it can be anywhere.  But callbacks.c is the common place.

> Now I want to repaint a drawing area with one second interval, but how
> can I send the time signal to the drawing area to make it repainted?

1.  write a timeout function that repaints the drawing area, returning
true or false depending on whether you want it repeated,

2.  write a callback function that is called when the drawing area
widget is created and mapped, which calls gtk_timeout_add(), passing the
pointer to the timeout function above.

gtk_main() will sleep until time expires, then it will call the timeout
function, then it will go back to sleep.  gtk_main() is also woken by
incoming events from the X display.

-- 
James Cameron                                 (james.cameron@compaq.com)

http://quozl.linux.org.au/         (or)         http://quozl.netrek.org/