better error popup

This commit is contained in:
Max Bradbury 2020-10-04 12:28:28 +01:00
parent b281f8af00
commit 0afc497f78
2 changed files with 4 additions and 11 deletions

View File

@ -9,6 +9,7 @@ crate_type = "bin"
[dependencies] [dependencies]
dirs = "^3.0.1" dirs = "^3.0.1"
gdk = "^0.13.2"
gio = "^0" gio = "^0"
gtk = "^0" gtk = "^0"
rodio = "^0.11.0" rodio = "^0.11.0"

View File

@ -28,21 +28,13 @@ fn error_popup(message: &str) {
popup.set_border_width(SPACING as u32); popup.set_border_width(SPACING as u32);
popup.set_position(gtk::WindowPosition::Center); popup.set_position(gtk::WindowPosition::Center);
popup.set_default_size(256, 64); popup.set_default_size(256, 64);
popup.set_type_hint(gdk::WindowTypeHint::Dialog);
let vertical = gtk::Box::new(Orientation::Vertical, SPACING); popup.set_resizable(false);
popup.add(&vertical);
let message = gtk::Label::new(Some(message)); let message = gtk::Label::new(Some(message));
vertical.add(&message); popup.add(&message);
let button_ok = gtk::Button::with_label("OK");
vertical.add(&button_ok);
popup.show_all(); popup.show_all();
button_ok.connect_clicked(move |_| unsafe {
popup.destroy();
});
} }
fn get_data_dir() -> PathBuf { fn get_data_dir() -> PathBuf {