diff --git a/src/app/browser/window/header/bar.rs b/src/app/browser/window/header/bar.rs index c5706fd0..17dedafc 100644 --- a/src/app/browser/window/header/bar.rs +++ b/src/app/browser/window/header/bar.rs @@ -1,10 +1,8 @@ -mod append; mod control; mod menu; mod tab; mod widget; -use append::Append; use control::Control; use menu::Menu; use tab::Tab; @@ -36,8 +34,7 @@ impl Bar { ) -> Arc { // Init components let control = Control::new_arc(); - let tab = Tab::new_arc(view); - let append = Append::new_arc(action_tab_append.clone()); + let tab = Tab::new_arc(action_tab_append.clone(), view); let menu = Menu::new_arc( action_tool_debug, action_tool_profile, @@ -54,12 +51,7 @@ impl Bar { // Build result Arc::new(Self { - widget: Widget::new_arc( - control.gobject(), - append.gobject(), - menu.gobject(), - tab.gobject(), - ), + widget: Widget::new_arc(control.gobject(), menu.gobject(), tab.gobject()), }) } diff --git a/src/app/browser/window/header/bar/tab.rs b/src/app/browser/window/header/bar/tab.rs index cd699a89..5f2a8291 100644 --- a/src/app/browser/window/header/bar/tab.rs +++ b/src/app/browser/window/header/bar/tab.rs @@ -1,8 +1,11 @@ +mod append; mod widget; +use append::Append; use widget::Widget; use adw::{TabBar, TabView}; +use gtk::gio::SimpleAction; use std::sync::Arc; pub struct Tab { @@ -11,9 +14,9 @@ pub struct Tab { impl Tab { // Construct - pub fn new_arc(view: &TabView) -> Arc { + pub fn new_arc(action_tab_append: SimpleAction, view: &TabView) -> Arc { Arc::new(Self { - widget: Widget::new_arc(view), + widget: Widget::new_arc(view, Append::new_arc(action_tab_append).gobject()), }) } diff --git a/src/app/browser/window/header/bar/append.rs b/src/app/browser/window/header/bar/tab/append.rs similarity index 100% rename from src/app/browser/window/header/bar/append.rs rename to src/app/browser/window/header/bar/tab/append.rs diff --git a/src/app/browser/window/header/bar/append/widget.rs b/src/app/browser/window/header/bar/tab/append/widget.rs similarity index 100% rename from src/app/browser/window/header/bar/append/widget.rs rename to src/app/browser/window/header/bar/tab/append/widget.rs diff --git a/src/app/browser/window/header/bar/tab/widget.rs b/src/app/browser/window/header/bar/tab/widget.rs index 13f848cc..aaa2d187 100644 --- a/src/app/browser/window/header/bar/tab/widget.rs +++ b/src/app/browser/window/header/bar/tab/widget.rs @@ -1,4 +1,5 @@ use adw::{TabBar, TabView}; +use gtk::prelude::IsA; use std::sync::Arc; pub struct Widget { @@ -7,11 +8,12 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc(view: &TabView) -> Arc { + pub fn new_arc(view: &TabView, start_action_widget: &impl IsA) -> Arc { Arc::new(Self { gobject: TabBar::builder() .autohide(false) .expand_tabs(false) + .start_action_widget(start_action_widget) .view(&view) .build(), }) diff --git a/src/app/browser/window/header/bar/widget.rs b/src/app/browser/window/header/bar/widget.rs index e0f099ce..1105c78d 100644 --- a/src/app/browser/window/header/bar/widget.rs +++ b/src/app/browser/window/header/bar/widget.rs @@ -1,5 +1,5 @@ use adw::TabBar; -use gtk::{prelude::BoxExt, Box, Button, MenuButton, Orientation, WindowControls}; +use gtk::{prelude::BoxExt, Box, MenuButton, Orientation, WindowControls}; use std::sync::Arc; pub struct Widget { @@ -8,19 +8,13 @@ pub struct Widget { impl Widget { // Construct - pub fn new_arc( - control: &WindowControls, - append: &Button, - menu: &MenuButton, - tab: &TabBar, - ) -> Arc { + pub fn new_arc(control: &WindowControls, menu: &MenuButton, tab: &TabBar) -> Arc { let gobject = Box::builder() .orientation(Orientation::Horizontal) .spacing(8) .build(); gobject.append(tab); - gobject.append(append); gobject.append(menu); gobject.append(control);