add Exit trait to modals

This commit is contained in:
🪞👃🪞 2024-07-12 16:05:16 +03:00
parent 0cc8d88e5f
commit 33e5f47526
6 changed files with 67 additions and 33 deletions

View file

@ -47,7 +47,7 @@ impl AppPaths {
}
}
pub struct SetupModal(pub Option<Arc<XdgApp>>);
pub struct SetupModal(pub Option<Arc<XdgApp>>, pub bool);
render!(SetupModal |self, buf, area| {
for cell in buf.content.iter_mut() {
@ -83,9 +83,17 @@ handle!(SetupModal |self, e| {
..
})) = e {
AppPaths::new(&self.0.as_ref().unwrap())?.create()?;
self.0 = None;
self.exit();
Ok(true)
} else {
Ok(false)
}
});
impl Exit for SetupModal {
fn exited (&self) -> bool {
self.1
}
fn exit (&mut self) {
self.1 = true
}
}