1
slint::include_modules!();
2

            
3
/// Shows a standard error dialog with the given title and message, blocking
4
/// input until closed or "ok" is pressed.
5
pub fn show_error_dialog(title: &str, message: &str) {
6
    let dialog = ErrorDialog::new().unwrap();
7
    dialog.set_error_title(title.into());
8
    dialog.set_error_text(message.into());
9

            
10
    // Hide the dialog when the Ok button was pressed.
11
    {
12
        let weak_dialog = dialog.as_weak();
13
        dialog.on_ok_clicked(move || {
14
            if let Some(dialog) = &weak_dialog.upgrade() {
15
                dialog.hide().unwrap();
16
            }
17
        })
18
    }
19

            
20
    dialog.show().unwrap();
21
}