exit program on notification



Hi all,

I have one small problem :
I'd like to exit Gtk program if it get some notification from Postgres.
I have defined : 

gtk_timeout_add (1000, timeout_func, NULL);     

gint timeout_func (gpointer data)
{
        PQconsumeInput (my_PQGetConn ());
        
        while ((notify = PQnotifies(conn)) != NULL)
        {
                if (strcmp("ap_end", notify->relname) == 0)
                        gtk_main_quit ();
        }

        return (TRUE);
}


It is working OK, except situation if the other window with own
gtk_main() is showed (I use this for showing message to user). In this
case my program exit when the user click button OK in the message
window. (in callback function for button I call gtk_main_quit())
I've tried : 
        for (i=0; i < gtk_main_level(); i++)
                gtk_main_quit ();
but this is not working.
What am I dooing wrong?


Thank you for your advices.
Michal.






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