Re: fork() and progress bar...



>But the functions that I'm calling to update the
>progress bar have
>
>while(gtk_events_pending()) gtk_main_iteration();

i didn't notice that within the loops. sorry if it was there. i don't
have it anymore to check.

>So I would do something like this (never done handlers before
>so this is kinda pseudo-codeish):
>
>my_100msec_handler()
>{
>   ...
>   the for loops
>   ...
>   if(*running) return TRUE;
>   return FALSE;
>}
>
>Kinda like that? Thanks for your help.

I would do this:

gint
my_100msec_handler()

{
	static int direction = 1;
	static int i = 0;

	if ((i += direction) == 100) {
	    direction = -1;
        } else if (i == 0) {
	    direction = 1;
        }

	gtk_progress_bar_update (i);
	return *running;
}

this will modify the progress bar every 100msecs, which i would
imagine is fast enough.

--p




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