mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-03 01:55:27 +00:00
add new tab item action group, delegate history handle to action implementation
This commit is contained in:
parent
5145a53bfa
commit
913030a955
29 changed files with 409 additions and 232 deletions
|
|
@ -4,7 +4,7 @@ mod widget;
|
|||
use reader::Reader;
|
||||
use widget::Widget;
|
||||
|
||||
use crate::app::browser::window::{tab::item::Action as TabAction, Action as WindowAction};
|
||||
use crate::app::browser::window::{tab::item::Action as ItemAction, Action as WindowAction};
|
||||
use gtk::glib::Uri;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -18,11 +18,11 @@ impl Gemini {
|
|||
pub fn new(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
(window_action, tab_action): (&Rc<WindowAction>, &Rc<TabAction>),
|
||||
(window_action, item_action): (&Rc<WindowAction>, &Rc<ItemAction>),
|
||||
) -> Self {
|
||||
// Init components
|
||||
let reader = Rc::new(
|
||||
Reader::new(gemtext, base, (window_action.clone(), tab_action.clone())).unwrap(),
|
||||
Reader::new(gemtext, base, (window_action.clone(), item_action.clone())).unwrap(),
|
||||
); // @TODO handle errors
|
||||
let widget = Rc::new(Widget::new(&reader.widget.text_view));
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use syntax::Syntax;
|
|||
use tag::Tag;
|
||||
use widget::Widget;
|
||||
|
||||
use super::{TabAction, WindowAction};
|
||||
use super::{ItemAction, WindowAction};
|
||||
use crate::app::browser::window::action::Position;
|
||||
use ggemtext::line::{
|
||||
code::{Inline, Multiline},
|
||||
|
|
@ -43,7 +43,7 @@ impl Reader {
|
|||
pub fn new(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
(window_action, tab_action): (Rc<WindowAction>, Rc<TabAction>),
|
||||
(window_action, item_action): (Rc<WindowAction>, Rc<ItemAction>),
|
||||
) -> Result<Self, Error> {
|
||||
// Init default values
|
||||
let mut title = None;
|
||||
|
|
@ -332,7 +332,7 @@ impl Reader {
|
|||
return match uri.scheme().as_str() {
|
||||
"gemini" | "titan" => {
|
||||
// Open new page in browser
|
||||
tab_action.load.activate(Some(&uri.to_str()), true);
|
||||
item_action.load.activate(Some(&uri.to_str()), true);
|
||||
}
|
||||
// Scheme not supported, delegate
|
||||
_ => UriLauncher::new(&uri.to_str()).launch(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue