Attach "WindowControls" to "HeaderBar" at the end

    let headerbar = gtk::HeaderBar::builder().build();

    let wc1 = gtk::WindowControls::builder().build();
    let wc2 = gtk::WindowControls::builder().build();
    let windowcontrols = gtk::Box::builder().build();

    wc1.set_side(gtk::PackType::Start);
    wc2.set_side(gtk::PackType::End);

    windowcontrols.append(&wc1);
    windowcontrols.append(&wc2);

    let tabs = gtk::Box::builder().spacing(6).build();

    tabs.append(&tab1);
    tabs.append(&tab2);
    tabs.append(&tab3);
    tabs.append(&tab4);

    headerbar.set_show_title_buttons(false);
    headerbar.set_halign(gtk::Align::Start);
    headerbar.set_title_widget(Some(&tabs));

    window.set_titlebar(Some(&headerbar));

My question is, now how do I attach the windowcontrols? I can’t seem to find any native method for doing so.

I don’t understand why you’re disabling GtkHeaderBar’s window controls only to add them back separately. Why not use the ones it provides?

1 Like

Oh, you’re right! I was refactoring some older code and it seems I was removing & adding it back for no reason.