Re: questionfor progress bar




I would do it like this, but sorry i haven't got time
to confirm it would work.


/* pseudo code*/

gboolean * show_bar_idle_cb(pointer  val)
{
   gtk_progress_bar_set_fraction(POINT_TO_INT(val));
   return FALSE to exit the idle
    
}
/* and the for loop */
 double val;
 for(i = 0; i< SOME_NUMBER; i++)
 {
    val = (100.0 /SOME_NUMBER)* i /100.0;
    g_idle_add(show_bar_idle_cb, INT_TO_POINT(val));
 } 

Using timeouts can work too, if G_PRIORITY_HIGH is
used. 
Ok, it's just my 2 cents. I used this in my
application before and it worked. Hope it helps

Cheers
TranVan Hoang,

--- Kim Jongha <kim jongha gmail com> wrote:

Greeting,

progress bar is updated "only" using timeouts ?

I read some big file and want to show up the
progress how much App.
read file. so I use progress bar like below


double val;
for(i = 0; i< SOME_NUMBER; i++)
{
   val = (100.0 /SOME_NUMBER)* i /100.0;
 

gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar),
val);
   gtk_widget_show(pbar);
}

No error, 'val' value is greater than 0.0 less than
1.0. but it
doesn't work while app. read file. when app read
file completly, then
progress bar filled fully is shown up.
I try to use timeouts, and that how can I read
file.. ?

give me a advise, thank you.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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