mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 10:41:03 +02:00
feat(custom): support dynamic strings on buttons
This commit is contained in:
parent
72b14b6c4e
commit
a9d1233909
1 changed files with 4 additions and 4 deletions
|
@ -28,12 +28,12 @@ impl CustomWidget for ButtonWidget {
|
||||||
if let Some(text) = self.label {
|
if let Some(text) = self.label {
|
||||||
let label = Label::new(None);
|
let label = Label::new(None);
|
||||||
label.set_use_markup(true);
|
label.set_use_markup(true);
|
||||||
label.set_markup(&text);
|
|
||||||
button.add(&label);
|
button.add(&label);
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(class) = self.class {
|
DynamicString::new(&text, move |string| {
|
||||||
button.style_context().add_class(&class);
|
label.set_markup(&string);
|
||||||
|
Continue(true)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(exec) = self.on_click {
|
if let Some(exec) = self.on_click {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue