mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
rename action
This commit is contained in:
parent
ae2bb93ea7
commit
7587e02aff
5 changed files with 14 additions and 14 deletions
|
|
@ -42,17 +42,17 @@ impl Page {
|
||||||
action_update: Arc<SimpleAction>,
|
action_update: Arc<SimpleAction>,
|
||||||
) -> Page {
|
) -> Page {
|
||||||
// Init actions
|
// Init actions
|
||||||
let action_open = Arc::new(SimpleAction::new(
|
let action_page_open = Arc::new(SimpleAction::new(
|
||||||
"open",
|
"open",
|
||||||
Some(&String::static_variant_type()),
|
Some(&String::static_variant_type()),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Init action group
|
// Init action group
|
||||||
let action_group = SimpleActionGroup::new();
|
let action_group = SimpleActionGroup::new();
|
||||||
action_group.add_action(action_open.as_ref());
|
action_group.add_action(action_page_open.as_ref());
|
||||||
|
|
||||||
// Init components
|
// Init components
|
||||||
let content = Arc::new(Content::new(action_open.clone()));
|
let content = Arc::new(Content::new(action_page_open.clone()));
|
||||||
let navigation = Arc::new(Navigation::new(
|
let navigation = Arc::new(Navigation::new(
|
||||||
navigation_request_text,
|
navigation_request_text,
|
||||||
action_tab_page_reload.clone(),
|
action_tab_page_reload.clone(),
|
||||||
|
|
@ -74,7 +74,7 @@ impl Page {
|
||||||
let meta = Arc::new(RefCell::new(Meta::new()));
|
let meta = Arc::new(RefCell::new(Meta::new()));
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
action_open.connect_activate({
|
action_page_open.connect_activate({
|
||||||
let navigation = navigation.clone();
|
let navigation = navigation.clone();
|
||||||
move |_, request| {
|
move |_, request| {
|
||||||
let uri = request
|
let uri = request
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,15 @@ pub struct Content {
|
||||||
// GTK
|
// GTK
|
||||||
widget: Box,
|
widget: Box,
|
||||||
// Actions
|
// Actions
|
||||||
action_open: Arc<SimpleAction>,
|
action_page_open: Arc<SimpleAction>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Content {
|
impl Content {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(action_open: Arc<SimpleAction>) -> Self {
|
pub fn new(action_page_open: Arc<SimpleAction>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
widget: Box::builder().orientation(Orientation::Vertical).build(),
|
widget: Box::builder().orientation(Orientation::Vertical).build(),
|
||||||
action_open,
|
action_page_open,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ impl Content {
|
||||||
// Re-compose
|
// Re-compose
|
||||||
match mime {
|
match mime {
|
||||||
Mime::TextGemini => {
|
Mime::TextGemini => {
|
||||||
let child = Text::gemini(data, base, self.action_open.clone());
|
let child = Text::gemini(data, base, self.action_page_open.clone());
|
||||||
|
|
||||||
self.widget.append(child.widget());
|
self.widget.append(child.widget());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ pub struct Text {
|
||||||
|
|
||||||
impl Text {
|
impl Text {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn gemini(gemtext: &str, base: &Uri, action_open: Arc<SimpleAction>) -> Self {
|
pub fn gemini(gemtext: &str, base: &Uri, action_page_open: Arc<SimpleAction>) -> Self {
|
||||||
// Init components
|
// Init components
|
||||||
let gemini = Gemini::new(gemtext, base, action_open);
|
let gemini = Gemini::new(gemtext, base, action_page_open);
|
||||||
|
|
||||||
// Init meta
|
// Init meta
|
||||||
let meta = Meta {
|
let meta = Meta {
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ pub struct Gemini {
|
||||||
|
|
||||||
impl Gemini {
|
impl Gemini {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(gemtext: &str, base: &Uri, action_open: Arc<SimpleAction>) -> Self {
|
pub fn new(gemtext: &str, base: &Uri, action_page_open: Arc<SimpleAction>) -> Self {
|
||||||
// Init components
|
// Init components
|
||||||
let reader = Reader::new(gemtext, base, action_open);
|
let reader = Reader::new(gemtext, base, action_page_open);
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = Viewport::builder().scroll_to_focus(false).build();
|
let widget = Viewport::builder().scroll_to_focus(false).build();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ pub struct Reader {
|
||||||
|
|
||||||
impl Reader {
|
impl Reader {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(gemtext: &str, base: &Uri, action_open: Arc<SimpleAction>) -> Self {
|
pub fn new(gemtext: &str, base: &Uri, action_page_open: Arc<SimpleAction>) -> Self {
|
||||||
// Init title
|
// Init title
|
||||||
let mut title = None;
|
let mut title = None;
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ impl Reader {
|
||||||
return match uri.scheme().as_str() {
|
return match uri.scheme().as_str() {
|
||||||
"gemini" => {
|
"gemini" => {
|
||||||
// Open new page
|
// Open new page
|
||||||
action_open.activate(Some(&uri.to_str().to_variant()));
|
action_page_open.activate(Some(&uri.to_str().to_variant()));
|
||||||
|
|
||||||
// Prevent link open in external application
|
// Prevent link open in external application
|
||||||
Propagation::Stop
|
Propagation::Stop
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue