Implement Driftwood AppImage manager
This commit is contained in:
24
src/ui/widgets.rs
Normal file
24
src/ui/widgets.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use gtk::prelude::*;
|
||||
|
||||
/// Create a status badge pill label with the given text and style class.
|
||||
/// Style classes: "success", "warning", "error", "info", "neutral"
|
||||
pub fn status_badge(text: &str, style_class: &str) -> gtk::Label {
|
||||
let label = gtk::Label::new(Some(text));
|
||||
label.add_css_class("status-badge");
|
||||
label.add_css_class(style_class);
|
||||
label
|
||||
}
|
||||
|
||||
/// Create a badge showing integration status.
|
||||
pub fn integration_badge(integrated: bool) -> gtk::Label {
|
||||
if integrated {
|
||||
status_badge("Integrated", "success")
|
||||
} else {
|
||||
status_badge("Not integrated", "neutral")
|
||||
}
|
||||
}
|
||||
|
||||
/// Format bytes into a human-readable string.
|
||||
pub fn format_size(bytes: i64) -> String {
|
||||
humansize::format_size(bytes as u64, humansize::BINARY)
|
||||
}
|
||||
Reference in New Issue
Block a user