Browse Source

add custom failure icons support

master
yggverse 1 month ago
parent
commit
ae1d3531bf
  1. 29
      src/app/browser/window/tab/item/page.rs
  2. 9
      src/app/browser/window/tab/item/page/content.rs
  3. 10
      src/app/browser/window/tab/item/page/content/status.rs

29
src/app/browser/window/tab/item/page.rs

@ -189,8 +189,11 @@ impl Page { @@ -189,8 +189,11 @@ impl Page {
let description = gformat!("Protocol `{scheme}` not supported");
// Update widget
self.content
.set_status_failure(Some(title.as_str()), Some(description.as_str()));
self.content.set_status_failure(
Some(title.as_str()),
Some(description.as_str()),
None,
);
// Update meta
self.meta.replace(Meta {
@ -523,7 +526,8 @@ impl Page { @@ -523,7 +526,8 @@ impl Page {
// Update widget
content.set_status_failure(
Some(title.as_str()),
Some(description.as_str())
Some(description.as_str()),
None
);
// Update meta
@ -593,7 +597,8 @@ impl Page { @@ -593,7 +597,8 @@ impl Page {
// Update widget
content.set_status_failure(
Some(title.as_str()),
Some(description.as_str())
Some(description.as_str()),
None
);
// Update meta
@ -622,7 +627,8 @@ impl Page { @@ -622,7 +627,8 @@ impl Page {
// Update widget
content.set_status_failure(
Some(title.as_str()),
Some(description.as_str())
Some(description.as_str()),
None
);
// Update meta
@ -660,6 +666,7 @@ impl Page { @@ -660,6 +666,7 @@ impl Page {
content.set_status_failure(
Some(title.as_str()),
Some(description.as_str()),
None
);
// Update meta
@ -695,7 +702,8 @@ impl Page { @@ -695,7 +702,8 @@ impl Page {
None => {
content.set_status_failure(
Some(&"Oops"),
Some(&"Could not parse redirect meta")
Some(&"Could not parse redirect meta"),
None
);
},
}
@ -758,7 +766,8 @@ impl Page { @@ -758,7 +766,8 @@ impl Page {
// Update widget
content.set_status_failure(
Some(title.as_str()),
Some(description.as_str())
Some(description.as_str()),
None
);
// Update meta
@ -783,7 +792,8 @@ impl Page { @@ -783,7 +792,8 @@ impl Page {
// Update widget
content.set_status_failure(
Some(title.as_str()),
Some(description.as_str())
Some(description.as_str()),
None
);
// Update meta
@ -808,7 +818,8 @@ impl Page { @@ -808,7 +818,8 @@ impl Page {
// Update widget
content.set_status_failure(
Some(title.as_str()),
Some(description.as_str())
Some(description.as_str()),
None
);
// Update meta

9
src/app/browser/window/tab/item/page/content.rs

@ -50,9 +50,14 @@ impl Content { @@ -50,9 +50,14 @@ 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(&self, title: Option<&str>, description: Option<&str>) -> Status {
pub fn set_status_failure(
&self,
title: Option<&str>,
description: Option<&str>,
icon_name: Option<&str>,
) -> Status {
self.clean();
let status = Status::new_failure(title, description);
let status = Status::new_failure(title, description, icon_name);
self.gobject.append(status.gobject());
status
}

10
src/app/browser/window/tab/item/page/content/status.rs

@ -17,9 +17,15 @@ impl Status { @@ -17,9 +17,15 @@ impl Status {
/// Create new failure preset
///
/// Useful as placeholder widget for error handlers
pub fn new_failure(title: Option<&str>, description: Option<&str>) -> Self {
pub fn new_failure(
title: Option<&str>,
description: Option<&str>,
icon_name: Option<&str>,
) -> Self {
Self {
gobject: Failure::new(title, description, None).gobject().clone(),
gobject: Failure::new(title, description, icon_name)
.gobject()
.clone(),
}
}

Loading…
Cancel
Save