remove extra mod

This commit is contained in:
yggverse 2025-01-26 16:51:07 +02:00
parent 1077368116
commit 5255708be3
3 changed files with 13 additions and 33 deletions

View file

@ -35,7 +35,7 @@ impl Browser {
// Init widget
let widget = Rc::new(Widget::new(
&window.widget.g_box,
&window.g_box,
&[
// action groups
(
@ -59,7 +59,7 @@ impl Browser {
// Connect events
action.about.connect_activate({
let window = window.clone();
move || About::new().present(Some(&window.widget.g_box))
move || About::new().present(Some(&window.g_box))
});
action.close.connect_activate({

View file

@ -2,24 +2,22 @@ mod action;
mod database;
mod header;
pub mod tab;
mod widget;
use action::{Action, Position};
use adw::ToolbarView;
use header::Header;
use sqlite::Transaction;
use tab::Tab;
use widget::Widget;
use super::Action as BrowserAction;
use crate::Profile;
use gtk::glib::GString;
use gtk::{glib::GString, prelude::BoxExt, Box, Orientation};
use std::rc::Rc;
pub struct Window {
pub action: Rc<Action>,
pub tab: Rc<Tab>,
pub widget: Rc<Widget>,
pub g_box: Box,
}
impl Window {
@ -32,10 +30,16 @@ impl Window {
// Init components
let tab = Rc::new(Tab::build(profile, (browser_action, &action)));
let widget = Rc::new(Widget::build(
&ToolbarView::header((browser_action, &action), profile, &tab.widget.tab_view),
// Init widget
let g_box = Box::builder().orientation(Orientation::Vertical).build();
g_box.append(&ToolbarView::header(
(browser_action, &action),
profile,
&tab.widget.tab_view,
));
g_box.append(&tab.widget.tab_view);
// Init events
action.append.connect_activate({
@ -123,11 +127,7 @@ impl Window {
});
// Init struct
Self {
action,
tab,
widget,
}
Self { action, tab, g_box }
}
// Actions

View file

@ -1,20 +0,0 @@
use adw::{TabView, ToolbarView};
use gtk::{prelude::BoxExt, Box, Orientation};
pub struct Widget {
pub g_box: Box,
}
impl Widget {
// Constructors
/// Build new `Self`
pub fn build(header: &ToolbarView, tab: &TabView) -> Self {
let g_box = Box::builder().orientation(Orientation::Vertical).build();
g_box.append(header);
g_box.append(tab);
Self { g_box }
}
}