diff --git a/examples/show.rs b/examples/show.rs index c095343b..77f82fbf 100644 --- a/examples/show.rs +++ b/examples/show.rs @@ -4,9 +4,9 @@ fn main() { // Init libnotify libnotify::init("myapp").unwrap(); // Create a new notification and show it - let n = libnotify::Notification::new_notification("Summary", - Some("Optional Body"), - None).unwrap(); + let n = + libnotify::Notification::new("Summary", Some("Optional Body"), None) + .unwrap(); // Show the notification n.show().unwrap(); // You can also use the .show() convenience method on the context diff --git a/src/lib.rs b/src/lib.rs index 11802ba6..595267ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,15 +4,20 @@ //! extern crate libnotify; //! //! fn main() { -//! // Create a libnotify context -//! let notify = libnotify::Context::new("myapp").unwrap(); +//! // Init libnotify +//! libnotify::init("myapp").unwrap(); //! // Create a new notification and show it -//! let n = notify.new_notification("Summary", -//! Some("Optional Body"), -//! None).unwrap(); +//! let n = libnotify::Notification::new("Summary", +//! Some("Optional Body"), +//! None).unwrap(); +//! // Show the notification //! n.show().unwrap(); //! // You can also use the .show() convenience method on the context -//! notify.show("I am another notification", None, None).unwrap(); +//! n.update("I am another notification", None, None).unwrap(); +//! // Show the update notification +//! n.show().unwrap(); +//! // We are done, deinit +//! libnotify::uninit(); //! } //! //! ``` @@ -94,10 +99,10 @@ impl Notification { /// - summary: Required summary text /// - body: Optional body text /// - icon: Optional icon theme icon name or filename - pub fn new_notification(summary: &str, - body: Option<&str>, - icon: Option<&str>) - -> Result { + pub fn new(summary: &str, + body: Option<&str>, + icon: Option<&str>) + -> Result { init_panic!(); let summary = CString::new(summary)?; let body = match body {