Switch to using glib-sys

We need GVariant and to_glib_none() later,
which must be from the crate glib_sys.
This commit is contained in:
Julian Ospald 2017-07-09 14:07:40 +02:00
parent bf90bccef8
commit 6e5a9ab5d4
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 4 additions and 4 deletions

View File

@ -12,5 +12,5 @@ keywords = ["libnotify", "notification"]
[dependencies] [dependencies]
libnotify-sys = "0.3" libnotify-sys = "0.3"
glib-2-0-sys = "0.46.0"
gtypes = "0.2" gtypes = "0.2"
glib-sys = "^0.3.4"

View File

@ -20,7 +20,7 @@
#![warn(missing_docs)] #![warn(missing_docs)]
extern crate libnotify_sys as sys; extern crate libnotify_sys as sys;
extern crate glib_2_0_sys as glib; extern crate glib_sys;
extern crate gtypes; extern crate gtypes;
use std::ffi::{self, CStr, CString}; use std::ffi::{self, CStr, CString};
@ -188,13 +188,13 @@ impl<'a> Notification<'a> {
/// on the screen. /// on the screen.
pub fn show(&'a self) -> Result<(), NotificationShowError> { pub fn show(&'a self) -> Result<(), NotificationShowError> {
unsafe { unsafe {
let mut err: *mut glib::GError = std::ptr::null_mut(); let mut err: *mut glib_sys::GError = std::ptr::null_mut();
sys::notify_notification_show(self.handle, &mut err); sys::notify_notification_show(self.handle, &mut err);
if !err.is_null() { if !err.is_null() {
let result = Err(NotificationShowError { let result = Err(NotificationShowError {
message: CStr::from_ptr((*err).message).to_string_lossy().into_owned(), message: CStr::from_ptr((*err).message).to_string_lossy().into_owned(),
}); });
glib::g_error_free(err); glib_sys::g_error_free(err);
return result; return result;
} }
Ok(()) Ok(())