Add Notification::set_notification_timeout()

This commit is contained in:
Julian Ospald 2017-07-09 14:21:31 +02:00
parent 923c801814
commit 8c66220a4e
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 14 additions and 1 deletions

View File

@ -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"

View File

@ -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.