Hello everyone,
I’m currently learning how to use gtk-rs
. I’m playing around with the gtk::HeaderBar
, but I am having trouble getting the close (x) button to appear. This is how it currently looks:
I read online that the set_decoration_layout
allows to have the close button show. I added header_bar.set_decoration_layout(Some("menu:minimize,close"));
but that didn’t seem help.
I am not sure what I am doing doing wrong here… I provided the code below for you to see.
extern crate gtk;
extern crate gio;
use gtk::prelude::*;
use gio::prelude::*;
use gtk::{Application, ApplicationWindow, HeaderBar};
fn main() {
let application = Application::new(
None,
Default::default(),
).expect("failed to initalize GTK application");
application.connect_activate(|app| {
let window = ApplicationWindow::new(app);
window.set_default_size(350, 70);
let header_bar = HeaderBar::new();
header_bar.set_title(Some("My HeaderBar"));
header_bar.set_decoration_layout(Some("menu:minimize,close"));
window.set_titlebar(Some(&header_bar));
window.show_all();
});
application.run(&[]);
}