Re: GtkProgressBar getting blocked



"jim Pharis" wrote:

I have an external synchronous library call that takes a while to
complete. I want to display a progress bar well I'm waiting.

The problem is, even when the progress bar is in the thread in a loop
calling gtk_progress_bar_pulse, the progress bar still looks like its
frozen.

Graphical updates (or any other signs of life in a GTK+ application)
only occur when the GTK+ main loop gets entered. This is either the case
when a handler (your library call) finishes or gtk_main_iteration() gets
invoked from within a handler. You will want to use the 2nd method.

Basically, after each gtk_progress_bar_pulse() you should do this:

    while (gtk_events_pending ())
        gtk_main_iteration ();

See:
http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html#gtk-events-pending

Possibly also helpful for your understanding:
http://mail.gnome.org/archives/gtk-app-devel-list/2006-February/msg00266.html



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