mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
begin Titan protocol implementation
This commit is contained in:
parent
236d941b37
commit
879fe7a6f6
37 changed files with 609 additions and 102 deletions
|
|
@ -8,11 +8,10 @@ use form::Form;
|
|||
use title::Title;
|
||||
use widget::Widget;
|
||||
|
||||
use crate::app::browser::window::tab::item::action::Action as TabAction;
|
||||
use super::TabAction;
|
||||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
glib::{uuid_string_random, Uri, UriHideFlags},
|
||||
prelude::WidgetExt,
|
||||
};
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -22,8 +21,10 @@ pub struct Response {
|
|||
}
|
||||
|
||||
impl Response {
|
||||
// Construct
|
||||
pub fn new(
|
||||
// Constructors
|
||||
|
||||
/// Build new `Self`
|
||||
pub fn build(
|
||||
tab_action: Rc<TabAction>,
|
||||
base: Uri,
|
||||
title: Option<&str>,
|
||||
|
|
@ -34,12 +35,12 @@ impl Response {
|
|||
let action_send = SimpleAction::new(&uuid_string_random(), None);
|
||||
|
||||
// Init components
|
||||
let control = Rc::new(Control::new(action_send.clone()));
|
||||
let form = Rc::new(Form::new(action_update.clone()));
|
||||
let title = Rc::new(Title::new(title));
|
||||
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::new(
|
||||
let widget = Rc::new(Widget::build(
|
||||
&title.widget.label,
|
||||
&form.widget.text_view,
|
||||
&control.widget.g_box,
|
||||
|
|
@ -52,10 +53,10 @@ impl Response {
|
|||
let form = form.clone();
|
||||
move |_, _| {
|
||||
control.update(size_limit.map(|limit| {
|
||||
limit as i32
|
||||
- (base.to_string_partial(UriHideFlags::QUERY).len() as i32
|
||||
+ Uri::escape_string(&form.widget.text(), None, false).len() as i32)
|
||||
}));
|
||||
limit
|
||||
- (base.to_string_partial(UriHideFlags::QUERY).len()
|
||||
+ Uri::escape_string(&form.widget.text(), None, false).len())
|
||||
}))
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -73,10 +74,6 @@ impl Response {
|
|||
}
|
||||
});
|
||||
|
||||
widget.g_box.connect_realize(move |_| {
|
||||
form.widget.text_view.grab_focus();
|
||||
});
|
||||
|
||||
// Return activated struct
|
||||
Self { widget }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue