Hello,
if I use g_idle_add, then when the function from g_idle_add is
executed, it blocks the 'update_pbar' function.
So I probably must make it with threads but by now I think it's to
early for me to work with threads. It's easier if I add the
progressbar into the main window, and update it with:
while (gtk_events_pending())
  gtk_main_iteration();

Later I would probably try it with threads.

Thanks for the help.


2007/3/6, Karl H. Beckers <[EMAIL PROTECTED]>:
> Am Montag, den 05.03.2007, 17:03 +0100 schrieb patrick:
> > Great! Thank you very much, this works.
> > But how can I make something during gtk_dialog_run?
> > I'd like to do somthing like this.
> >
> > g_timeout_add(1000, update_pbar, dialog);
> > result = gtk_dialog_run(GTK_DIALOG(dialog));
> > ...my process which progressbar should show
> > g_spawn...
> > progress = 0.2
> > ....other work
> > gtk_widget_destroy(dialog);
> > dialog = NULL;
> >
> >
> > update_pbar (gpointer dialog)
> > {
> > ...
> > gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(probar), progress);
> > ...
> > }
>
> Well,
> you either need another scheduled function (prolly g_idle_add) or start
> a separate thread when entering your callback and join it before ending.
>
> You prolly want to avoid multi-threading for such a rather limited
> use-case.
>
> Also, I've noted a flaw in my pseudo-code around setting dialog to NULL
> which does not change the pointer that has already been passed to
> update_pbar ... a static global would prolly do here or smth. similar.
>
> HTH,
>
> Karl.
>
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to