Drop use of gtypes

This commit is contained in:
Ospald, Julian 2017-07-10 11:57:41 +02:00
parent 9f6e3f5d31
commit 965a64aa55
2 changed files with 5 additions and 8 deletions

View File

@ -17,5 +17,4 @@ gdk-pixbuf = "^0.1.3"
gdk-pixbuf-sys = "^0.3.4" gdk-pixbuf-sys = "^0.3.4"
glib-sys = "^0.3.4" glib-sys = "^0.3.4"
gobject-sys = "^0.3.4" gobject-sys = "^0.3.4"
gtypes = "^0.2.0"
glib = "^0.1.3" glib = "^0.1.3"

View File

@ -31,7 +31,6 @@ extern crate gdk_pixbuf;
extern crate gdk_pixbuf_sys; extern crate gdk_pixbuf_sys;
extern crate glib; extern crate glib;
extern crate glib_sys; extern crate glib_sys;
extern crate gtypes;
extern crate libnotify_sys as sys; extern crate libnotify_sys as sys;
pub mod errors; pub mod errors;
@ -39,7 +38,6 @@ pub mod errors;
use errors::*; use errors::*;
use gdk_pixbuf_sys::GdkPixbuf; use gdk_pixbuf_sys::GdkPixbuf;
use glib::translate::ToGlibPtr; use glib::translate::ToGlibPtr;
use gtypes::{TRUE, FALSE};
use std::ffi::{CStr, CString}; use std::ffi::{CStr, CString};
use std::os::raw::c_int; use std::os::raw::c_int;
use std::os::raw::c_char; use std::os::raw::c_char;
@ -98,7 +96,7 @@ impl Drop for Notification {
if gobject_sys::g_type_check_instance_is_a( if gobject_sys::g_type_check_instance_is_a(
self.handle as *mut gobject_sys::GTypeInstance, self.handle as *mut gobject_sys::GTypeInstance,
gobject_sys::G_TYPE_OBJECT, gobject_sys::G_TYPE_OBJECT,
) == FALSE ) == glib_sys::GFALSE
{ {
panic!("Not a GObject!"); panic!("Not a GObject!");
} }
@ -211,7 +209,7 @@ impl Notification {
summary.as_ptr(), summary.as_ptr(),
body_ptr, body_ptr,
icon_ptr); icon_ptr);
if b == FALSE { if b == glib_sys::GFALSE {
bail!(ErrorKind::InvalidParameter); bail!(ErrorKind::InvalidParameter);
} }
} }
@ -309,11 +307,11 @@ pub fn init(app_name: &str) -> Result<()> {
let app_name = CString::new(app_name)?; let app_name = CString::new(app_name)?;
unsafe { unsafe {
if sys::notify_is_initted() == TRUE { if sys::notify_is_initted() == glib_sys::GTRUE {
bail!(ErrorKind::NotifyAlreadyInitialized); bail!(ErrorKind::NotifyAlreadyInitialized);
} }
let app_name = CString::new(app_name)?; let app_name = CString::new(app_name)?;
if sys::notify_init(app_name.as_ptr()) == FALSE { if sys::notify_init(app_name.as_ptr()) == glib_sys::GFALSE {
bail!(ErrorKind::NotifyInitError); bail!(ErrorKind::NotifyInitError);
} }
} }
@ -336,7 +334,7 @@ pub fn uninit() {
/// Gets whether or not libnotify is initialized. /// Gets whether or not libnotify is initialized.
pub fn is_initted() -> bool { pub fn is_initted() -> bool {
unsafe { unsafe {
if sys::notify_is_initted() == TRUE { if sys::notify_is_initted() == glib_sys::GTRUE {
return true; return true;
} else { } else {
return false; return false;