mod common;

fn main() {
    if !common::setup(file!()) {
        return;
    }
    use notify_rust::{Notification, Timeout};

    Notification::new()
        .summary("click me")
        .body("This will disappear by itself")
        .action("clicked_a", "action") // IDENTIFIER, LABEL
        // .hint(Hint::Transient(true)) // needed to work on kde
        .show()
        .unwrap()
        .wait_for_action(|action| match action {
            "clicked_a" => log::info!("clicked \"action\""),
            // you don't have to match for this string if you use `wait_for_response` instead
            "__closed" => log::info!("the notification was closed"),
            _ => (),
        });

    Notification::new()
        .summary("click me")
        .body("This action needs to be clicked")
        .action("default", "default") // IDENTIFIER, LABEL
        .action("clicked_a", "button a") // IDENTIFIER, LABEL
        .action("clicked_b", "button b") // IDENTIFIER, LABEL
        .timeout(Timeout::Never) // works on kde and gnome
        .show()
        .unwrap()
        .wait_for_action(|action| match action {
            "default" => log::info!("default"),
            "clicked_a" => log::info!("clicked a"),
            "clicked_b" => log::info!("clicked b"),
            "__closed" => log::info!("the notification was closed"),
            _ => (),
        });
}
