mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45: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,13 +4,12 @@ mod widget;
|
|||
use reader::Reader;
|
||||
use widget::Widget;
|
||||
|
||||
use crate::app::browser::window::tab::action::Action as TabAction;
|
||||
use adw::ClampScrollable;
|
||||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
glib::{GString, Uri},
|
||||
};
|
||||
|
||||
use adw::ClampScrollable;
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Gemini {
|
||||
|
|
@ -23,11 +22,11 @@ impl Gemini {
|
|||
pub fn new(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
action_tab_open: SimpleAction,
|
||||
tab_action: Rc<TabAction>,
|
||||
action_page_open: SimpleAction,
|
||||
) -> Self {
|
||||
// Init components
|
||||
let reader = Reader::new_rc(gemtext, base, action_tab_open, action_page_open);
|
||||
let reader = Reader::new_rc(gemtext, base, tab_action, action_page_open);
|
||||
|
||||
let widget = Widget::new_rc(reader.gobject());
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ mod widget;
|
|||
use tag::Tag;
|
||||
use widget::Widget;
|
||||
|
||||
use crate::app::browser::window::tab::action::Action as TabAction;
|
||||
use adw::StyleManager;
|
||||
use gemtext::line::{
|
||||
code::Code,
|
||||
|
|
@ -20,7 +21,6 @@ use gtk::{
|
|||
EventControllerMotion, GestureClick, TextBuffer, TextTag, TextView, TextWindowType,
|
||||
UriLauncher, Window, WrapMode,
|
||||
};
|
||||
|
||||
use std::{collections::HashMap, rc::Rc};
|
||||
|
||||
pub struct Reader {
|
||||
|
|
@ -33,7 +33,7 @@ impl Reader {
|
|||
pub fn new_rc(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
action_tab_open: SimpleAction,
|
||||
tab_action: Rc<TabAction>,
|
||||
action_page_open: SimpleAction,
|
||||
) -> Rc<Self> {
|
||||
// Init default values
|
||||
|
|
@ -289,7 +289,7 @@ impl Reader {
|
|||
return match uri.scheme().as_str() {
|
||||
"gemini" => {
|
||||
// Open new page in browser
|
||||
action_tab_open.activate(Some(&uri.to_string().to_variant()));
|
||||
tab_action.open().activate(Some(&uri.to_string()));
|
||||
}
|
||||
// Scheme not supported, delegate
|
||||
_ => UriLauncher::new(&uri.to_str()).launch(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue