Remove BoolError occurences
Because currently depends on unpublished glib binding.
This commit is contained in:
parent
d939bee7ea
commit
091ee97b70
@ -1,6 +1,6 @@
|
|||||||
use ffi;
|
use ffi;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use glib;
|
use glib_ffi;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
|
|
||||||
@ -18,13 +18,18 @@ pub fn is_initted() -> bool {
|
|||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
///
|
///
|
||||||
/// `Ok(())` if successful, `Err(err)` on error.
|
/// `Ok(())` if successful, `Err(str)` on error.
|
||||||
pub fn init(app_name: &str) -> Result<(), glib::error::BoolError> {
|
// TODO: switch back to BoolError when it hits stable glib
|
||||||
|
pub fn init(app_name: &str) -> Result<(), String> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
let b = ffi::notify_init(app_name.to_glib_none().0);
|
||||||
ffi::notify_init(app_name.to_glib_none().0),
|
|
||||||
"Failed to initialize libnotify",
|
match b {
|
||||||
)
|
glib_ffi::GFALSE => Err(
|
||||||
|
String::from("Failed to initialize libnotify"),
|
||||||
|
),
|
||||||
|
_ => Ok(()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,8 @@ impl Notification {
|
|||||||
/// # Returns
|
/// # Returns
|
||||||
///
|
///
|
||||||
/// `true`, unless an invalid parameter was passed.
|
/// `true`, unless an invalid parameter was passed.
|
||||||
/// `Ok(())` on success, or `Err(err)` if an invalid parameter was passed
|
/// `Ok(())` on success, or `Err(str)` if an invalid parameter was passed
|
||||||
|
// TODO: switch back to BoolError when it hits stable glib
|
||||||
pub fn update<
|
pub fn update<
|
||||||
'a,
|
'a,
|
||||||
'b,
|
'b,
|
||||||
@ -225,21 +226,24 @@ impl Notification {
|
|||||||
summary: &str,
|
summary: &str,
|
||||||
body: P,
|
body: P,
|
||||||
icon: Q,
|
icon: Q,
|
||||||
) -> Result<(), glib::error::BoolError> {
|
) -> Result<(), String> {
|
||||||
let body = body.into();
|
let body = body.into();
|
||||||
let body = body.to_glib_none();
|
let body = body.to_glib_none();
|
||||||
let icon = icon.into();
|
let icon = icon.into();
|
||||||
let icon = icon.to_glib_none();
|
let icon = icon.to_glib_none();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
let b = ffi::notify_notification_update(
|
||||||
ffi::notify_notification_update(
|
self.to_glib_none().0,
|
||||||
self.to_glib_none().0,
|
summary.to_glib_none().0,
|
||||||
summary.to_glib_none().0,
|
body.0,
|
||||||
body.0,
|
icon.0,
|
||||||
icon.0,
|
);
|
||||||
|
match b {
|
||||||
|
glib_ffi::GFALSE => Err(
|
||||||
|
String::from("Invalid parameter passed"),
|
||||||
),
|
),
|
||||||
"Invalid parameter passed",
|
_ => Ok(()),
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user