PbDbFixer/src/pocketbook.rs

32 lines
632 B
Rust
Raw Permalink Normal View History

2021-01-29 12:47:33 +01:00
use std::process::Command;
static DIALOG_PATH: &str = "/ebrmain/bin/dialog";
#[allow(dead_code)]
pub enum Icon {
None = 0,
Info,
Question,
Attention,
X,
WLan,
}
2021-02-02 09:52:50 +01:00
pub fn dialog(icon: Icon, text: &str, buttons: &[&str]) -> i32 {
2021-01-29 12:47:33 +01:00
let iconstr = match icon {
Icon::None => "0",
Icon::Info => "1",
Icon::Question => "2",
Icon::Attention => "3",
Icon::X => "4",
Icon::WLan => "5",
};
2021-02-02 09:52:50 +01:00
let res = Command::new(DIALOG_PATH)
.args([&[iconstr, "", text], buttons].concat())
2021-01-29 12:47:33 +01:00
.output()
.unwrap();
2021-02-02 09:52:50 +01:00
res.status.code().unwrap_or(-1)
2021-01-29 12:47:33 +01:00
}