use adw::prelude::*;
pub fn build(
socket_path: &std::path::Path,
reason: &str,
on_retry: impl Fn() + 'static,
) -> gtk::Box {
let container = gtk::Box::new(gtk::Orientation::Vertical, 0);
container.set_hexpand(true);
container.set_vexpand(true);
let page = adw::StatusPage::builder()
.icon_name("network-offline-symbolic")
.title("Daemon unreachable")
.description(format!(
"Could not connect to {}.\n\n{reason}\n\nStart fluxframe with [control].enabled = true in its TOML, then click Retry.",
socket_path.display()
))
.hexpand(true)
.vexpand(true)
.build();
let retry = gtk::Button::with_label("Retry");
retry.add_css_class("suggested-action");
retry.add_css_class("pill");
retry.set_halign(gtk::Align::Center);
retry.connect_clicked(move |_| on_retry());
page.set_child(Some(&retry));
container.append(&page);
container
}