mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-24 10:04:16 +00:00
rename actions
This commit is contained in:
parent
b2237879be
commit
7da4d617da
@ -189,7 +189,7 @@ impl Page {
|
||||
let description = gformat!("Protocol `{scheme}` not supported");
|
||||
|
||||
// Update widget
|
||||
self.content.set_status_failure(
|
||||
self.content.to_status_failure(
|
||||
Some(title.as_str()),
|
||||
Some(description.as_str()),
|
||||
None,
|
||||
@ -495,7 +495,7 @@ impl Page {
|
||||
match result {
|
||||
Ok(buffer) => {
|
||||
// Set children component
|
||||
let text_gemini = content.set_text_gemini(
|
||||
let text_gemini = content.to_text_gemini(
|
||||
&uri,
|
||||
&buffer.data()
|
||||
);
|
||||
@ -524,7 +524,7 @@ impl Page {
|
||||
};
|
||||
|
||||
// Update widget
|
||||
content.set_status_failure(
|
||||
content.to_status_failure(
|
||||
Some(title.as_str()),
|
||||
Some(description.as_str()),
|
||||
None
|
||||
@ -550,7 +550,7 @@ impl Page {
|
||||
gemini::client::response::meta::Mime::ImageWebp
|
||||
=> {
|
||||
// Final image size unknown, show loading widget
|
||||
let status = content.set_status_loading(
|
||||
let status = content.to_status_loading(
|
||||
Some(&"Loading.."),
|
||||
None,
|
||||
Some(Duration::from_secs(1)) // show if download time > 1 second
|
||||
@ -583,7 +583,7 @@ impl Page {
|
||||
meta.borrow_mut().title = Some(uri_to_title(&uri));
|
||||
|
||||
// Update page content
|
||||
content.set_image(&buffer);
|
||||
content.to_image(&buffer);
|
||||
|
||||
// Update window components
|
||||
action_update.activate(Some(&id));
|
||||
@ -594,7 +594,7 @@ impl Page {
|
||||
let title = gformat!("Oops");
|
||||
|
||||
// Update widget
|
||||
content.set_status_failure(
|
||||
content.to_status_failure(
|
||||
Some(title.as_str()),
|
||||
Some(reason.message()),
|
||||
None
|
||||
@ -623,7 +623,7 @@ impl Page {
|
||||
};
|
||||
|
||||
// Update widget
|
||||
content.set_status_failure(
|
||||
content.to_status_failure(
|
||||
Some(title.as_str()),
|
||||
Some(description.as_str()),
|
||||
None
|
||||
@ -648,7 +648,7 @@ impl Page {
|
||||
meta.borrow_mut().title = Some(gformat!("Stream"));
|
||||
|
||||
// Update page content
|
||||
// content.set_stream();
|
||||
// content.to_stream();
|
||||
|
||||
// Update window components
|
||||
action_update.activate(Some(&id));
|
||||
@ -660,7 +660,7 @@ impl Page {
|
||||
let description = gformat!("Content type not supported");
|
||||
|
||||
// Update widget
|
||||
content.set_status_failure(
|
||||
content.to_status_failure(
|
||||
Some(title.as_str()),
|
||||
Some(description.as_str()),
|
||||
None
|
||||
@ -690,13 +690,13 @@ impl Page {
|
||||
// Build gemtext message for manual redirection @TODO use template?
|
||||
match response.data().value() {
|
||||
Some(url) => {
|
||||
content.set_text_gemini(
|
||||
content.to_text_gemini(
|
||||
&uri,
|
||||
&gformat!("# Redirect\n\nAuto-follow not implemented, click on link below to continue\n\n=> {url}")
|
||||
);
|
||||
},
|
||||
None => {
|
||||
content.set_status_failure(
|
||||
content.to_status_failure(
|
||||
Some(&"Oops"),
|
||||
Some(&"Could not parse redirect meta"),
|
||||
None
|
||||
@ -760,7 +760,7 @@ impl Page {
|
||||
};
|
||||
|
||||
// Update widget
|
||||
content.set_status_failure(
|
||||
content.to_status_failure(
|
||||
Some(title.as_str()),
|
||||
Some(description.as_str()),
|
||||
None
|
||||
@ -785,7 +785,7 @@ impl Page {
|
||||
let title = gformat!("Oops");
|
||||
|
||||
// Update widget
|
||||
content.set_status_failure(
|
||||
content.to_status_failure(
|
||||
Some(title.as_str()),
|
||||
Some(reason.message()),
|
||||
None
|
||||
@ -809,7 +809,7 @@ impl Page {
|
||||
let title = gformat!("Oops");
|
||||
|
||||
// Update widget
|
||||
content.set_status_failure(
|
||||
content.to_status_failure(
|
||||
Some(title.as_str()),
|
||||
Some(reason.message()),
|
||||
None
|
||||
|
@ -40,7 +40,7 @@ impl Content {
|
||||
/// Set new `content::Image` component for `Self`
|
||||
///
|
||||
/// * action removes previous children component from `Self`
|
||||
pub fn set_image(&self, buffer: &Pixbuf) -> Image {
|
||||
pub fn to_image(&self, buffer: &Pixbuf) -> Image {
|
||||
self.clean();
|
||||
let image = Image::new_from_pixbuf(buffer);
|
||||
self.gobject.append(image.gobject());
|
||||
@ -50,7 +50,7 @@ impl Content {
|
||||
/// Set new `content::Status` component for `Self` with new `status::Failure` preset
|
||||
///
|
||||
/// * action removes previous children component from `Self`
|
||||
pub fn set_status_failure(
|
||||
pub fn to_status_failure(
|
||||
&self,
|
||||
title: Option<&str>,
|
||||
description: Option<&str>,
|
||||
@ -65,7 +65,7 @@ impl Content {
|
||||
/// Set new `content::Status` component for `Self` with new `status::Loading` preset
|
||||
///
|
||||
/// * action removes previous children component from `Self`
|
||||
pub fn set_status_loading(
|
||||
pub fn to_status_loading(
|
||||
&self,
|
||||
title: Option<&str>,
|
||||
description: Option<&str>,
|
||||
@ -92,7 +92,7 @@ impl Content {
|
||||
///
|
||||
/// `Text` component with it public API
|
||||
/// * could be useful to extract document title parsed from Gemtext
|
||||
pub fn set_text_gemini(&self, base: &Uri, data: &str) -> Text {
|
||||
pub fn to_text_gemini(&self, base: &Uri, data: &str) -> Text {
|
||||
self.clean();
|
||||
let text = Text::gemini(
|
||||
data,
|
||||
|
Loading…
x
Reference in New Issue
Block a user