blob: 5094a073f4ba9fddd591b371952d31d3118f012e (
plain) (
blame)
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
|
#[cfg(feature = "notifications")]
use log::*;
pub fn init() {
#[cfg(feature = "notifications")]
if let Err(e) = libnotify::init("mumd") {
warn!("Unable to initialize notifications: {}", e);
}
}
#[cfg(feature = "notifications")]
pub fn send(msg: String) -> Option<bool> {
match libnotify::Notification::new("mumd", Some(msg.as_str()), None).show() {
Ok(_) => Some(true),
Err(e) => {
warn!("Unable to send notification: {}", e);
Some(false)
}
}
}
#[cfg(not(feature = "notifications"))]
pub fn send(_: String) -> Option<bool> {
None
}
|