GtkProgressBar and updating other widgets

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

 



Hello all,
In an image processing application, I have a set of Radio buttons toselect the method to process my image.This works fine.As processes are long, I have added a GtkProgressBar. But now, the Radiobuttons are not updated according to my selection. During the process,the GUI is blocked except the progress bar using gtk_grab_add().If I don't block the GUI, the Radio buttons are of course correctlyupdated. But preventing other  GUI modifications during process ismandatory for me.
I tried to add  "while (gtk_events_pending()) gtk_main_iteration();" atdifferent positions in the callback function before launching theprocess but it does not change anything.
Any idea on how to make these buttons to updated according to theselection ?

Here is the skeleton of the application :
/* Progress_bar.c : 3 functions to initialize, update and reset theGtkProgressBar */int progressbar_init(GtkWidget *main_window){  /* pbar is declared global */  pbar = lookup_widget(main_window, "progressbar");  if (pbar == NULL)    return 0;
  gtk_grab_add(pbar);  gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar), 0.0);  while (gtk_events_pending())    gtk_main_iteration();
  return 1;}
void progressbar_update(gdouble percent){  gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar), percent);  while (gtk_events_pending())    gtk_main_iteration();}
void progressbar_reset(void){  gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar), 0.0);  while (gtk_events_pending())    gtk_main_iteration();  gtk_grab_remove(pbar);}

/* Callback_for_process.c */void on_method1_radio_button_pressed(GtkButton *button, gpointeruser_data){  [...]  progressbar_init(main_window);  for (i=0; i<nb_pixels; i++)        /* inner process */  {    [...]    progressbar_update((gdouble) i / nb_pixels);  }  progessbar_reset();}

Kind regards,-- Stéphane Albine-mail: stephane point albin chez free point frwww: http://stephane.albin.free.fr




_______________________________________________gtk-list mailing listgtk-list@xxxxxxxxxxxxx://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux