mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
implement tooltip for input counters
This commit is contained in:
parent
afc33c1a03
commit
d1c05b6469
4 changed files with 25 additions and 16 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use gtk::{prelude::WidgetExt, Label};
|
||||
use plurify::Plurify;
|
||||
|
||||
pub struct Counter {
|
||||
pub label: Label,
|
||||
|
|
@ -34,6 +35,11 @@ impl Counter {
|
|||
|
||||
// Toggle visibility on chars left provided
|
||||
self.label.set_visible(!is_empty);
|
||||
|
||||
self.label.set_tooltip_text(Some(&format!(
|
||||
"{value} {} left",
|
||||
(value as usize).plurify(&["byte", "bytes", "bytes"])
|
||||
)));
|
||||
}
|
||||
None => self.label.set_visible(false),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue