mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-09-05 19:31:57 +00:00
draft redirection chain widget
This commit is contained in:
parent
96230ee476
commit
97b22fd09c
@ -106,6 +106,10 @@ impl Info {
|
||||
|
||||
// Getters
|
||||
|
||||
pub fn request(&self) -> Option<&str> {
|
||||
self.request.as_deref()
|
||||
}
|
||||
|
||||
pub fn matches(&self, request: &str) -> bool {
|
||||
self.request.as_ref().is_some_and(|r| r == request)
|
||||
}
|
||||
|
@ -55,14 +55,25 @@ impl Dialog for PreferencesDialog {
|
||||
} // @TODO header size, total size, etc.
|
||||
p
|
||||
});
|
||||
if let Some(ref redirect) = info.redirect {
|
||||
if info.redirect.is_some() {
|
||||
d.add(&{
|
||||
PreferencesPage::builder()
|
||||
let g = PreferencesGroup::new();
|
||||
let p = PreferencesPage::builder()
|
||||
.title("Redirect")
|
||||
.icon_name("insert-link-symbolic")
|
||||
.build()
|
||||
});
|
||||
// @TODO recursive lookup
|
||||
.build();
|
||||
p.add(&{
|
||||
fn chain(g: &PreferencesGroup, i: &Info) {
|
||||
g.add(&ActionRow::builder().title(i.request().unwrap()).build());
|
||||
if let Some(ref r) = i.redirect {
|
||||
chain(g, r)
|
||||
}
|
||||
}
|
||||
chain(&g, info);
|
||||
g
|
||||
});
|
||||
p
|
||||
}) // @TODO reverse, time total
|
||||
}
|
||||
if !info.event.is_empty() {
|
||||
d.add(&{
|
||||
@ -75,24 +86,22 @@ impl Dialog for PreferencesDialog {
|
||||
let e = &info.event[0];
|
||||
let t = e.time();
|
||||
let n = e.name();
|
||||
g.add(&{
|
||||
let r = ActionRow::builder()
|
||||
g.add(
|
||||
&ActionRow::builder()
|
||||
.subtitle(t.format_iso8601().unwrap())
|
||||
.title(n)
|
||||
.build();
|
||||
r
|
||||
});
|
||||
.build(),
|
||||
);
|
||||
for e in &info.event[1..] {
|
||||
g.add(&{
|
||||
let r = ActionRow::builder()
|
||||
g.add(
|
||||
&ActionRow::builder()
|
||||
.subtitle(gtk::glib::gformat!(
|
||||
"{} ms",
|
||||
e.time().difference(t).as_milliseconds()
|
||||
))
|
||||
.title(e.name())
|
||||
.build();
|
||||
r
|
||||
})
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
g
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user