//! Shared per-window handles passed to every page constructor. //! //! `daemon` is a `RefCell>` because the connect-on-startup attempt //! may fail (pages render their disconnected banner); a successful Retry //! repopulates this same cell, and every page sees the new value via the Rc //! clone chain. use crate::bus::Daemon; use std::cell::RefCell; use std::rc::Rc; #[derive(Clone)] pub(crate) struct AppContext { pub parent_window: gtk::Window, pub toast_overlay: adw::ToastOverlay, pub daemon: Rc>>, } impl AppContext { pub fn new(parent_window: gtk::Window, toast_overlay: adw::ToastOverlay) -> Self { Self { parent_window, toast_overlay, daemon: Rc::new(RefCell::new(None)), } } }