mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
begin Titan protocol implementation
This commit is contained in:
parent
236d941b37
commit
879fe7a6f6
37 changed files with 609 additions and 102 deletions
65
src/app/browser/window/tab/item/page/input/titan.rs
Normal file
65
src/app/browser/window/tab/item/page/input/titan.rs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
mod control;
|
||||
mod form;
|
||||
mod title;
|
||||
mod widget;
|
||||
|
||||
use control::Control;
|
||||
use form::Form;
|
||||
use title::Title;
|
||||
use widget::Widget;
|
||||
|
||||
use super::TabAction;
|
||||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
glib::{uuid_string_random, Uri},
|
||||
};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Titan {
|
||||
// Components
|
||||
pub widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Titan {
|
||||
// Constructors
|
||||
|
||||
/// Build new `Self`
|
||||
pub fn build(_tab_action: Rc<TabAction>, _base: Uri, title: Option<&str>) -> Self {
|
||||
// Init local actions
|
||||
let action_update = SimpleAction::new(&uuid_string_random(), None);
|
||||
let action_send = SimpleAction::new(&uuid_string_random(), None);
|
||||
|
||||
// Init components
|
||||
let control = Rc::new(Control::build(action_send.clone()));
|
||||
let form = Rc::new(Form::build(action_update.clone()));
|
||||
let title = Rc::new(Title::build(title));
|
||||
|
||||
// Init widget
|
||||
let widget = Rc::new(Widget::build(
|
||||
&title.widget.label,
|
||||
&form.widget.text_view,
|
||||
&control.widget.g_box,
|
||||
));
|
||||
|
||||
// Init events
|
||||
action_update.connect_activate({
|
||||
let control = control.clone();
|
||||
let form = form.clone();
|
||||
move |_, _| control.update(Some(form.widget.size()))
|
||||
});
|
||||
|
||||
action_send.connect_activate({
|
||||
// @TODO let form = form.clone();
|
||||
move |_, _| {
|
||||
todo!()
|
||||
/* tab_action.load.activate(
|
||||
Some(&),
|
||||
true,
|
||||
);*/
|
||||
}
|
||||
});
|
||||
|
||||
// Return activated struct
|
||||
Self { widget }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue