2024-10-10 23:34:06 +03:00
|
|
|
mod append;
|
|
|
|
mod control;
|
2024-09-20 18:02:10 +03:00
|
|
|
mod menu;
|
|
|
|
mod tab;
|
2024-10-10 23:34:06 +03:00
|
|
|
mod widget;
|
2024-09-23 18:51:48 +03:00
|
|
|
|
2024-10-10 23:34:06 +03:00
|
|
|
use append::Append;
|
|
|
|
use control::Control;
|
2024-09-23 18:51:48 +03:00
|
|
|
use menu::Menu;
|
|
|
|
use tab::Tab;
|
2024-10-10 23:34:06 +03:00
|
|
|
use widget::Widget;
|
2024-09-19 11:29:03 +03:00
|
|
|
|
2024-10-10 23:34:06 +03:00
|
|
|
use adw::TabView;
|
|
|
|
use gtk::{gio::SimpleAction, Box};
|
2024-09-28 03:10:07 +03:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2024-10-10 23:34:06 +03:00
|
|
|
pub struct Bar {
|
|
|
|
widget: Arc<Widget>,
|
2024-09-22 20:58:23 +03:00
|
|
|
}
|
2024-09-19 11:29:03 +03:00
|
|
|
|
2024-10-10 23:34:06 +03:00
|
|
|
impl Bar {
|
|
|
|
// Construct
|
|
|
|
pub fn new_arc(
|
2024-10-04 16:19:26 +03:00
|
|
|
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>,
|
2024-10-10 23:34:06 +03:00
|
|
|
view: &TabView,
|
|
|
|
) -> Arc<Self> {
|
2024-09-28 01:29:05 +03:00
|
|
|
// Init components
|
2024-10-10 23:34:06 +03:00
|
|
|
let control = Control::new_arc();
|
|
|
|
let tab = Tab::new_arc(view);
|
|
|
|
let append = Append::new_arc(action_tab_append.clone());
|
|
|
|
let menu = Menu::new_arc(
|
2024-10-04 16:19:26 +03:00
|
|
|
action_tool_debug,
|
|
|
|
action_tool_profile_directory,
|
2024-09-28 01:53:16 +03:00
|
|
|
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,
|
2024-09-28 01:53:16 +03:00
|
|
|
action_tab_pin,
|
|
|
|
);
|
2024-09-28 02:06:04 +03:00
|
|
|
|
2024-10-10 23:34:06 +03:00
|
|
|
// Build result
|
|
|
|
Arc::new(Self {
|
|
|
|
widget: Widget::new_arc(
|
|
|
|
control.gobject(),
|
|
|
|
append.gobject(),
|
|
|
|
menu.gobject(),
|
|
|
|
tab.gobject(),
|
|
|
|
),
|
|
|
|
})
|
2024-09-22 20:58:23 +03:00
|
|
|
}
|
2024-09-19 11:29:03 +03:00
|
|
|
|
2024-09-22 20:58:23 +03:00
|
|
|
// Getters
|
2024-10-06 05:23:19 +03:00
|
|
|
pub fn gobject(&self) -> &Box {
|
2024-10-10 23:34:06 +03:00
|
|
|
&self.widget.gobject()
|
2024-09-22 20:58:23 +03:00
|
|
|
}
|
2024-09-20 18:02:10 +03:00
|
|
|
}
|