Re: gtk_widget_show() and progress updating



On Sun, 22 Dec 2002 23:57:38 -0800 (PST)
mjaz <mjaz_the_mighty2 yahoo com> wrote:

Hello,
I sent a mail about this earlier but I think I didn't make it clear what my
problem is.

I have a progress bar set in activity mode, and I update it while I fill a
gtk_list_store with data, About 10,000 Lines.

That works, but when I call gtk_widget_show_all(Window) It takes gtk+ a
while(about 1 minute) to show the list.  And while gtk shows the list my
progress bar doesn't update.

Are adding stuff to the list, and updating your scrollbar _before_ your widgets
have been realized? If so, it's no wonder you do not see it updating.
 
Option 1,2 & 3: no.

Option 4: How can I manually show each row of the gtk_list_store, so that I
could update my progress bar after showing each row?

- First build all your windows, and show all of them.
- Then register a timeout that adds one (or a couple of) row(s) at a time to
  your  list, and updates the progress bar. Your timeout should return TRUE
  until it runs out of rows to add.

That should work.

Make sure that the timeout function does not take too long, or it will freeze
the user interface. Remember, GTK+ cannot process events when a timeout function
is running (unless you pepper your timeout function with
gtk_main_iteration_do(FALSE)).

You could do the usefull work in the timeout function inbetween a
g_timer_start and g_timer_stop call, and look with g_timer_elapsed how long it
took. If adding N lines takes say > 0.1 sec, make N smaller.



-- 
R.F. Smith                           /"\    ASCII Ribbon Campaign
r s m i t h @ x s 4 a l l . n l      \ /    No HTML/RTF in email
http://www.xs4all.nl/~rsmith/         X     No Word docs in email
                                     / \    Respect for open standards

Attachment: pgpAi6N91Ittx.pgp
Description: PGP signature



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