mod subject; mod tray; use subject::Subject; use tray::Tray; use gtk::{gio::SimpleAction, glib::GString, HeaderBar}; use std::sync::Arc; pub struct Header { widget: HeaderBar, subject: Subject, } impl Header { // Construct pub fn new( action_debug: Arc, action_quit: Arc, action_tab_append: Arc, action_tab_close: Arc, action_tab_close_all: Arc, action_tab_page_navigation_base: Arc, action_tab_page_navigation_history_back: Arc, action_tab_page_navigation_history_forward: Arc, action_tab_page_navigation_reload: Arc, action_tab_pin: Arc, ) -> Self { // Init components let tray = Tray::new( action_debug, action_quit, action_tab_append, action_tab_close, action_tab_close_all, action_tab_page_navigation_base, action_tab_page_navigation_history_back, action_tab_page_navigation_history_forward, action_tab_page_navigation_reload, action_tab_pin, ); let subject = Subject::new(); // Init widget let widget = HeaderBar::builder().build(); widget.pack_start(tray.widget()); widget.set_title_widget(Some(subject.widget())); // Return new struct Self { widget, subject } } // Actions pub fn update(&self, title: Option, description: Option) { self.subject.update(title, description); } // Getters pub fn widget(&self) -> &HeaderBar { &self.widget } }