Re: destroying (by closing) a modeless GtkMessageDialog ?



Hi,
I use a function like this:

void  Centro::dialog_error(const char *display_msg)
{
    Gtk::MessageDialog  dialog(*mp_window, "Errore", false, Gtk::MESSAGE_ERROR);
    dialog.set_secondary_text(display_msg);
    dialog.run();
    dialog.hide();
}

...even though dialog.hide() is actually not needed since the dialog is destroyed as soon as the user clicks on ok/close/anything.
Cheers,
Giuseppe.


On Thu, Jun 7, 2012 at 4:03 PM, Basile Starynkevitch <basile starynkevitch net> wrote:
Hello,

What is the correct way to implement a modeless
Gtk::MessageDialog which is *destroyed* when its CLOSE button is activated,
or when the underlying window is closed?

My MyDialog class (subclass of Gtk::MessageDialog) has a Glib::RefPtr<MyDialog>
somewhere (for simplicity, you could assume in the main application window).

Obviously, one can't delete the object instance in its signal_response().
I was thinking of using Glib::signal_idle().connect_once with a ptr_fun
for Glib::RefPtr<MyDialog>::clear ...

I'm using Gtk 3.4 & GtkMM 3.4 if that matters on Linux/Debian/Sid

Regards.

PS. The exact code is in function ShownLocationInfo::on_dialog_response of
http://gcc.gnu.org/viewcvs/branches/melt-branch/contrib/simplemelt-gtkmm-probe.cc
--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list



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