diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 56b97123..c6c64848 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -58,7 +58,7 @@ impl Page { let input = Rc::new(Input::new()); let widget = Rc::new(Widget::build( - &navigation.widget.g_box, + &navigation.g_box, &content.g_box, &search.g_box, &input.clamp, diff --git a/src/app/browser/window/tab/item/page/navigation.rs b/src/app/browser/window/tab/item/page/navigation.rs index 1990970e..571ff554 100644 --- a/src/app/browser/window/tab/item/page/navigation.rs +++ b/src/app/browser/window/tab/item/page/navigation.rs @@ -4,18 +4,19 @@ mod history; mod home; mod reload; mod request; -mod widget; use super::{ItemAction, Profile, TabAction, WindowAction}; use bookmark::Bookmark; -use gtk::{Box, Button}; +use gtk::{prelude::BoxExt, Box, Button, Orientation}; use history::History; use home::Home; use reload::Reload; use request::Request; use sqlite::Transaction; use std::rc::Rc; -use widget::Widget; + +const MARGIN: i32 = 6; +const SPACING: i32 = 6; pub struct Navigation { pub profile: Rc, @@ -23,7 +24,7 @@ pub struct Navigation { pub reload: Button, pub bookmark: Button, pub request: Rc, - pub widget: Rc, + pub g_box: Box, } impl Navigation { @@ -43,23 +44,27 @@ impl Navigation { let home = Button::home((window_action, tab_action, item_action), &request); let bookmark = Button::bookmark(window_action, profile, &request); - // init main widget - let widget = Rc::new(Widget::build( - &home, - &history, - &reload, - &request.entry, // @TODO - &bookmark, - )); + let g_box = Box::builder() + .orientation(Orientation::Horizontal) + .spacing(SPACING) + .margin_start(MARGIN) + .margin_end(MARGIN) + .margin_bottom(MARGIN) + .build(); + + g_box.append(&home); + g_box.append(&history); + g_box.append(&reload); + g_box.append(&request.entry); // @TODO + g_box.append(&bookmark); - // done Self { profile: profile.clone(), home, request, reload, bookmark, - widget, + g_box, } } diff --git a/src/app/browser/window/tab/item/page/navigation/widget.rs b/src/app/browser/window/tab/item/page/navigation/widget.rs deleted file mode 100644 index 113b20ee..00000000 --- a/src/app/browser/window/tab/item/page/navigation/widget.rs +++ /dev/null @@ -1,40 +0,0 @@ -use gtk::{ - prelude::{BoxExt, IsA}, - Box, Orientation, -}; - -const MARGIN: i32 = 6; -const SPACING: i32 = 6; - -pub struct Widget { - pub g_box: Box, -} - -impl Widget { - // Constructors - - /// Build new `Self` - pub fn build( - base: &impl IsA, - history: &impl IsA, - reload: &impl IsA, - request: &impl IsA, - bookmark: &impl IsA, - ) -> Self { - let g_box = Box::builder() - .orientation(Orientation::Horizontal) - .spacing(SPACING) - .margin_start(MARGIN) - .margin_end(MARGIN) - .margin_bottom(MARGIN) - .build(); - - g_box.append(base); - g_box.append(history); - g_box.append(reload); - g_box.append(request); - g_box.append(bookmark); - - Self { g_box } - } -}