Re: Using gtk_idle_add in a GNOME app, plus a little
- From: SEGV <mlepage cgocable net>
- To: gnome-list gnome org
- CC: James Smith <j-smith physics tamu edu>
- Subject: Re: Using gtk_idle_add in a GNOME app, plus a little
- Date: Mon, 21 Dec 1998 20:10:29 -0500
James Smith wrote:
>
> Not sure if this is the proper place to ask this, but it does deal with
> my GNOME app. I'm trying to
> set up a routine to be regularly executed during the idle loop. Right
> now the code is:
>
> static void
> idle_cb(gpsui_app *data) {
> static char buffer[81];
> int ret;
>
> gtk_idle_add(idle_cb, data);
> if(data && data->magic == GPSUI_APP_MAGIC &&
> gps_connection_active(data->connection) &&
> (data->connection->locked == 0)) {
> gps_connection_read(data->connection, buffer, 80);
> } else
> if(data && data->magic == GPSUI_APP_MAGIC &&
> gps_connection_active(data->connection) &&
> (data->connection->locked == 1)) {
> g_print("connection locked...\n");
> }
> }
>
> If I don't have the gtk_idle_add at the beginning of the routine, it
> only gets called once. Is there
> a way around this?
A good rule is to never hack around a problem without first double checking the
details for the root cause.
In this case, your callback's signature is wrong. It should be
static gint idle_cb(gpsui_app *data)
which will give you further clues to the problem.
You must return true or false depending on whether you want your callback to
remain registered or not.
See the GTK+ Tutorial s19 for details.
--
SEGV http://www.cgocable.net/~mlepage/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]