[Glade-users] Timing out a dialog [Solved]

His Majesty balakkvj at gmail.com
Mon Mar 9 17:35:44 EDT 2009


---------- Forwarded message ----------
From: His Majesty <balakkvj at gmail.com>
Date: 2009/3/9
Subject: Re: [Glade-users] Timing out a dialog [Solved]
To: Tristan Van Berkom <tvb at gnome.org>


Thanks mate, your suggestion works like a clock!
Finally, I settled to using g_timeout_add_seconds as the GTK manual
says it is more optimized.

For future reference to others
=========================

In your dialog function
 - Create and configure dialog
 - source_id = g_timeout_add (2 seconds, callback, dialog);
 - run dialog

In  your callback function
- quit dialog
- if (source_id > 0) source_id = (g_source_remove (source_id), 0);
- source_id = 0; <-- reset source timeout id
- return FALSE; <-- ensure timeout is cancelled
=========================

HTH

Thanks,
B



2009/3/6 Tristan Van Berkom <tvb at gnome.org>:
> On Fri, Mar 6, 2009 at 8:27 AM, His Majesty <balakkvj at gmail.com> wrote:
>
> This should be the sequence you need:
>
>  - Create and configure dialog
>  - source_id = g_timeout_add (2 seconds, new dialog); <--- right here
>  - run dialog
>  - if (source_id > 0) source_id = (g_source_remove (source_id), 0);
> <--- and cancel it here, reset the timeout id also...
>
> and the timeout:
>  - quit dialog
>  - source_id = 0; <-- reset source timeout id
>  - return FALSE; <-- ensure timeout is cancelled
>
> Cheers,
>                 -Tristan
>


--
BalaKrishna Kolluru


More information about the Glade-users mailing list