Re: timeout function not called



On 10/2/07, tsangv gdls com <tsangv gdls com> wrote:
I'm still muddling my way through my first GTK application (and I'm a
relative newbie on all software matters).

I have the following in one of my callbacks:

timer = g_timout_add(50, (GSourceFunc) progress_update,
(gpointer)progressbar);

pid = fork( );

if (pid == 0)
{
    growPart ( );
    exit(0);
}
ret = wait(NULL);

g_source_remove(timer);

---------------

where progress_update is:

static gboolean progress_update (gpointer progressbar)
{
  gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar));
  return true;
}

----------------

I was hoping that this would mean that the progress bar would pulse while
growPart() was running, but instead it waits until after (is this because
control hasn't been returned to gtk_main yet?) at which point it is
removed. If I take out the g_source_remove it runs beautifully....but only
after growPart has completed. How can I get around this?

Thanks so much

Hi,

I think you can use gtk_main_iteration() to tell gtk handle some of
the pending events. However, unless the progress of the bar is not
related to the computation in growPart, wouldn't it be better to
update the progress bar status from the inside of the growPart
function?

Cheers



This is an e-mail from General Dynamics Land Systems. It is for the intended recipient only and may contain 
confidential and privileged information.  No one else may read, print, store, copy, forward or act in 
reliance on it or its attachments.  If you are not the intended recipient, please return this message to 
the sender and delete the message and any attachments from your computer. Your cooperation is appreciated.

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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