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