mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
remove extra widget mod
This commit is contained in:
parent
ff824846e5
commit
1c98178f67
3 changed files with 20 additions and 55 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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<Profile>,
|
||||
|
|
@ -23,7 +24,7 @@ pub struct Navigation {
|
|||
pub reload: Button,
|
||||
pub bookmark: Button,
|
||||
pub request: Rc<Request>,
|
||||
pub widget: Rc<Widget>,
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<gtk::Widget>,
|
||||
history: &impl IsA<gtk::Widget>,
|
||||
reload: &impl IsA<gtk::Widget>,
|
||||
request: &impl IsA<gtk::Widget>,
|
||||
bookmark: &impl IsA<gtk::Widget>,
|
||||
) -> 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 }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue