mirror of https://github.com/YGGverse/Yoda.git
yggverse
1 month ago
5 changed files with 74 additions and 126 deletions
@ -1,31 +1,13 @@
@@ -1,31 +1,13 @@
|
||||
use adw::StatusPage; |
||||
|
||||
const DEFAULT_TITLE: &str = "Oops"; |
||||
const DEFAULT_DESCRIPTION: Option<&str> = None; |
||||
const DEFAULT_ICON_NAME: Option<&str> = Some("dialog-error"); |
||||
|
||||
/// Create new `GObject` preset for failure [StatusPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.StatusPage.html)
|
||||
pub fn new_gobject_from( |
||||
title: Option<&str>, |
||||
description: Option<&str>, |
||||
icon_name: Option<&str>, |
||||
) -> StatusPage { |
||||
let gobject = StatusPage::new(); |
||||
|
||||
gobject.set_title(match title { |
||||
Some(value) => value, |
||||
None => DEFAULT_TITLE, |
||||
}); |
||||
|
||||
gobject.set_description(match description { |
||||
Some(value) => Some(value), |
||||
None => DEFAULT_DESCRIPTION, |
||||
}); |
||||
|
||||
gobject.set_icon_name(match icon_name { |
||||
Some(value) => Some(value), |
||||
None => DEFAULT_ICON_NAME, |
||||
}); |
||||
|
||||
gobject |
||||
const DEFAULT_ICON_NAME: &str = "dialog-error"; |
||||
|
||||
/// Create new default `GObject` preset for failure
|
||||
/// [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() |
||||
} |
||||
|
Loading…
Reference in new issue