mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
implement separated mod with options for failure component
This commit is contained in:
parent
1d4a3cbd42
commit
931dc1cfc2
5 changed files with 92 additions and 26 deletions
|
|
@ -1,15 +1,20 @@
|
|||
mod widget;
|
||||
use widget::Widget;
|
||||
|
||||
use adw::StatusPage;
|
||||
|
||||
pub struct Failure {
|
||||
// nothing yet..
|
||||
widget: Widget,
|
||||
}
|
||||
|
||||
impl Failure {
|
||||
pub fn new(title: &str, description: &str) -> StatusPage {
|
||||
StatusPage::builder()
|
||||
.description(description)
|
||||
.icon_name("dialog-error-symbolic")
|
||||
.title(title)
|
||||
.build()
|
||||
pub fn new(title: Option<&str>, description: Option<&str>) -> Self {
|
||||
Self {
|
||||
widget: Widget::new(title, description),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gobject(&self) -> &StatusPage {
|
||||
&self.widget.gobject()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
use adw::StatusPage;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: StatusPage,
|
||||
}
|
||||
|
||||
impl Widget {
|
||||
// Constructors
|
||||
|
||||
/// Create new default widget configuration
|
||||
pub fn new(title: Option<&str>, description: Option<&str>) -> Self {
|
||||
let gobject = StatusPage::new();
|
||||
|
||||
if let Some(value) = title {
|
||||
gobject.set_title(value);
|
||||
}
|
||||
|
||||
gobject.set_description(description);
|
||||
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
||||
pub fn gobject(&self) -> &StatusPage {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue