On Thu, 2004-04-22 at 10:30 -0700, Peter Rowat wrote:
My application continuously displays incoming data, so I
use g-timeout-add to continuously refresh the screen. Often the user
will want this as fast as possible, sometimes at a fixed speed, and
sometimes the speed will need to be changed.
There does not appear to be a clean way to change the speed. Presumably
this could be done by changing the value of "interval"
in "g_timeout_add(interval, function, data)".
Possible work-around: quit the main loop with "gtk-main-quit()" then
call { timeout-add; gtk-main(); } again with new value for interval.
Is there a better way?
-- Thanks, Peter Rowat
You don't need to call gtk_main_quit(), you can call g_source_remove()
to remove an existing timeout source (so long as you saved the return
value from g_timeout_add()):
gint id;
id = g_timeout_add (1000, do_something, NULL);
g_source_remove (id);
id = g_timeout_add (100, do_something, NULL);
--
Peace,
Jim Cape
http://ignore-your.tv
"We still name our military helicopter gunships after victims
of genocide. Nobody bats an eyelash about that: Blackhawk.
Apache. And Comanche. If the Luftwaffe named its military
helicopters Jew and Gypsy, I suppose people would notice."
-- Noam Chomsky, "Propaganda and the Public Mind"
Attachment:
signature.asc
Description: This is a digitally signed message part