mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
register new local action
This commit is contained in:
parent
7fdc053051
commit
ab73b9de5b
7 changed files with 60 additions and 24 deletions
|
|
@ -44,7 +44,7 @@ impl Page {
|
|||
// Construct
|
||||
pub fn new_arc(
|
||||
id: GString,
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_tab_open: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
|
|
@ -59,7 +59,7 @@ impl Page {
|
|||
|
||||
// Init components
|
||||
let content = Arc::new(Content::new(
|
||||
action_tab_append.clone(),
|
||||
action_tab_open.clone(),
|
||||
action_page_open.clone(),
|
||||
));
|
||||
|
||||
|
|
|
|||
|
|
@ -25,16 +25,16 @@ pub struct Content {
|
|||
// GTK
|
||||
widget: Box,
|
||||
// Actions
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_tab_open: Arc<SimpleAction>,
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
}
|
||||
|
||||
impl Content {
|
||||
// Construct
|
||||
pub fn new(action_tab_append: Arc<SimpleAction>, action_page_open: Arc<SimpleAction>) -> Self {
|
||||
pub fn new(action_tab_open: Arc<SimpleAction>, action_page_open: Arc<SimpleAction>) -> Self {
|
||||
Self {
|
||||
widget: Box::builder().orientation(Orientation::Vertical).build(),
|
||||
action_tab_append,
|
||||
action_tab_open,
|
||||
action_page_open,
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ impl Content {
|
|||
let child = Text::gemini(
|
||||
data,
|
||||
base,
|
||||
self.action_tab_append.clone(),
|
||||
self.action_tab_open.clone(),
|
||||
self.action_page_open.clone(),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ impl Gemini {
|
|||
pub fn new(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_tab_open: Arc<SimpleAction>,
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
) -> Self {
|
||||
// Init components
|
||||
let reader = Reader::new_arc(gemtext, base, action_tab_append, action_page_open);
|
||||
let reader = Reader::new_arc(gemtext, base, action_tab_open, action_page_open);
|
||||
|
||||
let widget = Widget::new_arc(&reader.gobject());
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ impl Reader {
|
|||
pub fn new_arc(
|
||||
gemtext: &str,
|
||||
base: &Uri,
|
||||
action_tab_append: Arc<SimpleAction>,
|
||||
action_tab_open: Arc<SimpleAction>,
|
||||
action_page_open: Arc<SimpleAction>,
|
||||
) -> Arc<Self> {
|
||||
// Init default values
|
||||
|
|
@ -197,8 +197,8 @@ impl Reader {
|
|||
for tag in iter.tags() {
|
||||
// Tag is link
|
||||
if let Some(_) = _links_.get(&tag) {
|
||||
return action_tab_append.activate(None); // @TODO implement URI option
|
||||
// @TODO action does not work after focus out
|
||||
return action_tab_open.activate(None); // @TODO implement URI option
|
||||
// @TODO action does not work after focus out
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue