Let ChildProxy::set_child_property() take a &ToValue instead of an actual Value

This commit is contained in:
Sebastian Dröge 2017-12-16 15:24:18 +02:00
parent 3de73d89f2
commit 52ca97e7e6

View file

@ -15,7 +15,7 @@ use ChildProxy;
pub trait ChildProxyExtManual { pub trait ChildProxyExtManual {
fn get_child_property(&self, name: &str) -> Option<glib::Value>; fn get_child_property(&self, name: &str) -> Option<glib::Value>;
fn set_child_property(&self, name: &str, value: &glib::Value) -> Result<(), glib::BoolError>; fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError>;
} }
impl<O: IsA<ChildProxy>> ChildProxyExtManual for O { impl<O: IsA<ChildProxy>> ChildProxyExtManual for O {
@ -41,7 +41,7 @@ impl<O: IsA<ChildProxy>> ChildProxyExtManual for O {
} }
} }
fn set_child_property(&self, name: &str, value: &glib::Value) -> Result<(), glib::BoolError> { fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError> {
unsafe { unsafe {
let found: bool = from_glib(ffi::gst_child_proxy_lookup( let found: bool = from_glib(ffi::gst_child_proxy_lookup(
self.to_glib_none().0, self.to_glib_none().0,
@ -53,6 +53,7 @@ impl<O: IsA<ChildProxy>> ChildProxyExtManual for O {
return Err(glib::BoolError("Child property not found")); return Err(glib::BoolError("Child property not found"));
} }
let value = value.to_value();
ffi::gst_child_proxy_set_property( ffi::gst_child_proxy_set_property(
self.to_glib_none().0, self.to_glib_none().0,
name.to_glib_none().0, name.to_glib_none().0,