update construction api

This commit is contained in:
yggverse 2024-11-01 01:04:59 +02:00
parent dcb4eacb7f
commit cb651496fd
5 changed files with 73 additions and 125 deletions

View file

@ -14,38 +14,38 @@ impl Status {
/// Create new failure preset
///
/// Useful as placeholder widget for error handlers
pub fn new_failure(
title: Option<&str>,
description: Option<&str>,
icon_name: Option<&str>,
) -> Self {
pub fn new_failure() -> Self {
Self {
gobject: failure::new_gobject_from(title, description, icon_name),
gobject: failure::new_gobject(),
}
}
/// Create new loading preset
///
/// Useful as placeholder widget for async operations
pub fn new_loading(
title: Option<&str>,
description: Option<&str>,
show_with_delay: Option<Duration>,
) -> Self {
pub fn new_loading(show_with_delay: Option<Duration>) -> Self {
Self {
gobject: loading::new_gobject_from(title, description, show_with_delay),
gobject: loading::new_gobject(show_with_delay),
}
}
// Setters
/// Set new description for status component
/// Set new title for `Self`
///
/// Return `Self` reference to apply another functions in chain
pub fn set_title(&self, value: &str) -> &Self {
self.gobject.set_title(value);
&self
}
/// Set new description for `Self`
///
/// Useful for loading widgets to update byte totals and other dynamically changed information
///
/// Return `Self` reference to apply another functions in chain
pub fn set_description(&self, description: Option<&str>) -> &Self {
self.gobject.set_description(description);
pub fn set_description(&self, value: Option<&str>) -> &Self {
self.gobject.set_description(value);
&self
}