confirmation dialog added.

This commit is contained in:
Martin Brodbeck 2021-02-02 09:52:50 +01:00
parent fca2e0a993
commit 637d0ffc74
2 changed files with 25 additions and 3 deletions

View file

@ -12,7 +12,7 @@ pub enum Icon {
WLan,
}
pub fn dialog(icon: Icon, text: &str) {
pub fn dialog(icon: Icon, text: &str, buttons: &[&str]) -> i32 {
let iconstr = match icon {
Icon::None => "0",
Icon::Info => "1",
@ -22,8 +22,10 @@ pub fn dialog(icon: Icon, text: &str) {
Icon::WLan => "5",
};
Command::new(DIALOG_PATH)
.args(&[iconstr, "", text, "OK"])
let res = Command::new(DIALOG_PATH)
.args([&[iconstr, "", text], buttons].concat())
.output()
.unwrap();
res.status.code().unwrap_or(-1)
}