Yoda/src/app/browser/window/header.rs

60 lines
1.6 KiB
Rust
Raw Normal View History

mod bar;
2024-10-06 05:52:16 +03:00
mod widget;
2024-09-18 20:33:29 +03:00
use bar::Bar;
2024-10-06 05:52:16 +03:00
use widget::Widget;
use adw::{TabView, ToolbarView};
2024-10-09 10:14:03 +03:00
use gtk::gio::SimpleAction;
2024-09-28 03:10:07 +03:00
use std::sync::Arc;
2024-09-22 12:38:13 +03:00
pub struct Header {
2024-10-06 05:52:16 +03:00
widget: Arc<Widget>,
2024-09-22 12:38:13 +03:00
}
impl Header {
// Construct
pub fn new_arc(
// Actions
action_tool_debug: Arc<SimpleAction>,
action_tool_profile_directory: Arc<SimpleAction>,
2024-09-28 03:10:07 +03:00
action_quit: Arc<SimpleAction>,
action_tab_append: Arc<SimpleAction>,
action_tab_close: Arc<SimpleAction>,
action_tab_close_all: Arc<SimpleAction>,
2024-09-30 15:02:22 +03:00
action_tab_page_navigation_base: Arc<SimpleAction>,
action_tab_page_navigation_history_back: Arc<SimpleAction>,
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
2024-09-30 14:49:37 +03:00
action_tab_page_navigation_reload: Arc<SimpleAction>,
2024-09-28 03:10:07 +03:00
action_tab_pin: Arc<SimpleAction>,
// Widgets
tab_view: &TabView,
) -> Arc<Self> {
2024-09-28 01:29:05 +03:00
// Init components
let bar = Bar::new_arc(
action_tool_debug,
action_tool_profile_directory,
action_quit,
action_tab_append,
action_tab_close,
action_tab_close_all,
2024-09-30 15:02:22 +03:00
action_tab_page_navigation_base,
action_tab_page_navigation_history_back,
action_tab_page_navigation_history_forward,
2024-09-30 14:49:37 +03:00
action_tab_page_navigation_reload,
action_tab_pin,
tab_view,
);
2024-09-28 01:29:05 +03:00
// Return new struct
Arc::new(Self {
widget: Widget::new_arc(bar.gobject()),
})
}
2024-09-19 11:29:03 +03:00
// Getters
pub fn gobject(&self) -> &ToolbarView {
2024-10-06 05:52:16 +03:00
&self.widget.gobject()
}
2024-09-20 18:02:10 +03:00
}