diff --git a/src/app/browser/window/tab/item/page/content.rs b/src/app/browser/window/tab/item/page/content.rs index 23660727..a7c9f9cc 100644 --- a/src/app/browser/window/tab/item/page/content.rs +++ b/src/app/browser/window/tab/item/page/content.rs @@ -71,6 +71,16 @@ impl Content { status } + /// Set new `content::Status` component for `Self` with new `status::Mime` issue preset + /// + /// * action removes previous children component from `Self` + pub fn to_status_mime(&self) -> Status { + self.clean(); + let status = Status::new_mime(); + self.gobject.append(status.gobject()); + status + } + /// Set new `content::Status` component for `Self` with new `status::Identity` preset /// /// * action removes previous children component from `Self` diff --git a/src/app/browser/window/tab/item/page/content/status.rs b/src/app/browser/window/tab/item/page/content/status.rs index 17119b43..1c794b42 100644 --- a/src/app/browser/window/tab/item/page/content/status.rs +++ b/src/app/browser/window/tab/item/page/content/status.rs @@ -2,6 +2,7 @@ pub mod download; mod failure; mod identity; mod loading; +mod mime; use adw::StatusPage; use gtk::gio::{Cancellable, File}; @@ -34,6 +35,15 @@ impl Status { } } + /// Create new mime issue preset + /// + /// Useful as placeholder widget for mime issue handlers + pub fn new_mime() -> Self { + Self { + gobject: mime::new_gobject(), + } + } + /// Create new identity preset /// /// Useful as placeholder for 60 status code diff --git a/src/app/browser/window/tab/item/page/content/status/mime.rs b/src/app/browser/window/tab/item/page/content/status/mime.rs new file mode 100644 index 00000000..ae8e0127 --- /dev/null +++ b/src/app/browser/window/tab/item/page/content/status/mime.rs @@ -0,0 +1,13 @@ +use adw::StatusPage; + +const DEFAULT_TITLE: &str = "Oops"; +const DEFAULT_ICON_NAME: &str = "help-contents-symbolic"; + +/// Create new default `GObject` preset for mime issue +/// [StatusPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.StatusPage.html) +pub fn new_gobject() -> StatusPage { + StatusPage::builder() + .title(DEFAULT_TITLE) + .icon_name(DEFAULT_ICON_NAME) + .build() +}