Preset::set_app_dir() returning false is an error, make it a Result

This commit is contained in:
Sebastian Dröge 2017-12-20 18:44:57 +02:00
parent d182584c25
commit f2729fb730
2 changed files with 12 additions and 3 deletions

View file

@ -50,7 +50,6 @@ generate = [
"Gst.PadMode",
"Gst.SchedulingFlags",
"Gst.ChildProxy",
"Gst.Preset",
"Gst.TagSetter",
"Gst.QOSType",
"Gst.EventType",
@ -768,6 +767,15 @@ trait = false
[object.function.return]
bool_return_is_error = "Failed to add plugin"
[[object]]
name = "Gst.Preset"
status = "generate"
[[object.function]]
name = "set_app_dir"
[object.function.return]
bool_return_is_error = "Failed to set app preset directory"
[[object]]
name = "Gst.*"
status = "generate"

View file

@ -2,6 +2,7 @@
// DO NOT EDIT
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
@ -25,10 +26,10 @@ impl Preset {
}
}
pub fn set_app_dir(app_dir: &str) -> bool {
pub fn set_app_dir(app_dir: &str) -> Result<(), glib::error::BoolError> {
assert_initialized_main_thread!();
unsafe {
from_glib(ffi::gst_preset_set_app_dir(app_dir.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_preset_set_app_dir(app_dir.to_glib_none().0), "Failed to set app preset directory")
}
}
}