Re: Progress bars and syscalls



Aristidas Vilkaitis ha scritto lo scorso 18/04/2005 12:51:
Hello,

Since i'm quite new to both C and Gtk, i met a problem which i am not able to solve. The base of the problem is that i have a task, which should fetch several files from the internet. When a button is pressed, a new window with a progress bar opens and indicates the progress of the task. Basicly, since i thought C is a linear language, i just added several system() calls and added gtk_progress_bar_set_fraction between them like so:

...
 system("wget file.a");
 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pb1), 0.3);
   /* return control to main loop in order to serve all pending
    * requests
    */
   while ((gtk_events_pending ()) {
      gtk_main_iteration ();
   }
 system("wget file.b");
 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pb1), 0.6);  ...
   while ((gtk_events_pending ()) {
      gtk_main_iteration ();

   }


This should do the job.



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