Re: [gtk-list] Re: default signals Q




Thanks for your response.

1. For some reason, when I do what you suggest with "delete_event"
the gpointer *is not* passed to the callback. Is this a bug or
the intended behavior?

2. If "delete_event" is a distinct event, how come binding the callback to
the "destroy" event also works for the "delete_event"? (Or is "destroy"
the default for "delete_event" unless you specify a callback for destroy.)

In any case what I'm trying to accomplish is to have a toggle button which
opens and closes a certain window. Of course, if the user tries to close
the window by clicking on the WM's delete button I want the effect to be
the same as if the toggle button was pressed. Since I have to untoggle the
button when that happens, I have to pass something to the "delete_event"
callback.

Pavel

On Thu, 13 May 1999, Tim Janik wrote:

> 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
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 



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