mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
move tab open action to separated mod
This commit is contained in:
parent
9ff32a3419
commit
38f945105c
13 changed files with 252 additions and 75 deletions
|
|
@ -4,10 +4,11 @@ mod widget;
|
|||
use form::Form;
|
||||
use widget::Widget;
|
||||
|
||||
use crate::app::browser::window::tab::action::Action as TabAction;
|
||||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
glib::{uuid_string_random, Uri, UriHideFlags},
|
||||
prelude::{ActionExt, ToVariant, WidgetExt},
|
||||
prelude::WidgetExt,
|
||||
Box,
|
||||
};
|
||||
use std::rc::Rc;
|
||||
|
|
@ -20,7 +21,7 @@ pub struct Sensitive {
|
|||
impl Sensitive {
|
||||
// Construct
|
||||
pub fn new_rc(
|
||||
action_page_open: SimpleAction,
|
||||
tab_action: Rc<TabAction>,
|
||||
base: Uri,
|
||||
title: Option<&str>,
|
||||
max_length: Option<i32>,
|
||||
|
|
@ -43,14 +44,11 @@ impl Sensitive {
|
|||
action_send.connect_activate({
|
||||
let form = form.clone();
|
||||
move |_, _| {
|
||||
action_page_open.activate(Some(
|
||||
&format!(
|
||||
"{}?{}",
|
||||
base.to_string_partial(UriHideFlags::QUERY),
|
||||
Uri::escape_string(form.text().as_str(), None, false),
|
||||
)
|
||||
.to_variant(),
|
||||
));
|
||||
tab_action.open().activate(Some(&format!(
|
||||
"{}?{}",
|
||||
base.to_string_partial(UriHideFlags::QUERY),
|
||||
Uri::escape_string(form.text().as_str(), None, false),
|
||||
)));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue