1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use crate::{ffi, InstanceParamFlag};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
/// A GObject-derived object to express parameters of user instance.
///
/// A [`InstanceParams`][crate::InstanceParams] is a GObject-derived object to express parameters of user instance
/// attached to any timer device or the other instance as slave. The call of
/// [`UserInstanceExtManual::set_params()`][crate::prelude::UserInstanceExtManual::set_params()] requires the instance of object.
///
/// The object wraps `struct snd_timer_params` in UAPI of Linux sound subsystem.
///
/// ## Properties
///
///
/// #### `flags`
/// The flags for user instance, as a set of [`InstanceParamFlag`][crate::InstanceParamFlag].
///
/// Readable | Writeable
///
///
/// #### `interval`
/// The interval to generate event in tick count.
///
/// Readable | Writeable
///
///
/// #### `queue-size`
/// The size of queue.
///
/// Readable | Writeable
///
/// # Implements
///
/// [`InstanceParamsExt`][trait@crate::prelude::InstanceParamsExt], [`InstanceParamsExtManual`][trait@crate::prelude::InstanceParamsExtManual]
#[doc(alias = "ALSATimerInstanceParams")]
pub struct InstanceParams(Object<ffi::ALSATimerInstanceParams, ffi::ALSATimerInstanceParamsClass>);
match fn {
type_ => || ffi::alsatimer_instance_params_get_type(),
}
}
impl InstanceParams {
pub const NONE: Option<&'static InstanceParams> = None;
/// Allocate and return an instance of [`InstanceParams`][crate::InstanceParams].
///
/// # Returns
///
/// An instance of [`InstanceParams`][crate::InstanceParams].
#[doc(alias = "alsatimer_instance_params_new")]
pub fn new() -> InstanceParams {
unsafe { from_glib_full(ffi::alsatimer_instance_params_new()) }
}
}
impl Default for InstanceParams {
fn default() -> Self {
Self::new()
}
}
/// Trait containing the part of [`struct@InstanceParams`] methods.
///
/// # Implementors
///
/// [`InstanceParams`][struct@crate::InstanceParams]
pub trait InstanceParamsExt: IsA<InstanceParams> + 'static {
/// The flags for user instance, as a set of [`InstanceParamFlag`][crate::InstanceParamFlag].
fn flags(&self) -> InstanceParamFlag {
ObjectExt::property(self.as_ref(), "flags")
}
/// The flags for user instance, as a set of [`InstanceParamFlag`][crate::InstanceParamFlag].
fn set_flags(&self, flags: InstanceParamFlag) {
ObjectExt::set_property(self.as_ref(), "flags", flags)
}
/// The interval to generate event in tick count.
fn interval(&self) -> u32 {
ObjectExt::property(self.as_ref(), "interval")
}
/// The interval to generate event in tick count.
fn set_interval(&self, interval: u32) {
ObjectExt::set_property(self.as_ref(), "interval", interval)
}
/// The size of queue.
#[doc(alias = "queue-size")]
fn queue_size(&self) -> u32 {
ObjectExt::property(self.as_ref(), "queue-size")
}
/// The size of queue.
#[doc(alias = "queue-size")]
fn set_queue_size(&self, queue_size: u32) {
ObjectExt::set_property(self.as_ref(), "queue-size", queue_size)
}
#[doc(alias = "flags")]
fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_flags_trampoline<
P: IsA<InstanceParams>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSATimerInstanceParams,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(InstanceParams::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::flags".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_flags_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "interval")]
fn connect_interval_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_interval_trampoline<
P: IsA<InstanceParams>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSATimerInstanceParams,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(InstanceParams::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::interval".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_interval_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "queue-size")]
fn connect_queue_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_queue_size_trampoline<
P: IsA<InstanceParams>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSATimerInstanceParams,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(InstanceParams::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::queue-size".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_queue_size_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<InstanceParams>> InstanceParamsExt for O {}