I'm writing a vala GTK+ application and want to add a modal dialog like this:
var dialog = new Gtk.Dialog.with_buttons (_("My title"), this,
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
_("Yes"),
Gtk.ResponseType.OK,
_("No"),
Gtk.ResponseType.NO,
null);
The dialog appears and behaves correctly, but the title is missing. Any idea why? Anything special about gala? I couldn't find any mention of this problem on the web so far.
I'm on a clean installation of elementary OS 5 Juno.
MCVE in Application.vala
:
public void show_dialog(Gtk.Window window) {
var dialog = new Gtk.Dialog.with_buttons ("My title", window,
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
"Yes",
Gtk.ResponseType.OK,
"No",
Gtk.ResponseType.NO,
null);
dialog.response.connect((response_id) => {
dialog.close();
});
dialog.show_all ();
}
int main (string[] args) {
Gtk.init (ref args);
var window = new Gtk.Window ();
window.title = "First GTK+ Program";
window.border_width = 10;
window.window_position = Gtk.WindowPosition.CENTER;
window.set_default_size (350, 70);
window.destroy.connect (Gtk.main_quit);
var button = new Gtk.Button.with_label ("Click me!");
button.clicked.connect (() => {
show_dialog(window);
});
window.add (button);
window.show_all ();
Gtk.main ();
return 0;
}
Compiled with valac --pkg gtk+-3.0 Application.vala
results in this dialog displayed when I click the button:
My title
correctly, so I expect/assume your window manager is actually at fault. You could try changing your dialog flags so that the dialog is a separate window (or etc) to verify this.