Re: Please wrap GtkObject::destroy signal



On Mon, 2008-12-29 at 00:52 +0100, Mathias Hasselmann wrote:
> Please wrap the GtkObject::destroy signal: The signal is useful to
> figure out that objects like windows in WINDOW_POPUP mode are destroyed.
> 
> Those windows are ignored by the window manager and therefore don't
> receive the GtkWindow::delete-event. Of course I could connect to other
> auxiliary signals like "unrealize" or "unmap", but also can get this
> signal without actually destroying the window, so connecting to those
> signals would be hacks only working on occasion. I really want to know
> when the widget is destroyed.

> This signal is also convenient for terminating main loops as it has the
> same signature as gtk_main_quit()/Gtk::Main::quit(). Actually I wonder
> why that many tutorials suggest connecting to the delete-event signal
> for terminating the main loop: The delete-event and gtk_main_quit() have
> an incompatible signature and I've never read that the return value of
> void functions always is zero.

Is there a reason you can't use the "hide" signal? I think most gtkmm
programs use this for terminating from the main loop, including the
Gtk::Main::run(Gtk::Window&) overload. It also has the same signature as
Gtk::Main::quit().

Normally one really doesn't need the GtkObject::destroy signal in C++. I
would be surprised to see a use case where there is no cleaner way
without using it.

Another approach might be to subclass Gtk::Window, and do things in that
subclass's destructor.

> Ciao,
> Mathias

Armin



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