[420] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: How can i trap the Close Event

daemon@ATHENA.MIT.EDU (Raph Levien)
Wed Jul 2 11:34:46 1997

Date: Wed, 2 Jul 1997 08:16:58 -0700 (PDT)
From: Raph Levien <raph@acm.org>
To: Fritz Heinrichmeyer <fritz.heinrichmeyer@fernuni-hagen.de>
cc: gtk-list@redhat.com
In-Reply-To: <ufhgedluhh.fsf@jfh00.fernuni-hagen.de>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com



On 2 Jul 1997, Fritz Heinrichmeyer wrote:

> 
> I wonder how it is possible to react on the Close Event (to save work on
> files ..)?

Looking at the code, I don't think GTK has support for this yet. The 
relevant code is gtk_main_iteration () in gtk+/gtk/gtkmain.c. You'll need 
to somehow disable the gtk_widget_destroy (event_widget) call in the 
GDK_DESTROY case if the signal is handled. Something like:

          if (!gtk_widget_event (event_widget, &event_copy))
            gtk_widget_destroy (event_widget);

Then, you just need to connect to the delete_event signal of the window, 
and return TRUE if you don't want to destroy the window.

I haven't checked through the signal code to make sure that the 
gtk_widget_event will reliably return a FALSE in the case that there is 
no handler for the delete_event signal, but it seems like a good bet.

Raph

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post