Re: gtk_statusbar!!



ferri_marllo gva es wrote:
Hi!!
I need help to buid an statusbar...
i create an application with glade...this is the structure.

Ther's a window,with a menu...when i select an option it opens a new window.
I want to open a file list ,li ke this:
file opened:

c:\data\2003.1
c:\data\2003.2

i read each line,and make operations with all the dates inside each one,before
with the first and then with the last.
I want,that during the calculate process...it will be writen in a status
bar---processing c:\data\2003.1..when it finish,tha statusbar has to change to
processing c:\data\2003.2

I tried to do it with this code.

fp=fopen("C:\data\2003.1","r")
while(fscanf(fp,"%s",fichdat)!=EOF)
   {
     g_snprintf(regi,200,"Processing el File:  %s",fichdat);
gtk_statusbar_push(GTK_STATUSBAR(statusbar2),1,regi);
      novd=real_estad_fich(fichdat,porcent);

Here is your problem... in GTK+/glib... you want to stay away from
`while (1)'ish code.

try using g_timeout_add() and run "real_estad_fich()" from
the timeout handler (or use g_idle_add()).

You must return to the main loop if you want your app to be responsive
and to update any changes you make (like the statusbar message).

Cheers,
                 -Tristan



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