1use crate::{ffi, ClientType, FilterAttrFlag};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 #[doc(alias = "ALSASeqClientInfo")]
84 pub struct ClientInfo(Object<ffi::ALSASeqClientInfo, ffi::ALSASeqClientInfoClass>);
85
86 match fn {
87 type_ => || ffi::alsaseq_client_info_get_type(),
88 }
89}
90
91impl ClientInfo {
92 pub const NONE: Option<&'static ClientInfo> = None;
93
94 #[doc(alias = "alsaseq_client_info_new")]
100 pub fn new() -> ClientInfo {
101 unsafe { from_glib_full(ffi::alsaseq_client_info_new()) }
102 }
103}
104
105impl Default for ClientInfo {
106 fn default() -> Self {
107 Self::new()
108 }
109}
110
111pub trait ClientInfoExt: IsA<ClientInfo> + 'static {
117 #[doc(alias = "card-id")]
119 fn card_id(&self) -> i32 {
120 ObjectExt::property(self.as_ref(), "card-id")
121 }
122
123 #[doc(alias = "card-id")]
125 fn set_card_id(&self, card_id: i32) {
126 ObjectExt::set_property(self.as_ref(), "card-id", card_id)
127 }
128
129 #[doc(alias = "client-id")]
132 fn client_id(&self) -> u8 {
133 ObjectExt::property(self.as_ref(), "client-id")
134 }
135
136 #[doc(alias = "client-id")]
139 fn set_client_id(&self, client_id: u8) {
140 ObjectExt::set_property(self.as_ref(), "client-id", client_id)
141 }
142
143 #[doc(alias = "filter-attributes")]
145 fn filter_attributes(&self) -> FilterAttrFlag {
146 ObjectExt::property(self.as_ref(), "filter-attributes")
147 }
148
149 #[doc(alias = "filter-attributes")]
151 fn set_filter_attributes(&self, filter_attributes: FilterAttrFlag) {
152 ObjectExt::set_property(self.as_ref(), "filter-attributes", filter_attributes)
153 }
154
155 #[doc(alias = "lost-count")]
157 fn lost_count(&self) -> i32 {
158 ObjectExt::property(self.as_ref(), "lost-count")
159 }
160
161 fn name(&self) -> Option<glib::GString> {
163 ObjectExt::property(self.as_ref(), "name")
164 }
165
166 fn set_name(&self, name: Option<&str>) {
168 ObjectExt::set_property(self.as_ref(), "name", name)
169 }
170
171 #[doc(alias = "port-count")]
173 fn port_count(&self) -> i32 {
174 ObjectExt::property(self.as_ref(), "port-count")
175 }
176
177 #[doc(alias = "process-id")]
179 fn process_id(&self) -> i64 {
180 ObjectExt::property(self.as_ref(), "process-id")
181 }
182
183 #[doc(alias = "type")]
185 fn type_(&self) -> ClientType {
186 ObjectExt::property(self.as_ref(), "type")
187 }
188
189 #[doc(alias = "type")]
191 fn set_type(&self, type_: ClientType) {
192 ObjectExt::set_property(self.as_ref(), "type", type_)
193 }
194
195 #[doc(alias = "use-filter")]
197 fn uses_filter(&self) -> bool {
198 ObjectExt::property(self.as_ref(), "use-filter")
199 }
200
201 #[doc(alias = "use-filter")]
203 fn set_use_filter(&self, use_filter: bool) {
204 ObjectExt::set_property(self.as_ref(), "use-filter", use_filter)
205 }
206
207 #[doc(alias = "card-id")]
208 fn connect_card_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
209 unsafe extern "C" fn notify_card_id_trampoline<P: IsA<ClientInfo>, F: Fn(&P) + 'static>(
210 this: *mut ffi::ALSASeqClientInfo,
211 _param_spec: glib::ffi::gpointer,
212 f: glib::ffi::gpointer,
213 ) {
214 let f: &F = &*(f as *const F);
215 f(ClientInfo::from_glib_borrow(this).unsafe_cast_ref())
216 }
217 unsafe {
218 let f: Box_<F> = Box_::new(f);
219 connect_raw(
220 self.as_ptr() as *mut _,
221 c"notify::card-id".as_ptr() as *const _,
222 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
223 notify_card_id_trampoline::<Self, F> as *const (),
224 )),
225 Box_::into_raw(f),
226 )
227 }
228 }
229
230 #[doc(alias = "client-id")]
231 fn connect_client_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
232 unsafe extern "C" fn notify_client_id_trampoline<
233 P: IsA<ClientInfo>,
234 F: Fn(&P) + 'static,
235 >(
236 this: *mut ffi::ALSASeqClientInfo,
237 _param_spec: glib::ffi::gpointer,
238 f: glib::ffi::gpointer,
239 ) {
240 let f: &F = &*(f as *const F);
241 f(ClientInfo::from_glib_borrow(this).unsafe_cast_ref())
242 }
243 unsafe {
244 let f: Box_<F> = Box_::new(f);
245 connect_raw(
246 self.as_ptr() as *mut _,
247 c"notify::client-id".as_ptr() as *const _,
248 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
249 notify_client_id_trampoline::<Self, F> as *const (),
250 )),
251 Box_::into_raw(f),
252 )
253 }
254 }
255
256 #[doc(alias = "filter-attributes")]
257 fn connect_filter_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
258 unsafe extern "C" fn notify_filter_attributes_trampoline<
259 P: IsA<ClientInfo>,
260 F: Fn(&P) + 'static,
261 >(
262 this: *mut ffi::ALSASeqClientInfo,
263 _param_spec: glib::ffi::gpointer,
264 f: glib::ffi::gpointer,
265 ) {
266 let f: &F = &*(f as *const F);
267 f(ClientInfo::from_glib_borrow(this).unsafe_cast_ref())
268 }
269 unsafe {
270 let f: Box_<F> = Box_::new(f);
271 connect_raw(
272 self.as_ptr() as *mut _,
273 c"notify::filter-attributes".as_ptr() as *const _,
274 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
275 notify_filter_attributes_trampoline::<Self, F> as *const (),
276 )),
277 Box_::into_raw(f),
278 )
279 }
280 }
281
282 #[doc(alias = "lost-count")]
283 fn connect_lost_count_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
284 unsafe extern "C" fn notify_lost_count_trampoline<
285 P: IsA<ClientInfo>,
286 F: Fn(&P) + 'static,
287 >(
288 this: *mut ffi::ALSASeqClientInfo,
289 _param_spec: glib::ffi::gpointer,
290 f: glib::ffi::gpointer,
291 ) {
292 let f: &F = &*(f as *const F);
293 f(ClientInfo::from_glib_borrow(this).unsafe_cast_ref())
294 }
295 unsafe {
296 let f: Box_<F> = Box_::new(f);
297 connect_raw(
298 self.as_ptr() as *mut _,
299 c"notify::lost-count".as_ptr() as *const _,
300 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
301 notify_lost_count_trampoline::<Self, F> as *const (),
302 )),
303 Box_::into_raw(f),
304 )
305 }
306 }
307
308 #[doc(alias = "name")]
309 fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
310 unsafe extern "C" fn notify_name_trampoline<P: IsA<ClientInfo>, F: Fn(&P) + 'static>(
311 this: *mut ffi::ALSASeqClientInfo,
312 _param_spec: glib::ffi::gpointer,
313 f: glib::ffi::gpointer,
314 ) {
315 let f: &F = &*(f as *const F);
316 f(ClientInfo::from_glib_borrow(this).unsafe_cast_ref())
317 }
318 unsafe {
319 let f: Box_<F> = Box_::new(f);
320 connect_raw(
321 self.as_ptr() as *mut _,
322 c"notify::name".as_ptr() as *const _,
323 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
324 notify_name_trampoline::<Self, F> as *const (),
325 )),
326 Box_::into_raw(f),
327 )
328 }
329 }
330
331 #[doc(alias = "port-count")]
332 fn connect_port_count_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
333 unsafe extern "C" fn notify_port_count_trampoline<
334 P: IsA<ClientInfo>,
335 F: Fn(&P) + 'static,
336 >(
337 this: *mut ffi::ALSASeqClientInfo,
338 _param_spec: glib::ffi::gpointer,
339 f: glib::ffi::gpointer,
340 ) {
341 let f: &F = &*(f as *const F);
342 f(ClientInfo::from_glib_borrow(this).unsafe_cast_ref())
343 }
344 unsafe {
345 let f: Box_<F> = Box_::new(f);
346 connect_raw(
347 self.as_ptr() as *mut _,
348 c"notify::port-count".as_ptr() as *const _,
349 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
350 notify_port_count_trampoline::<Self, F> as *const (),
351 )),
352 Box_::into_raw(f),
353 )
354 }
355 }
356
357 #[doc(alias = "process-id")]
358 fn connect_process_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
359 unsafe extern "C" fn notify_process_id_trampoline<
360 P: IsA<ClientInfo>,
361 F: Fn(&P) + 'static,
362 >(
363 this: *mut ffi::ALSASeqClientInfo,
364 _param_spec: glib::ffi::gpointer,
365 f: glib::ffi::gpointer,
366 ) {
367 let f: &F = &*(f as *const F);
368 f(ClientInfo::from_glib_borrow(this).unsafe_cast_ref())
369 }
370 unsafe {
371 let f: Box_<F> = Box_::new(f);
372 connect_raw(
373 self.as_ptr() as *mut _,
374 c"notify::process-id".as_ptr() as *const _,
375 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
376 notify_process_id_trampoline::<Self, F> as *const (),
377 )),
378 Box_::into_raw(f),
379 )
380 }
381 }
382
383 #[doc(alias = "type")]
384 fn connect_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
385 unsafe extern "C" fn notify_type_trampoline<P: IsA<ClientInfo>, F: Fn(&P) + 'static>(
386 this: *mut ffi::ALSASeqClientInfo,
387 _param_spec: glib::ffi::gpointer,
388 f: glib::ffi::gpointer,
389 ) {
390 let f: &F = &*(f as *const F);
391 f(ClientInfo::from_glib_borrow(this).unsafe_cast_ref())
392 }
393 unsafe {
394 let f: Box_<F> = Box_::new(f);
395 connect_raw(
396 self.as_ptr() as *mut _,
397 c"notify::type".as_ptr() as *const _,
398 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
399 notify_type_trampoline::<Self, F> as *const (),
400 )),
401 Box_::into_raw(f),
402 )
403 }
404 }
405
406 #[doc(alias = "use-filter")]
407 fn connect_use_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
408 unsafe extern "C" fn notify_use_filter_trampoline<
409 P: IsA<ClientInfo>,
410 F: Fn(&P) + 'static,
411 >(
412 this: *mut ffi::ALSASeqClientInfo,
413 _param_spec: glib::ffi::gpointer,
414 f: glib::ffi::gpointer,
415 ) {
416 let f: &F = &*(f as *const F);
417 f(ClientInfo::from_glib_borrow(this).unsafe_cast_ref())
418 }
419 unsafe {
420 let f: Box_<F> = Box_::new(f);
421 connect_raw(
422 self.as_ptr() as *mut _,
423 c"notify::use-filter".as_ptr() as *const _,
424 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
425 notify_use_filter_trampoline::<Self, F> as *const (),
426 )),
427 Box_::into_raw(f),
428 )
429 }
430 }
431}
432
433impl<O: IsA<ClientInfo>> ClientInfoExt for O {}