Re: updating a progress bar



On Sun, Dec 22, 2002 at 12:45:55AM -0800, mjaz wrote:

I have a window that displays a list that takes a while to load(>1 Minute) and
I want to update a progress bar while it loads.
but the spot it takes a while to load at is in gtk_widget_show_all();.
I want to know how I can update a progress bar while it's in there?
I have tried using a timeout but I can't seem to get it to work.
It updates fine when the program does some heavy calculations then it stops
when the program goes into the gtk_widget_show_all() function
I'm using gtk-2.

I don't know if this is the "correct" way to do it, but I found I had to put

while (gtk_events_pending()) {
    gtk_main_iteration()
}

right after the call to set_fraction() to get the progressbar to update.  This
was is a tight loop where I'm loading values into a ListStore.  I never
could get it to work with timeouts.  Looking at the docs, I see that there's
also gtk_main_iteration_do(), which may be better for this.

Dave Cook



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