Re: [gtk-list] Re: default signals Q
- From: Tim Janik <timj gtk org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: default signals Q
- Date: Thu, 13 May 1999 03:13:34 +0200 (CEST)
On Wed, 12 May 1999, Havoc Pennington wrote:
>
> On Wed, 12 May 1999, pavel wrote:
> >
> > When I create a window it comes with defined behavior for the "destroy"
> > signal. (It destroys all the widgets inside it, correct?)
> > How does one disable that? (I'm guessing I'll gave to run
> > gtk_signal_disconnect(, ) but with what second argument?
> >
>
> Containers destroy their children when the container is destroyed; the
> only way around that is to remove the children before you destroy the
> container (with gtk_container_remove()). You will need to _ref() any
> children before you remove them, or they will be destroyed on removal.
>
> You can't disconnect or block this signal handler because it's the default
> signal handler; you could gtk_signal_emit_stop() in a signal handler you
> connect yourself, but then you wouldn't be able to destroy the container,
> which might be kind of bad. That is, you need the container's default
> destroy handler to run because it doesn't only destroy children, it also
> destroys the container, and presumably you want that to happen if you
> are calling gtk_widget_destroy() on the container.
you need to distinguish between the actuall ::destroy signal here (for
what your writings hold true) and the ::delete_event signal (which is emitted
upon window manager destroy requests). the ::delete_event signal isn't
supplied with a default handler by gtkwidget.c and will cause a widget that
receives this signal to get automatically destroyed if the signal is *not*
handled. thus,
gtk_signal_connect (window, "delete_event", GTK_SIGNAL_FUNC (gtk_true), NULL);
can prevent a widget (window) from automated destruction upon window
manager destroy requests.
another connection that's quite common is
gtk_signal_connect (window,
"delete_event",
GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete),
NULL);
which is pretty self describing ;)
>
> Havoc
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]