On Sun, 2007-08-05 at 11:29 +0800, Gregory Hosler wrote: > I'm looking for code examples specifically on how to use/implement > g_idle_add(). > Know any projects that uses g_idle_add() and related infrastructure?
static gboolean make_insensitive_idle_cb(gpointer data) { GtkWidget *widget = GTK_WIDGET(data); gtk_widget_set_sensitive(widget, FALSE); /* Return FALSE so as not to keep executing this function over and over again */ return FALSE; } static gpointer my_thread(gpointer data) { /* ... do something of long duration, during which ... */ g_idle_add(make_insensitive_idle_cb, some_widget); /* ... do the rest of the long duration stuff ... */ return NULL; } Have a look at http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html#id2603517 HTH, Gabriel _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list