Re: [gtk-list] Respawning idle functions...
- From: Juan Toledo <toledo users sourceforge net>
- To: gtk-list redhat com, hp redhat com
- Subject: Re: [gtk-list] Respawning idle functions...
- Date: Sat, 15 Apr 2000 23:02:11 +0200
Don't bother trying to answer my question on the list.
I solved it on my own yesterday. Notice the question is from Thursday,
but the list has been behaving weird lately.
Thanks for taking your time, specially Havoc. :-)
In case anybody is interested, this is how I solved it. I used glib
timeouts directly in the full version, so that new idles or timeouts are
only added in the destruction notification.
Regards,
Juan.
void
destroying_timeout (gpointer data)
{
/* g_message ("A timeout function has been destroyed"); */
diagram_timeout = g_idle_add_full (G_PRIORITY_DEFAULT,
(GtkFunction) update_diagram,
data, (GDestroyNotify)
destroying_idle);
is_idle = TRUE;
}
void
destroying_idle (gpointer data)
{
/* g_message ("An idle function has been destroyed"); */
diagram_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT,
refresh_period,
(GtkFunction) update_diagram,
data,
(GDestroyNotify)
destroying_timeout);
is_idle = FALSE;
}
guint
update_diagram (GtkWidget * canvas)
{
.
.
. if (!is_idle)
{
if (diff_msecs > refresh_period * 1.2)
return FALSE; /* Removes the timeout */
}
else
{
if (diff_msecs < refresh_period)
return FALSE; /* removes the idle */
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]