You may be wondering how you make GTK do useful work when in gtk_main. Well, you have several options. Using the following function you can create a timeout function that will be called every "interval" milliseconds.
gint g_timeout_add (guint32 interval, GtkFunction function, gpointer data);
The first argument is the number of milliseconds between calls to your function. The second argument is the function you wish to have called, and the third, the data passed to this callback function. The return value is an integer "tag" which may be used to stop the timeout by calling:
void g_source_remove (gint tag);
You may also stop the timeout function by returning zero or FALSE from your callback function. Obviously this means if you want your function to continue to be called, it should return a non-zero value, i.e., TRUE.
The declaration of your callback should look something like this:
gint timeout_callback (gpointer data);