use crate::{ffi, ElemInfoCommon};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "ALSACtlElemInfoSingleArray")]
pub struct ElemInfoSingleArray(Interface<ffi::ALSACtlElemInfoSingleArray, ffi::ALSACtlElemInfoSingleArrayInterface>) @requires ElemInfoCommon;
match fn {
type_ => || ffi::alsactl_elem_info_single_array_get_type(),
}
}
impl ElemInfoSingleArray {
pub const NONE: Option<&'static ElemInfoSingleArray> = None;
}
pub trait ElemInfoSingleArrayExt: IsA<ElemInfoSingleArray> + 'static {
#[doc(alias = "value-count")]
fn value_count(&self) -> u32 {
ObjectExt::property(self.as_ref(), "value-count")
}
#[doc(alias = "value-count")]
fn set_value_count(&self, value_count: u32) {
ObjectExt::set_property(self.as_ref(), "value-count", value_count)
}
#[doc(alias = "value-count")]
fn connect_value_count_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_value_count_trampoline<
P: IsA<ElemInfoSingleArray>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSACtlElemInfoSingleArray,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(ElemInfoSingleArray::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::value-count".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_value_count_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<ElemInfoSingleArray>> ElemInfoSingleArrayExt for O {}