Add Notification::set_notification_timeout()
This commit is contained in:
parent
923c801814
commit
8c66220a4e
@ -11,6 +11,6 @@ documentation = "http://crumblingstatue.github.io/doc/libnotify/libnotify/"
|
||||
keywords = ["libnotify", "notification"]
|
||||
|
||||
[dependencies]
|
||||
libnotify-sys = "0.3"
|
||||
libnotify-sys = "^0.5.0"
|
||||
glib-sys = "^0.3.4"
|
||||
gtypes = "^0.2.0"
|
||||
|
13
src/lib.rs
13
src/lib.rs
@ -24,6 +24,7 @@ extern crate glib_sys;
|
||||
extern crate gtypes;
|
||||
|
||||
use std::ffi::{self, CStr, CString};
|
||||
use std::os::raw::c_int;
|
||||
use std::marker::PhantomData;
|
||||
use std::fmt;
|
||||
use std::error::Error;
|
||||
@ -200,6 +201,18 @@ impl<'a> Notification<'a> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Set the notification timeout. Note that the server might ignore
|
||||
/// the timeout.
|
||||
pub fn set_notification_timeout(&self, timeout: i32) {
|
||||
let _timeout: c_int = From::from(timeout);
|
||||
|
||||
unsafe {
|
||||
sys::notify_notification_set_timeout(self.handle,
|
||||
_timeout)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An error that can happen when attempting to show a notification.
|
||||
|
Loading…
Reference in New Issue
Block a user