Codify dialog exit statuses and make them less error-prone
This commit is contained in:
@ -6,6 +6,22 @@ pub mod settings;
|
||||
|
||||
pub const BSCREENSAVER_WM_CLASS: &[u8] = b"bscreensaver\0Bscreensaver\0";
|
||||
|
||||
#[repr(i32)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum DialogExitStatus {
|
||||
AuthFailed = -1,
|
||||
AuthSucceeded = 0,
|
||||
AuthCanceled = 1,
|
||||
AuthTimedOut = 2,
|
||||
OtherError = 3,
|
||||
}
|
||||
|
||||
impl DialogExitStatus {
|
||||
pub fn exit(&self) -> ! {
|
||||
std::process::exit(*self as i32);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init_logging(env_name: &str) {
|
||||
env_logger::builder()
|
||||
.format_timestamp_millis()
|
||||
|
Reference in New Issue
Block a user