Re: gtk_dialog_run queries



El mar, 24 de 02 de 2004 a las 06:40, Sarfraaz Ahmed escribiÃ:
Hi,

I was writing a GTK+ app and created the GUI using glade-2. I created a
GTK Dialog with OK and Cancel button and a few text entry boxes. I used
the glade_xml calls to update the GUI components and attached a few
signals.

I finally called gtk_dialog_run and was reading the response back in a
variable and was blindly calling gtk_dialog_destroy, without checking
the value of the response [ I just wanted to kill the dialog on any
response, and so decided not to check it, is this wrong ?? ]

Not for me :)

But, with the above code, the dialog would never get destroyed.

I've got working code doing that:

gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(GTK_WIDGET(dialog));

I then added a set_response [ DESTROY ] call in the signal handler for
the ok button callback and was calling gtk_destroy only if this was the
response. Only then, i was able to get this dialog working. Any ideas,
on why this works only in this way ??

Also, what is the reasoning behind, disabling the default "delete_event"
behaviour for GtkDialog ??

May be you must track the "response" dialog's signal and add a callbak
calling gtk_widget_destroy().
http://developer.gnome.org/doc/API/2.0/gtk/GtkDialog.html#GtkDialog-response


This way you have no need to mess with buttons signal, and any response
will destroy the dialog.


Hope this helps.
-- 
Iago Rubio                http://www.iagorubio.com          
GPGkey pgp.rediris.es id 0x909BD4DD  fingerprint =
D18A B950 5F03 BB9A DD89  AA75 FEDF 1978 909B D4DD
********** iago.rubio(AT)hispalinux.es  **********     
--------------------------------------------------

Attachment: signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente



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