1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::{boxed::Box as Box_, mem::transmute};
12
13glib::wrapper! {
14 #[doc(alias = "GstChildProxy")]
15 pub struct ChildProxy(Interface<ffi::GstChildProxy, ffi::GstChildProxyInterface>);
16
17 match fn {
18 type_ => || ffi::gst_child_proxy_get_type(),
19 }
20}
21
22impl ChildProxy {
23 pub const NONE: Option<&'static ChildProxy> = None;
24}
25
26unsafe impl Send for ChildProxy {}
27unsafe impl Sync for ChildProxy {}
28
29mod sealed {
30 pub trait Sealed {}
31 impl<T: super::IsA<super::ChildProxy>> Sealed for T {}
32}
33
34pub trait ChildProxyExt: IsA<ChildProxy> + sealed::Sealed + 'static {
35 #[doc(alias = "gst_child_proxy_child_added")]
36 fn child_added(&self, child: &impl IsA<glib::Object>, name: &str) {
37 unsafe {
38 ffi::gst_child_proxy_child_added(
39 self.as_ref().to_glib_none().0,
40 child.as_ref().to_glib_none().0,
41 name.to_glib_none().0,
42 );
43 }
44 }
45
46 #[doc(alias = "gst_child_proxy_child_removed")]
47 fn child_removed(&self, child: &impl IsA<glib::Object>, name: &str) {
48 unsafe {
49 ffi::gst_child_proxy_child_removed(
50 self.as_ref().to_glib_none().0,
51 child.as_ref().to_glib_none().0,
52 name.to_glib_none().0,
53 );
54 }
55 }
56
57 //#[doc(alias = "gst_child_proxy_get")]
58 //fn get(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
59 // unsafe { TODO: call ffi:gst_child_proxy_get() }
60 //}
61
62 #[doc(alias = "gst_child_proxy_get_child_by_index")]
63 #[doc(alias = "get_child_by_index")]
64 fn child_by_index(&self, index: u32) -> Option<glib::Object> {
65 unsafe {
66 from_glib_full(ffi::gst_child_proxy_get_child_by_index(
67 self.as_ref().to_glib_none().0,
68 index,
69 ))
70 }
71 }
72
73 #[doc(alias = "gst_child_proxy_get_child_by_name")]
74 #[doc(alias = "get_child_by_name")]
75 fn child_by_name(&self, name: &str) -> Option<glib::Object> {
76 unsafe {
77 from_glib_full(ffi::gst_child_proxy_get_child_by_name(
78 self.as_ref().to_glib_none().0,
79 name.to_glib_none().0,
80 ))
81 }
82 }
83
84 #[cfg(feature = "v1_22")]
85 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
86 #[doc(alias = "gst_child_proxy_get_child_by_name_recurse")]
87 #[doc(alias = "get_child_by_name_recurse")]
88 fn child_by_name_recurse(&self, name: &str) -> Option<glib::Object> {
89 unsafe {
90 from_glib_full(ffi::gst_child_proxy_get_child_by_name_recurse(
91 self.as_ref().to_glib_none().0,
92 name.to_glib_none().0,
93 ))
94 }
95 }
96
97 #[doc(alias = "gst_child_proxy_get_children_count")]
98 #[doc(alias = "get_children_count")]
99 fn children_count(&self) -> u32 {
100 unsafe { ffi::gst_child_proxy_get_children_count(self.as_ref().to_glib_none().0) }
101 }
102
103 //#[doc(alias = "gst_child_proxy_get_valist")]
104 //#[doc(alias = "get_valist")]
105 //fn valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
106 // unsafe { TODO: call ffi:gst_child_proxy_get_valist() }
107 //}
108
109 //#[doc(alias = "gst_child_proxy_set")]
110 //fn set(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
111 // unsafe { TODO: call ffi:gst_child_proxy_set() }
112 //}
113
114 //#[doc(alias = "gst_child_proxy_set_valist")]
115 //fn set_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
116 // unsafe { TODO: call ffi:gst_child_proxy_set_valist() }
117 //}
118
119 #[doc(alias = "child-added")]
120 fn connect_child_added<F: Fn(&Self, &glib::Object, &str) + Send + Sync + 'static>(
121 &self,
122 f: F,
123 ) -> SignalHandlerId {
124 unsafe extern "C" fn child_added_trampoline<
125 P: IsA<ChildProxy>,
126 F: Fn(&P, &glib::Object, &str) + Send + Sync + 'static,
127 >(
128 this: *mut ffi::GstChildProxy,
129 object: *mut glib::gobject_ffi::GObject,
130 name: *mut libc::c_char,
131 f: glib::ffi::gpointer,
132 ) {
133 let f: &F = &*(f as *const F);
134 f(
135 ChildProxy::from_glib_borrow(this).unsafe_cast_ref(),
136 &from_glib_borrow(object),
137 &glib::GString::from_glib_borrow(name),
138 )
139 }
140 unsafe {
141 let f: Box_<F> = Box_::new(f);
142 connect_raw(
143 self.as_ptr() as *mut _,
144 b"child-added\0".as_ptr() as *const _,
145 Some(transmute::<_, unsafe extern "C" fn()>(
146 child_added_trampoline::<Self, F> as *const (),
147 )),
148 Box_::into_raw(f),
149 )
150 }
151 }
152
153 #[doc(alias = "child-removed")]
154 fn connect_child_removed<F: Fn(&Self, &glib::Object, &str) + Send + Sync + 'static>(
155 &self,
156 f: F,
157 ) -> SignalHandlerId {
158 unsafe extern "C" fn child_removed_trampoline<
159 P: IsA<ChildProxy>,
160 F: Fn(&P, &glib::Object, &str) + Send + Sync + 'static,
161 >(
162 this: *mut ffi::GstChildProxy,
163 object: *mut glib::gobject_ffi::GObject,
164 name: *mut libc::c_char,
165 f: glib::ffi::gpointer,
166 ) {
167 let f: &F = &*(f as *const F);
168 f(
169 ChildProxy::from_glib_borrow(this).unsafe_cast_ref(),
170 &from_glib_borrow(object),
171 &glib::GString::from_glib_borrow(name),
172 )
173 }
174 unsafe {
175 let f: Box_<F> = Box_::new(f);
176 connect_raw(
177 self.as_ptr() as *mut _,
178 b"child-removed\0".as_ptr() as *const _,
179 Some(transmute::<_, unsafe extern "C" fn()>(
180 child_removed_trampoline::<Self, F> as *const (),
181 )),
182 Box_::into_raw(f),
183 )
184 }
185 }
186}
187
188impl<O: IsA<ChildProxy>> ChildProxyExt for O {}
189