mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
rename constructors
This commit is contained in:
parent
941b1cc283
commit
edb385f903
36 changed files with 266 additions and 180 deletions
10
src/app.rs
10
src/app.rs
|
|
@ -20,15 +20,17 @@ pub struct App {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(profile: Rc<Profile>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(profile: &Rc<Profile>) -> Self {
|
||||||
// Init GTK
|
// Init GTK
|
||||||
let application = Application::builder()
|
let application = Application::builder()
|
||||||
.application_id(APPLICATION_ID)
|
.application_id(APPLICATION_ID)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init components
|
// Init components
|
||||||
let browser = Rc::new(Browser::new(profile.clone()));
|
let browser = Rc::new(Browser::build(profile));
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
application.connect_activate({
|
application.connect_activate({
|
||||||
|
|
@ -250,7 +252,7 @@ impl App {
|
||||||
|
|
||||||
// Return activated App struct
|
// Return activated App struct
|
||||||
Self {
|
Self {
|
||||||
profile,
|
profile: profile.clone(),
|
||||||
application,
|
application,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,13 @@ pub struct Browser {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Browser {
|
impl Browser {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(profile: Rc<Profile>) -> Browser {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(profile: &Rc<Profile>) -> Browser {
|
||||||
// Init components
|
// Init components
|
||||||
let action = Rc::new(Action::new());
|
let action = Rc::new(Action::new());
|
||||||
let window = Rc::new(Window::new(profile.clone(), action.clone()));
|
let window = Rc::new(Window::build(profile, &action));
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = Rc::new(Widget::new(
|
let widget = Rc::new(Widget::new(
|
||||||
|
|
|
||||||
|
|
@ -22,19 +22,24 @@ pub struct Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(profile: Rc<Profile>, browser_action: Rc<BrowserAction>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(profile: &Rc<Profile>, browser_action: &Rc<BrowserAction>) -> Self {
|
||||||
// Init local actions
|
// Init local actions
|
||||||
let action = Rc::new(Action::new());
|
let action = Rc::new(Action::new());
|
||||||
|
|
||||||
// Init components
|
// Init components
|
||||||
let tab = Rc::new(Tab::new(&profile, (&browser_action, &action)));
|
let tab = Rc::new(Tab::build(profile, (browser_action, &action)));
|
||||||
let header = Rc::new(Header::new(
|
let header = Rc::new(Header::build(
|
||||||
(&browser_action, &action),
|
(browser_action, &action),
|
||||||
&profile,
|
profile,
|
||||||
|
&tab.widget.tab_view,
|
||||||
|
));
|
||||||
|
let widget = Rc::new(Widget::build(
|
||||||
|
&header.widget.toolbar_view,
|
||||||
&tab.widget.tab_view,
|
&tab.widget.tab_view,
|
||||||
));
|
));
|
||||||
let widget = Rc::new(Widget::new(&header.widget.gobject, &tab.widget.tab_view));
|
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
action.append.connect_activate({
|
action.append.connect_activate({
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,22 @@ pub struct Header {
|
||||||
impl Header {
|
impl Header {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
pub fn new(
|
/// Build new `Self`
|
||||||
|
pub fn build(
|
||||||
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
||||||
profile: &Rc<Profile>,
|
profile: &Rc<Profile>,
|
||||||
tab_view: &TabView,
|
tab_view: &TabView,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// Init components
|
// Init components
|
||||||
let bar = Rc::new(Bar::new((browser_action, window_action), profile, tab_view));
|
let bar = Rc::new(Bar::build(
|
||||||
|
(browser_action, window_action),
|
||||||
|
profile,
|
||||||
|
tab_view,
|
||||||
|
));
|
||||||
|
|
||||||
// Return new struct
|
// Return new struct
|
||||||
Self {
|
Self {
|
||||||
widget: Rc::new(Widget::new(&bar.widget.g_box)),
|
widget: Rc::new(Widget::build(&bar.widget.g_box)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,16 +19,17 @@ pub struct Bar {
|
||||||
impl Bar {
|
impl Bar {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
pub fn new(
|
/// Build new `Self`
|
||||||
|
pub fn build(
|
||||||
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
||||||
profile: &Rc<Profile>,
|
profile: &Rc<Profile>,
|
||||||
view: &TabView,
|
view: &TabView,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let control = Control::new();
|
let control = Control::new();
|
||||||
let tab = Tab::new(window_action, view);
|
let tab = Tab::new(window_action, view);
|
||||||
let menu = Rc::new(Menu::new((browser_action, window_action), profile));
|
let menu = Rc::new(Menu::build((browser_action, window_action), profile));
|
||||||
Self {
|
Self {
|
||||||
widget: Rc::new(Widget::new(
|
widget: Rc::new(Widget::build(
|
||||||
&control.window_controls,
|
&control.window_controls,
|
||||||
&menu.menu_button,
|
&menu.menu_button,
|
||||||
&tab.widget.tab_bar,
|
&tab.widget.tab_bar,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ pub struct Menu {
|
||||||
|
|
||||||
#[rustfmt::skip] // @TODO template builder?
|
#[rustfmt::skip] // @TODO template builder?
|
||||||
impl Menu {
|
impl Menu {
|
||||||
pub fn new(
|
// Constructors
|
||||||
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(
|
||||||
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
||||||
profile: &Rc<Profile>,
|
profile: &Rc<Profile>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ impl Tab {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(window_action: &Rc<WindowAction>, view: &TabView) -> Self {
|
pub fn new(window_action: &Rc<WindowAction>, view: &TabView) -> Self {
|
||||||
Self {
|
Self {
|
||||||
widget: Rc::new(Widget::new(
|
widget: Rc::new(Widget::build(
|
||||||
view,
|
view,
|
||||||
&Append::new(window_action).widget.gobject,
|
&Append::build(window_action).widget.button,
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ mod widget;
|
||||||
|
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use super::WindowAction;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Append {
|
pub struct Append {
|
||||||
|
|
@ -10,10 +10,12 @@ pub struct Append {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Append {
|
impl Append {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(window_action: &Rc<WindowAction>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(window_action: &Rc<WindowAction>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
widget: Rc::new(Widget::new(window_action.clone())),
|
widget: Rc::new(Widget::build(window_action)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use super::WindowAction;
|
||||||
use gtk::{prelude::ButtonExt, Align, Button};
|
use gtk::{prelude::ButtonExt, Align, Button};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
pub gobject: Button,
|
pub button: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(window_action: Rc<WindowAction>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(window_action: &Rc<WindowAction>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let button = Button::builder()
|
||||||
.icon_name("tab-new-symbolic")
|
.icon_name("tab-new-symbolic")
|
||||||
.css_classes(["flat"])
|
.css_classes(["flat"])
|
||||||
.valign(Align::Center)
|
.valign(Align::Center)
|
||||||
|
|
@ -18,8 +20,11 @@ impl Widget {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked(move |_| window_action.append.activate_default_once());
|
button.connect_clicked({
|
||||||
|
let window_action = window_action.clone();
|
||||||
|
move |_| window_action.append.activate_default_once()
|
||||||
|
});
|
||||||
|
|
||||||
Self { gobject }
|
Self { button }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@ pub struct Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(view: &TabView, start_action_widget: &impl IsA<gtk::Widget>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(view: &TabView, start_action_widget: &impl IsA<gtk::Widget>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
tab_bar: TabBar::builder()
|
tab_bar: TabBar::builder()
|
||||||
.autohide(false)
|
.autohide(false)
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,21 @@
|
||||||
use adw::TabBar;
|
use gtk::{
|
||||||
use gtk::{prelude::BoxExt, Box, MenuButton, Orientation, WindowControls};
|
prelude::{BoxExt, IsA},
|
||||||
|
Box, Orientation,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
pub g_box: Box,
|
pub g_box: Box,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(control: &WindowControls, menu: &MenuButton, tab: &TabBar) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(
|
||||||
|
control: &impl IsA<gtk::Widget>,
|
||||||
|
menu: &impl IsA<gtk::Widget>,
|
||||||
|
tab: &impl IsA<gtk::Widget>,
|
||||||
|
) -> Self {
|
||||||
let g_box = Box::builder()
|
let g_box = Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
.spacing(8)
|
.spacing(8)
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
use adw::ToolbarView;
|
use adw::ToolbarView;
|
||||||
use gtk::Box;
|
use gtk::prelude::IsA;
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
pub gobject: ToolbarView,
|
pub toolbar_view: ToolbarView,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(top_bar: &Box) -> Self {
|
|
||||||
let gobject = ToolbarView::builder().build();
|
|
||||||
|
|
||||||
gobject.add_top_bar(top_bar);
|
/// Build new `Self`
|
||||||
|
pub fn build(top_bar: &impl IsA<gtk::Widget>) -> Self {
|
||||||
|
let toolbar_view = ToolbarView::builder().build();
|
||||||
|
|
||||||
Self { gobject }
|
toolbar_view.add_top_bar(top_bar);
|
||||||
|
|
||||||
|
Self { toolbar_view }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,10 @@ pub struct Tab {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(
|
||||||
profile: &Rc<Profile>,
|
profile: &Rc<Profile>,
|
||||||
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
|
@ -154,7 +156,7 @@ impl Tab {
|
||||||
is_load: bool,
|
is_load: bool,
|
||||||
) -> Rc<Item> {
|
) -> Rc<Item> {
|
||||||
// Init new tab item
|
// Init new tab item
|
||||||
let item = Rc::new(Item::new(
|
let item = Rc::new(Item::build(
|
||||||
&self.widget.tab_view,
|
&self.widget.tab_view,
|
||||||
&self.profile,
|
&self.profile,
|
||||||
// Actions
|
// Actions
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,10 @@ pub struct Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Item {
|
impl Item {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(
|
||||||
tab_view: &TabView,
|
tab_view: &TabView,
|
||||||
profile: &Rc<Profile>,
|
profile: &Rc<Profile>,
|
||||||
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
(browser_action, window_action): (&Rc<BrowserAction>, &Rc<WindowAction>),
|
||||||
|
|
@ -52,13 +54,13 @@ impl Item {
|
||||||
|
|
||||||
let action = Rc::new(Action::new());
|
let action = Rc::new(Action::new());
|
||||||
|
|
||||||
let page = Rc::new(Page::new(
|
let page = Rc::new(Page::build(
|
||||||
&id,
|
&id,
|
||||||
profile,
|
profile,
|
||||||
(browser_action, window_action, &action),
|
(browser_action, window_action, &action),
|
||||||
));
|
));
|
||||||
|
|
||||||
let widget = Rc::new(Widget::new(
|
let widget = Rc::new(Widget::build(
|
||||||
id.as_str(),
|
id.as_str(),
|
||||||
tab_view,
|
tab_view,
|
||||||
&page.widget.g_box,
|
&page.widget.g_box,
|
||||||
|
|
@ -166,7 +168,7 @@ impl Item {
|
||||||
Ok(records) => {
|
Ok(records) => {
|
||||||
for record in records {
|
for record in records {
|
||||||
// Construct new item object
|
// Construct new item object
|
||||||
let item = Rc::new(Item::new(
|
let item = Rc::new(Item::build(
|
||||||
tab_view,
|
tab_view,
|
||||||
profile,
|
profile,
|
||||||
// Actions
|
// Actions
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ pub struct Page {
|
||||||
impl Page {
|
impl Page {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
pub fn new(
|
pub fn build(
|
||||||
id: &Rc<GString>,
|
id: &Rc<GString>,
|
||||||
profile: &Rc<Profile>,
|
profile: &Rc<Profile>,
|
||||||
(browser_action, window_action, tab_action): (
|
(browser_action, window_action, tab_action): (
|
||||||
|
|
@ -70,22 +70,18 @@ impl Page {
|
||||||
),
|
),
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// Init components
|
// Init components
|
||||||
let content = Rc::new(Content::new((window_action.clone(), tab_action.clone())));
|
let content = Rc::new(Content::build((window_action, tab_action)));
|
||||||
|
|
||||||
let search = Rc::new(Search::new());
|
let search = Rc::new(Search::new());
|
||||||
|
|
||||||
let navigation = Rc::new(Navigation::new(
|
let navigation = Rc::new(Navigation::build(
|
||||||
profile.clone(),
|
profile,
|
||||||
(
|
(browser_action, window_action, tab_action),
|
||||||
browser_action.clone(),
|
|
||||||
window_action.clone(),
|
|
||||||
tab_action.clone(),
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
let input = Rc::new(Input::new());
|
let input = Rc::new(Input::new());
|
||||||
|
|
||||||
let widget = Rc::new(Widget::new(
|
let widget = Rc::new(Widget::build(
|
||||||
id,
|
id,
|
||||||
&navigation.widget.g_box,
|
&navigation.widget.g_box,
|
||||||
&content.g_box,
|
&content.g_box,
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,11 @@ impl Content {
|
||||||
// Construct
|
// Construct
|
||||||
|
|
||||||
/// Create new container for different components
|
/// Create new container for different components
|
||||||
pub fn new((window_action, tab_action): (Rc<WindowAction>, Rc<TabAction>)) -> Self {
|
pub fn build((window_action, tab_action): (&Rc<WindowAction>, &Rc<TabAction>)) -> Self {
|
||||||
Self {
|
Self {
|
||||||
g_box: Box::builder().orientation(Orientation::Vertical).build(),
|
g_box: Box::builder().orientation(Orientation::Vertical).build(),
|
||||||
window_action,
|
window_action: window_action.clone(),
|
||||||
tab_action,
|
tab_action: tab_action.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,7 @@ use reload::Reload;
|
||||||
use request::Request;
|
use request::Request;
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
use crate::app::browser::window::tab::item::Action as TabAction;
|
use super::{BrowserAction, Profile, TabAction, WindowAction};
|
||||||
use crate::app::browser::window::Action as WindowAction;
|
|
||||||
use crate::app::browser::Action as BrowserAction;
|
|
||||||
use crate::Profile;
|
|
||||||
use sqlite::Transaction;
|
use sqlite::Transaction;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
|
@ -31,24 +28,28 @@ pub struct Navigation {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Navigation {
|
impl Navigation {
|
||||||
pub fn new(
|
pub fn build(
|
||||||
profile: Rc<Profile>,
|
profile: &Rc<Profile>,
|
||||||
action: (Rc<BrowserAction>, Rc<WindowAction>, Rc<TabAction>),
|
(browser_action, window_action, tab_action): (
|
||||||
|
&Rc<BrowserAction>,
|
||||||
|
&Rc<WindowAction>,
|
||||||
|
&Rc<TabAction>,
|
||||||
|
),
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// init children components
|
// init children components
|
||||||
let home = Rc::new(Home::new(action.1.clone()));
|
let home = Rc::new(Home::build(window_action));
|
||||||
let history = Rc::new(History::new(action.1.clone()));
|
let history = Rc::new(History::build(window_action));
|
||||||
let reload = Rc::new(Reload::new(action.1.clone()));
|
let reload = Rc::new(Reload::build(window_action));
|
||||||
let request = Rc::new(Request::new((action.0, action.2)));
|
let request = Rc::new(Request::build((browser_action, tab_action)));
|
||||||
let bookmark = Rc::new(Bookmark::new(action.1));
|
let bookmark = Rc::new(Bookmark::build(window_action));
|
||||||
|
|
||||||
// init main widget
|
// init main widget
|
||||||
let widget = Rc::new(Widget::new(
|
let widget = Rc::new(Widget::build(
|
||||||
&home.widget.gobject,
|
&home.widget.button,
|
||||||
&history.widget.gobject,
|
&history.widget.g_box,
|
||||||
&reload.widget.gobject,
|
&reload.widget.button,
|
||||||
&request.widget.entry,
|
&request.widget.entry,
|
||||||
&bookmark.widget.gobject,
|
&bookmark.widget.button,
|
||||||
));
|
));
|
||||||
|
|
||||||
// done
|
// done
|
||||||
|
|
@ -56,7 +57,7 @@ impl Navigation {
|
||||||
bookmark,
|
bookmark,
|
||||||
history,
|
history,
|
||||||
home,
|
home,
|
||||||
profile,
|
profile: profile.clone(),
|
||||||
reload,
|
reload,
|
||||||
request,
|
request,
|
||||||
widget,
|
widget,
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,12 @@ pub struct Bookmark {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Bookmark {
|
impl Bookmark {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(action: Rc<WindowAction>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
widget: Rc::new(Widget::new(action.clone())),
|
widget: Rc::new(Widget::build(action)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,40 @@
|
||||||
use gtk::{prelude::ButtonExt, Button};
|
use gtk::{prelude::ButtonExt, Button};
|
||||||
|
|
||||||
use crate::app::browser::window::Action;
|
use super::WindowAction;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
const ICON_YES: &str = "starred-symbolic";
|
const ICON_YES: &str = "starred-symbolic";
|
||||||
const ICON_NON: &str = "non-starred-symbolic";
|
const ICON_NON: &str = "non-starred-symbolic";
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
pub gobject: Button,
|
pub button: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
pub fn new(action: Rc<Action>) -> Self {
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let button = Button::builder()
|
||||||
.icon_name(ICON_NON)
|
.icon_name(ICON_NON)
|
||||||
.tooltip_text("Bookmark")
|
.tooltip_text("Bookmark")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked(move |_| action.bookmark.activate());
|
button.connect_clicked({
|
||||||
|
let action = action.clone();
|
||||||
|
move |_| action.bookmark.activate()
|
||||||
|
});
|
||||||
|
|
||||||
// Return activated `Self`
|
// Return activated `Self`
|
||||||
Self { gobject }
|
Self { button }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
pub fn update(&self, has_bookmark: bool) {
|
pub fn update(&self, has_bookmark: bool) {
|
||||||
self.gobject
|
self.button
|
||||||
.set_icon_name(if has_bookmark { ICON_YES } else { ICON_NON });
|
.set_icon_name(if has_bookmark { ICON_YES } else { ICON_NON });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use back::Back;
|
||||||
use forward::Forward;
|
use forward::Forward;
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use super::WindowAction;
|
||||||
use gtk::glib::GString;
|
use gtk::glib::GString;
|
||||||
use std::{cell::RefCell, rc::Rc};
|
use std::{cell::RefCell, rc::Rc};
|
||||||
|
|
||||||
|
|
@ -27,14 +27,16 @@ pub struct History {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl History {
|
impl History {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(window_action: Rc<WindowAction>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
// init components
|
// init components
|
||||||
let back = Rc::new(Back::new(window_action.clone()));
|
let back = Rc::new(Back::build(action));
|
||||||
let forward = Rc::new(Forward::new(window_action));
|
let forward = Rc::new(Forward::build(action));
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = Rc::new(Widget::new(&back.widget.gobject, &forward.widget.gobject));
|
let widget = Rc::new(Widget::build(&back.widget.button, &forward.widget.button));
|
||||||
|
|
||||||
// Init memory
|
// Init memory
|
||||||
let memory = RefCell::new(Vec::new());
|
let memory = RefCell::new(Vec::new());
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,22 @@ mod widget;
|
||||||
|
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
use crate::app::browser::window::Action;
|
use super::WindowAction;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Back {
|
pub struct Back {
|
||||||
pub action: Rc<Action>,
|
action: Rc<WindowAction>,
|
||||||
pub widget: Rc<Widget>,
|
pub widget: Rc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Back {
|
impl Back {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
pub fn new(action: Rc<Action>) -> Self {
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
action: action.clone(),
|
action: action.clone(),
|
||||||
widget: Rc::new(Widget::new(action)),
|
widget: Rc::new(Widget::build(action)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::app::browser::window::Action;
|
use super::WindowAction;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{ButtonExt, WidgetExt},
|
prelude::{ButtonExt, WidgetExt},
|
||||||
Button,
|
Button,
|
||||||
|
|
@ -6,28 +6,33 @@ use gtk::{
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
pub gobject: Button,
|
pub button: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(action: Rc<Action>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let button = Button::builder()
|
||||||
.icon_name("go-previous-symbolic")
|
.icon_name("go-previous-symbolic")
|
||||||
.tooltip_text("Back")
|
.tooltip_text("Back")
|
||||||
.sensitive(false)
|
.sensitive(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked(move |_| action.history_back.activate());
|
button.connect_clicked({
|
||||||
|
let action = action.clone();
|
||||||
|
move |_| action.history_back.activate()
|
||||||
|
});
|
||||||
|
|
||||||
// Return activated `Self`
|
// Return activated `Self`
|
||||||
Self { gobject }
|
Self { button }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_sensitive: bool) {
|
pub fn update(&self, is_sensitive: bool) {
|
||||||
self.gobject.set_sensitive(is_sensitive);
|
self.button.set_sensitive(is_sensitive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,22 @@ mod widget;
|
||||||
|
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
use crate::app::browser::window::Action;
|
use super::WindowAction;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Forward {
|
pub struct Forward {
|
||||||
pub action: Rc<Action>,
|
action: Rc<WindowAction>,
|
||||||
pub widget: Rc<Widget>,
|
pub widget: Rc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Forward {
|
impl Forward {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(action: Rc<Action>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
action: action.clone(),
|
action: action.clone(),
|
||||||
widget: Rc::new(Widget::new(action)),
|
widget: Rc::new(Widget::build(action)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::app::browser::window::Action;
|
use super::WindowAction;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{ButtonExt, WidgetExt},
|
prelude::{ButtonExt, WidgetExt},
|
||||||
Button,
|
Button,
|
||||||
|
|
@ -6,28 +6,33 @@ use gtk::{
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
pub gobject: Button,
|
pub button: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(action: Rc<Action>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let button = Button::builder()
|
||||||
.icon_name("go-next-symbolic")
|
.icon_name("go-next-symbolic")
|
||||||
.tooltip_text("Forward")
|
.tooltip_text("Forward")
|
||||||
.sensitive(false)
|
.sensitive(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked(move |_| action.history_forward.activate());
|
button.connect_clicked({
|
||||||
|
let action = action.clone();
|
||||||
|
move |_| action.history_forward.activate()
|
||||||
|
});
|
||||||
|
|
||||||
// Return activated `Self`
|
// Return activated `Self`
|
||||||
Self { gobject }
|
Self { button }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_sensitive: bool) {
|
pub fn update(&self, is_sensitive: bool) {
|
||||||
self.gobject.set_sensitive(is_sensitive);
|
self.button.set_sensitive(is_sensitive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,25 +4,24 @@ use gtk::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
pub gobject: Box,
|
pub g_box: Box,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(back: &impl IsA<gtk::Widget>, forward: &impl IsA<gtk::Widget>) -> Self {
|
|
||||||
// Init widget
|
/// Build new `Self`
|
||||||
let gobject = Box::builder()
|
pub fn build(back: &impl IsA<gtk::Widget>, forward: &impl IsA<gtk::Widget>) -> Self {
|
||||||
|
let g_box = Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
.css_classes([
|
.css_classes([
|
||||||
"linked", // merge childs
|
"linked", // merge childs
|
||||||
])
|
])
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Compose childs
|
g_box.append(back);
|
||||||
gobject.append(back);
|
g_box.append(forward);
|
||||||
gobject.append(forward);
|
|
||||||
|
|
||||||
// Return activated `Self`
|
Self { g_box }
|
||||||
Self { gobject }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ mod widget;
|
||||||
|
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use super::WindowAction;
|
||||||
use gtk::glib::{gformat, GString, Uri};
|
use gtk::glib::{gformat, GString, Uri};
|
||||||
use std::{cell::RefCell, rc::Rc};
|
use std::{cell::RefCell, rc::Rc};
|
||||||
|
|
||||||
|
|
@ -14,11 +14,11 @@ pub struct Home {
|
||||||
|
|
||||||
impl Home {
|
impl Home {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(action: Rc<WindowAction>) -> Self {
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
action: action.clone(),
|
action: action.clone(),
|
||||||
uri: RefCell::new(None),
|
uri: RefCell::new(None),
|
||||||
widget: Rc::new(Widget::new(action)),
|
widget: Rc::new(Widget::build(action)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::app::browser::window::Action;
|
use super::WindowAction;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{ButtonExt, WidgetExt},
|
prelude::{ButtonExt, WidgetExt},
|
||||||
Button,
|
Button,
|
||||||
|
|
@ -6,28 +6,33 @@ use gtk::{
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
pub gobject: Button,
|
pub button: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(action: Rc<Action>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let button = Button::builder()
|
||||||
.icon_name("go-home-symbolic")
|
.icon_name("go-home-symbolic")
|
||||||
.tooltip_text("Home")
|
.tooltip_text("Home")
|
||||||
.sensitive(false)
|
.sensitive(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked(move |_| action.home.activate());
|
button.connect_clicked({
|
||||||
|
let action = action.clone();
|
||||||
|
move |_| action.home.activate()
|
||||||
|
});
|
||||||
|
|
||||||
// Return activated `Self`
|
// Return activated `Self`
|
||||||
Self { gobject }
|
Self { button }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_sensitive: bool) {
|
pub fn update(&self, is_sensitive: bool) {
|
||||||
self.gobject.set_sensitive(is_sensitive);
|
self.button.set_sensitive(is_sensitive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ mod widget;
|
||||||
|
|
||||||
use widget::Widget;
|
use widget::Widget;
|
||||||
|
|
||||||
use crate::app::browser::window::action::Action as WindowAction;
|
use super::WindowAction;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Reload {
|
pub struct Reload {
|
||||||
|
|
@ -11,11 +11,13 @@ pub struct Reload {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reload {
|
impl Reload {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(action: Rc<WindowAction>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
action: action.clone(),
|
action: action.clone(),
|
||||||
widget: Rc::new(Widget::new(action)),
|
widget: Rc::new(Widget::build(action)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::app::browser::window::Action;
|
use super::WindowAction;
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{ButtonExt, WidgetExt},
|
prelude::{ButtonExt, WidgetExt},
|
||||||
Button,
|
Button,
|
||||||
|
|
@ -6,28 +6,33 @@ use gtk::{
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
pub gobject: Button,
|
pub button: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(action: Rc<Action>) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(action: &Rc<WindowAction>) -> Self {
|
||||||
// Init gobject
|
// Init gobject
|
||||||
let gobject = Button::builder()
|
let button = Button::builder()
|
||||||
.icon_name("view-refresh-symbolic")
|
.icon_name("view-refresh-symbolic")
|
||||||
.tooltip_text("Reload")
|
.tooltip_text("Reload")
|
||||||
.sensitive(false)
|
.sensitive(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
gobject.connect_clicked(move |_| action.reload.activate());
|
button.connect_clicked({
|
||||||
|
let action = action.clone();
|
||||||
|
move |_| action.reload.activate()
|
||||||
|
});
|
||||||
|
|
||||||
// Return activated `Self`
|
// Return activated `Self`
|
||||||
Self { gobject }
|
Self { button }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_sensitive: bool) {
|
pub fn update(&self, is_sensitive: bool) {
|
||||||
self.gobject.set_sensitive(is_sensitive);
|
self.button.set_sensitive(is_sensitive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,17 @@ pub struct Request {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(action: (Rc<BrowserAction>, Rc<TabAction>)) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build((browser_action, tab_action): (&Rc<BrowserAction>, &Rc<TabAction>)) -> Self {
|
||||||
Self {
|
Self {
|
||||||
widget: Rc::new(Widget::new(action)),
|
widget: Rc::new(Widget::build((browser_action, tab_action))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
pub fn update(&self, progress_fraction: Option<f64>, is_identity_active: bool) {
|
pub fn update(&self, progress_fraction: Option<f64>, is_identity_active: bool) {
|
||||||
self.widget.update(progress_fraction, is_identity_active);
|
self.widget.update(progress_fraction, is_identity_active);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ mod primary_icon;
|
||||||
|
|
||||||
use primary_icon::PrimaryIcon;
|
use primary_icon::PrimaryIcon;
|
||||||
|
|
||||||
use crate::app::browser::{window::tab::item::Action as TabAction, Action as BrowserAction};
|
use super::{BrowserAction, TabAction};
|
||||||
use gtk::{
|
use gtk::{
|
||||||
glib::{timeout_add_local, ControlFlow, SourceId},
|
glib::{timeout_add_local, ControlFlow, SourceId},
|
||||||
prelude::{EditableExt, EntryExt, WidgetExt},
|
prelude::{EditableExt, EntryExt, WidgetExt},
|
||||||
|
|
@ -33,11 +33,10 @@ pub struct Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(action: (Rc<BrowserAction>, Rc<TabAction>)) -> Self {
|
|
||||||
// Set actions name
|
|
||||||
let (browser_action, tab_action) = action;
|
|
||||||
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build((browser_action, tab_action): (&Rc<BrowserAction>, &Rc<TabAction>)) -> Self {
|
||||||
// Init animated progress bar state
|
// Init animated progress bar state
|
||||||
let progress = Rc::new(Progress {
|
let progress = Rc::new(Progress {
|
||||||
fraction: RefCell::new(0.0),
|
fraction: RefCell::new(0.0),
|
||||||
|
|
@ -70,12 +69,18 @@ impl Widget {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
entry.connect_changed(move |_| {
|
entry.connect_changed({
|
||||||
browser_action.update.activate(None);
|
let browser_action = browser_action.clone();
|
||||||
|
move |_| {
|
||||||
|
browser_action.update.activate(None);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
entry.connect_activate(move |entry| {
|
entry.connect_activate({
|
||||||
tab_action.load.activate(Some(&entry.text()), true);
|
let tab_action = tab_action.clone();
|
||||||
|
move |entry| {
|
||||||
|
tab_action.load.activate(Some(&entry.text()), true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
entry.connect_state_flags_changed({
|
entry.connect_state_flags_changed({
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,10 @@ pub struct Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(
|
||||||
base: &impl IsA<gtk::Widget>,
|
base: &impl IsA<gtk::Widget>,
|
||||||
history: &impl IsA<gtk::Widget>,
|
history: &impl IsA<gtk::Widget>,
|
||||||
reload: &impl IsA<gtk::Widget>,
|
reload: &impl IsA<gtk::Widget>,
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,10 @@ pub struct Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(
|
||||||
name: &str,
|
name: &str,
|
||||||
// Components
|
// Components
|
||||||
navigation: &impl IsA<gtk::Widget>,
|
navigation: &impl IsA<gtk::Widget>,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ pub struct Widget {
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
pub fn new(
|
/// Build new `Self`
|
||||||
|
pub fn build(
|
||||||
keyword: &str, // ID
|
keyword: &str, // ID
|
||||||
tab_view: &TabView,
|
tab_view: &TabView,
|
||||||
child: &impl IsA<gtk::Widget>,
|
child: &impl IsA<gtk::Widget>,
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,12 @@ pub struct Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Constructors
|
||||||
pub fn new(header: &ToolbarView, tab: &TabView) -> Self {
|
|
||||||
|
/// Build new `Self`
|
||||||
|
pub fn build(header: &ToolbarView, tab: &TabView) -> Self {
|
||||||
let g_box = Box::builder().orientation(Orientation::Vertical).build();
|
let g_box = Box::builder().orientation(Orientation::Vertical).build();
|
||||||
|
|
||||||
g_box.append(header);
|
g_box.append(header);
|
||||||
g_box.append(tab);
|
g_box.append(tab);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use std::rc::Rc;
|
||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
match gtk::init() {
|
match gtk::init() {
|
||||||
Ok(_) => App::new(Rc::new(Profile::new())).run(),
|
Ok(_) => App::build(&Rc::new(Profile::new())).run(),
|
||||||
Err(_) => ExitCode::FAILURE,
|
Err(_) => ExitCode::FAILURE,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue