Re: GtkDialog problems again



Thanks a lot, Jim! Now it works!!!

Quoting Jim George <jimgeorge gmail com>:

On 8/27/07, omar crea jusan it <omar crea jusan it> wrote:
Hi everybody.
I need a dialog in my application that simply show a label (so without any
button) and then hide itself after some processing occurred.
The problem is that I can't send any :response signal to the dialog, so it
remains blocked in the loop after gtk_dialog_run has been called.
I tried to use the example posted in the GTK+ reference manual, but without
success.


Just in case Yeti's comment didn't make it clear, it's still important
to yield control of the program back to GTK once the progress window
is shown, otherwise nothing appears to happen. So your code might look
like this:

do_long_task_step_1(struct task_params *p)
{
  gtk_widget_show(p->progress_window);
  g_idle_add(do_long_task_step_2, p);
}

do_long_task_step_2(struct task_params *p)
{
  /* do part of the task here */
  g_idle_add(do_long_task_step_3, p);
}

do_long_task_step_3(struct task_params *p)
{
  /* finish up the task here */

  gtk_widget_hide(p->progress_window);
}

For file/device I/O, you would use something like g_io_channel, so you
wouldn't need to rely on g_idle_add.

-Jim






----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



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