2015-03-10 07:46:54 +00:00
|
|
|
//! Rustic bindings to [libnotify](https://developer.gnome.org/libnotify/)
|
|
|
|
//!
|
|
|
|
//! ```rust
|
2015-11-03 08:15:16 +00:00
|
|
|
//! extern crate libnotify;
|
2015-11-02 23:50:27 +00:00
|
|
|
//!
|
2015-11-03 08:15:16 +00:00
|
|
|
//! fn main() {
|
2017-07-09 23:09:21 +00:00
|
|
|
//! // Init libnotify
|
|
|
|
//! libnotify::init("myapp").unwrap();
|
2017-07-11 12:36:21 +00:00
|
|
|
//! // Create a new notification (doesn't show it yet)
|
2017-07-09 23:09:21 +00:00
|
|
|
//! let n = libnotify::Notification::new("Summary",
|
|
|
|
//! Some("Optional Body"),
|
2017-07-10 21:21:16 +00:00
|
|
|
//! None);
|
2017-07-09 23:09:21 +00:00
|
|
|
//! // Show the notification
|
2015-11-03 09:06:33 +00:00
|
|
|
//! n.show().unwrap();
|
2017-07-11 13:18:40 +00:00
|
|
|
//! // Update the existent notification
|
2017-07-09 23:09:21 +00:00
|
|
|
//! n.update("I am another notification", None, None).unwrap();
|
2017-07-11 13:18:40 +00:00
|
|
|
//! // Show the updated notification
|
2017-07-09 23:09:21 +00:00
|
|
|
//! n.show().unwrap();
|
|
|
|
//! // We are done, deinit
|
|
|
|
//! libnotify::uninit();
|
2015-11-03 08:15:16 +00:00
|
|
|
//! }
|
2015-03-10 07:46:54 +00:00
|
|
|
//!
|
|
|
|
//! ```
|
|
|
|
|
2015-11-02 23:51:20 +00:00
|
|
|
#![warn(missing_docs)]
|
|
|
|
|
2017-07-09 17:33:13 +00:00
|
|
|
extern crate gdk_pixbuf;
|
2017-07-10 21:21:16 +00:00
|
|
|
#[macro_use]
|
2017-07-09 12:23:37 +00:00
|
|
|
extern crate glib;
|
2017-07-10 21:21:16 +00:00
|
|
|
extern crate glib_sys as glib_ffi;
|
|
|
|
extern crate gobject_sys as gobject_ffi;
|
|
|
|
extern crate libnotify_sys as ffi;
|
2015-03-07 12:55:19 +00:00
|
|
|
|
2017-07-09 23:01:36 +00:00
|
|
|
|
2017-07-10 21:21:16 +00:00
|
|
|
pub use enums::*;
|
|
|
|
pub use functions::*;
|
|
|
|
pub use notification::*;
|
2017-07-09 23:01:36 +00:00
|
|
|
|
|
|
|
|
2017-07-10 21:21:16 +00:00
|
|
|
macro_rules! assert_initialized_libnotify {
|
2017-07-09 23:01:36 +00:00
|
|
|
() => {
|
2017-07-10 21:21:16 +00:00
|
|
|
use functions::*;
|
2017-07-09 23:01:36 +00:00
|
|
|
if !is_initted() {
|
|
|
|
panic!("Notify system not initialized, invalid call of function");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-07-09 12:25:30 +00:00
|
|
|
|
2015-03-07 12:55:19 +00:00
|
|
|
|
2017-07-10 21:21:16 +00:00
|
|
|
mod enums;
|
|
|
|
mod functions;
|
|
|
|
mod notification;
|