1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
use std::process::Command;
pub fn calender(title: &str) -> String {
match Command::new("zenity")
.args(&["--calendar", "--text=Pick a day" , "--title", title])
.output() {
Ok(success) => String::from_utf8(success.stdout).unwrap(),
Err(error) => error.to_string(),
}
}
pub fn information(info: &str ) -> String {
match Command::new("zenity")
.args(&["--info", "--text", info])
.output() {
Ok(_success) => "Information displayed.".to_string(),
Err(error) => error.to_string(),
}
}
pub fn question(question: &str ) -> String {
match Command::new("zenity")
.args(&["--entry", "--text", question])
.output() {
Ok(success) => String::from_utf8(success.stdout).unwrap(),
Err(error) => error.to_string(),
}
}
pub fn progress() -> String {
match Command::new("zenity")
.args(&["--progress", "--pulsate"])
.output() {
Ok(_success) => "Process complete.".to_string(),
Err(error) => error.to_string(),
}
}
pub fn error(error_message: &str) -> String {
match Command::new("zenity")
.args(&["--error", "--text", error_message])
.output() {
Ok(_success) => "Error displayed.".to_string(),
Err(error) => error.to_string(),
}
}
pub fn warning(message: &str) -> String {
match Command::new("zenity")
.args(&["--warning", "--text", message])
.output() {
Ok(_success) => "Warning displayed.".to_string(),
Err(error) => error.to_string(),
}
}
pub fn file_path() -> String {
match Command::new("zenity")
.args(&["--file-selection"])
.output() {
Ok(success) => String::from_utf8(success.stdout).unwrap(),
Err(error) => error.to_string(),
}
}
pub fn pick_number(title: &str) -> String {
match Command::new("zenity")
.args(&["--scale", "--text", title])
.output() {
Ok(success) => String::from_utf8(success.stdout).unwrap(),
Err(error) => error.to_string(),
}
}