Re: Problem to open a new window using libglade



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.




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