Vala Message Dialog Won’t Close!

By | July 1, 2016

I never recall having an issue with this in Gtkmm, but this had me snookered for a while. Here’s the answer . . .

You must connect the response signal of the message dialog to a function that destroys it!


Gtk.MessageDialog msg = new Gtk.MessageDialog(window,
Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR,
Gtk.ButtonsType.OK,
"An important message!");
msg.response.connect((dlg, r) => { dlg.destroy(); }); //see?!
msg.show();
return;

There’s a more comprehensive example over at gnome.org

Leave a Reply

Your email address will not be published. Required fields are marked *