From 965a64aa55986aed6dacd9b1f923f93b680f193b Mon Sep 17 00:00:00 2001 From: "Ospald, Julian" Date: Mon, 10 Jul 2017 11:57:41 +0200 Subject: [PATCH] Drop use of gtypes --- Cargo.toml | 1 - src/lib.rs | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ae16f34f..e8688c92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,5 +17,4 @@ gdk-pixbuf = "^0.1.3" gdk-pixbuf-sys = "^0.3.4" glib-sys = "^0.3.4" gobject-sys = "^0.3.4" -gtypes = "^0.2.0" glib = "^0.1.3" diff --git a/src/lib.rs b/src/lib.rs index 37206535..0d3f1ff2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,6 @@ 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; pub mod errors; @@ -39,7 +38,6 @@ pub mod errors; use errors::*; use gdk_pixbuf_sys::GdkPixbuf; use glib::translate::ToGlibPtr; -use gtypes::{TRUE, FALSE}; use std::ffi::{CStr, CString}; use std::os::raw::c_int; use std::os::raw::c_char; @@ -98,7 +96,7 @@ impl Drop for Notification { if gobject_sys::g_type_check_instance_is_a( self.handle as *mut gobject_sys::GTypeInstance, gobject_sys::G_TYPE_OBJECT, - ) == FALSE + ) == glib_sys::GFALSE { panic!("Not a GObject!"); } @@ -211,7 +209,7 @@ impl Notification { summary.as_ptr(), body_ptr, icon_ptr); - if b == FALSE { + if b == glib_sys::GFALSE { bail!(ErrorKind::InvalidParameter); } } @@ -309,11 +307,11 @@ pub fn init(app_name: &str) -> Result<()> { let app_name = CString::new(app_name)?; unsafe { - if sys::notify_is_initted() == TRUE { + if sys::notify_is_initted() == glib_sys::GTRUE { bail!(ErrorKind::NotifyAlreadyInitialized); } 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); } } @@ -336,7 +334,7 @@ pub fn uninit() { /// Gets whether or not libnotify is initialized. pub fn is_initted() -> bool { unsafe { - if sys::notify_is_initted() == TRUE { + if sys::notify_is_initted() == glib_sys::GTRUE { return true; } else { return false;