Add Notification::set_image_from_pixbuf()
This commit is contained in:
parent
6166c861e4
commit
c3897b7c0e
@ -12,6 +12,8 @@ keywords = ["libnotify", "notification"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libnotify-sys = "^0.5.0"
|
libnotify-sys = "^0.5.0"
|
||||||
|
gdk-pixbuf = "^0.1.3"
|
||||||
|
gdk-pixbuf-sys = "^0.3.4"
|
||||||
glib-sys = "^0.3.4"
|
glib-sys = "^0.3.4"
|
||||||
gtypes = "^0.2.0"
|
gtypes = "^0.2.0"
|
||||||
glib = "^0.1.3"
|
glib = "^0.1.3"
|
||||||
|
13
src/lib.rs
13
src/lib.rs
@ -19,11 +19,14 @@
|
|||||||
|
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
|
extern crate gdk_pixbuf;
|
||||||
|
extern crate gdk_pixbuf_sys;
|
||||||
extern crate glib;
|
extern crate glib;
|
||||||
extern crate glib_sys;
|
extern crate glib_sys;
|
||||||
extern crate gtypes;
|
extern crate gtypes;
|
||||||
extern crate libnotify_sys as sys;
|
extern crate libnotify_sys as sys;
|
||||||
|
|
||||||
|
use gdk_pixbuf_sys::GdkPixbuf;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gtypes::{TRUE, FALSE};
|
use gtypes::{TRUE, FALSE};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
@ -338,6 +341,16 @@ impl<'a> Notification<'a> {
|
|||||||
urgency);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user