#[cfg(target_os = "linux")]
#[cfg(not(windows))]
extern crate gtk;
#[cfg(target_os = "linux")]
#[cfg(not(windows))]
use gtk::prelude::*;
#[cfg(target_os = "linux")]
#[cfg(not(windows))]
use gtk::{ButtonsType, DialogFlags, MessageDialog, MessageType};
#[cfg(target_os = "linux")]
#[cfg(not(windows))]
struct LinuxAlert<'a> {
body: & 'a str,
}
#[cfg(target_os = "linux")]
#[cfg(not(windows))]
impl <'a>LinuxAlert<'a> {
fn new() -> LinuxAlert<'a> {
LinuxAlert { body: ""}
}
fn dialog_info(body: & 'a str) -> LinuxAlert<'a> {
gtk::init().expect("Error: Failed to initialize GTK.");
let dialog = MessageDialog::new(None::<>k::Window>,
DialogFlags::MODAL,
MessageType::Info,
ButtonsType::Ok,
body,);
dialog.set_title("Message Alert");
dialog.connect_response(|dialog, _| {
dialog.close(); gtk::main_quit();
});
dialog.show_all();
gtk::main();
LinuxAlert{ body }
}
fn dialog_error(body: & 'a str) -> LinuxAlert<'a> {
gtk::init().expect("Error: Failed to initialize GTK.");
let dialog = MessageDialog::new(None::<>k::Window>,
DialogFlags::MODAL,
MessageType::Error,
ButtonsType::Ok,
body,);
dialog.set_title("Menssage Critical Error");
dialog.connect_response(|dialog, _| {
dialog.close(); gtk::main_quit();
});
dialog.show_all();
gtk::main();
LinuxAlert{ body }
}
}