forked from mirrors/gstreamer-rs
Update for new simplified glib::Object::new() API
This commit is contained in:
parent
dfa3812ccc
commit
f3b5340875
5 changed files with 9 additions and 35 deletions
|
@ -167,10 +167,7 @@ mod media_factory {
|
|||
impl Default for Factory {
|
||||
// Creates a new instance of our factory
|
||||
fn default() -> Factory {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create factory")
|
||||
.downcast()
|
||||
.expect("Created factory is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create factory")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,10 +313,7 @@ mod server {
|
|||
impl Default for Server {
|
||||
// Creates a new instance of our factory
|
||||
fn default() -> Server {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create server")
|
||||
.downcast()
|
||||
.expect("Created server is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create server")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -385,10 +379,7 @@ mod client {
|
|||
impl Default for Client {
|
||||
// Creates a new instance of our factory
|
||||
fn default() -> Client {
|
||||
glib::Object::new(Self::static_type(), &[])
|
||||
.expect("Failed to create client")
|
||||
.downcast()
|
||||
.expect("Created client is of wrong type")
|
||||
glib::Object::new(&[]).expect("Failed to create client")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,10 +256,7 @@ mod fir_filter {
|
|||
impl FirFilter {
|
||||
// Creates a new instance of our filter with the given name
|
||||
pub fn new(name: Option<&str>) -> FirFilter {
|
||||
glib::Object::new(Self::static_type(), &[("name", &name)])
|
||||
.expect("Failed to create fir filter")
|
||||
.downcast()
|
||||
.expect("Created fir filter is of wrong type")
|
||||
glib::Object::new(&[("name", &name)]).expect("Failed to create fir filter")
|
||||
}
|
||||
|
||||
// Sets the coefficients by getting access to the private
|
||||
|
|
|
@ -1628,13 +1628,8 @@ impl<T: IsA<Pad> + IsA<glib::Object>> PadBuilder<T> {
|
|||
pub fn new(name: Option<&str>, direction: crate::PadDirection) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
let pad = glib::Object::new(
|
||||
T::static_type(),
|
||||
&[("name", &name), ("direction", &direction)],
|
||||
)
|
||||
.expect("Failed to create pad")
|
||||
.downcast::<T>()
|
||||
.unwrap();
|
||||
let pad = glib::Object::new::<T>(&[("name", &name), ("direction", &direction)])
|
||||
.expect("Failed to create pad");
|
||||
|
||||
// Ghost pads are a bit special
|
||||
if let Some(pad) = pad.dynamic_cast_ref::<crate::GhostPad>() {
|
||||
|
@ -1683,7 +1678,7 @@ impl<T: IsA<Pad> + IsA<glib::Object>> PadBuilder<T> {
|
|||
}
|
||||
}
|
||||
|
||||
let pad = glib::Object::new(
|
||||
let pad = glib::Object::with_type(
|
||||
type_,
|
||||
&[
|
||||
("name", &name),
|
||||
|
|
|
@ -744,10 +744,7 @@ mod tests {
|
|||
|
||||
impl TestElement {
|
||||
pub fn new(name: Option<&str>) -> Self {
|
||||
glib::Object::new(TestElement::static_type(), &[("name", &name)])
|
||||
.unwrap()
|
||||
.downcast::<Self>()
|
||||
.unwrap()
|
||||
glib::Object::new(&[("name", &name)]).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -141,13 +141,7 @@ mod tests {
|
|||
|
||||
impl TestPad {
|
||||
pub fn new(name: &str, direction: PadDirection) -> Self {
|
||||
glib::Object::new(
|
||||
TestPad::static_type(),
|
||||
&[("name", &name), ("direction", &direction)],
|
||||
)
|
||||
.unwrap()
|
||||
.downcast::<Self>()
|
||||
.unwrap()
|
||||
glib::Object::new(&[("name", &name), ("direction", &direction)]).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue