Skip to main content

backend_zenity/
backend-zenity.rs

1// Copyright (C) 2019 Robin Krahl <robin.krahl@ireas.org>
2// SPDX-License-Identifier: MIT
3
4use dialog::backends;
5use dialog::DialogBox;
6
7fn main() -> dialog::Result<()> {
8    let mut backend = backends::Zenity::new();
9
10    dialog::Message::new("This is a message.")
11        .title("And this is a title:")
12        .show_with(&backend)?;
13
14    backend.set_width(500);
15    backend.set_height(200);
16    dialog::Message::new("This is a message with a fixed size.")
17        .title("And this is a title:")
18        .show_with(&backend)?;
19
20    let mut backend = backends::Zenity::new();
21    backend.set_timeout(5);
22    dialog::Message::new("This box should disappear after five seconds.")
23        .title("And this is a title:")
24        .show_with(&backend)
25}