Add Notification::set_image_from_pixbuf()

This commit is contained in:
2017-07-09 19:33:13 +02:00
parent 6166c861e4
commit c3897b7c0e
2 changed files with 15 additions and 0 deletions

View File

@@ -19,11 +19,14 @@
#![warn(missing_docs)]
extern crate gdk_pixbuf;
extern crate gdk_pixbuf_sys;
extern crate glib;
extern crate glib_sys;
extern crate gtypes;
extern crate libnotify_sys as sys;
use gdk_pixbuf_sys::GdkPixbuf;
use glib::translate::*;
use gtypes::{TRUE, FALSE};
use std::error::Error;
@@ -338,6 +341,16 @@ impl<'a> Notification<'a> {
urgency);
}
}
/// Sets the image in the notification from a Pixbuf.
pub fn set_image_from_pixbuf(&self, pixbuf: &gdk_pixbuf::Pixbuf) {
let pixbuf: *mut GdkPixbuf = pixbuf.to_glib_none().0;
unsafe {
sys::notify_notification_set_image_from_pixbuf(self.handle,
pixbuf);
}
}
}