Using gtk_idle_add in a GNOME app, plus a little



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?

Another problem I'm having is the read blocking even though I've used
fcntl to set the O_NONBLOCK flag
for the socket (I can only suspect the read blocking since the
gps_connection_read has no loops and seems
to hang as soon as the connection is made and no input is to be read).
I'm not looking for specifics, just general things to look for (wrt to
the read problem).

One last question.  Is gtkGL still being developed?  I noticed it in the
CVS via bonsai, but didn't show
up when I checked out `gnome.'  It would be a lot easier (I hope) than
using X Window lib calls and trying
to integrate them with GNOME.
-- 
---------------------+---------------------------------------
Jim Smith            | Email: j-smith@physics.tamu.edu
Texas A&M University | http://people.physics.tamu.edu/jsmith/
Dept. of Physics     | Phone: (409) 845-1379
---------------------+---------------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]