Re: close -> destroy

> I create a nice dialog with ok and cancel button and present it to 
> the user, now he press not ok nor cancel, but the close button of the WM, 
> and --> boom ! my widget is destroyed, not hide nor anything else, 
> destroyed.
> What is the normal workaround to this ?

There are a number of ways of doing this.

The first one is to connect to the "delete_delete" signal on the toplevel
window of the dialog box, and return FALSE if you do not want to
accept window manager's close request.  Although, you should.

You can at that point, accept the window manager request and shut down
your dialog properly.

> for example, gnumeric die horribely if I do
> Insert -> Cells... -> Click close btn of wm
> or
> View -> Zoom... -> Click close btn of wm
> or
> Edit -> Paste special... -> Click close btn of wm
> and so on...

Thanks for spotting this bug.  In this specific case, I was not
expecting gtk_dialog_cauldron to return a NULL value (this is what
happens when you close with the window manager).  

I have now added a fix to the code.

> Not to mention some weird things it does when I do
> File -> (Open or Save) -> Click close btn of wm -> File -> Exit

Good bug spotting.  I have fixed this as well, my fix looks like this:

     gtk_signal_connect (dialog, "destroy", GTK_SIGNAL_FUNC
                         (gtk_main_quit), NULL);

Hope this works for you too.

Best wishes,

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