remove extra function

This commit is contained in:
yggverse 2025-03-25 19:21:04 +02:00
parent 719c25e126
commit 22efd3ef9d

View file

@ -234,21 +234,6 @@ impl Dialog for PreferencesDialog {
.icon_name("system-run-symbolic") .icon_name("system-run-symbolic")
.build(); .build();
p.add(&{ p.add(&{
use gtk::{Align, Label};
/// Right (prefix) widget
fn r(c: i64) -> Label {
Label::builder()
.css_classes(["flat", if c == 0 { "success" } else { "warning" }])
.halign(Align::End)
.label(if c > 0 {
format!("+{c} ms")
} else {
c.to_string()
})
.sensitive(false)
.valign(Align::Center)
.build()
}
let g = PreferencesGroup::new(); let g = PreferencesGroup::new();
let e = &info.event[0]; let e = &info.event[0];
let t = e.time(); let t = e.time();
@ -263,6 +248,8 @@ impl Dialog for PreferencesDialog {
); );
for (i, e) in info.event[1..].iter().enumerate() { for (i, e) in info.event[1..].iter().enumerate() {
g.add(&{ g.add(&{
use gtk::{Align, Label};
let c = e.time().difference(info.event[i].time()).as_milliseconds();
let a = ActionRow::builder() let a = ActionRow::builder()
.use_markup(true) .use_markup(true)
.subtitle(gformat!( .subtitle(gformat!(
@ -273,10 +260,22 @@ impl Dialog for PreferencesDialog {
.title_selectable(true) .title_selectable(true)
.title(e.name()) .title(e.name())
.build(); .build();
a.add_suffix(&r(e a.add_suffix(
.time() &Label::builder()
.difference(info.event[i].time()) .css_classes([
.as_milliseconds())); "flat",
if c == 0 { "success" } else { "warning" },
])
.halign(Align::End)
.label(if c > 0 {
format!("+{c} ms")
} else {
c.to_string()
})
.sensitive(false)
.valign(Align::Center)
.build(),
);
a a
}) })
} }