use crate::ffi;
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "ALSACtlCardInfo")]
pub struct CardInfo(Object<ffi::ALSACtlCardInfo, ffi::ALSACtlCardInfoClass>);
match fn {
type_ => || ffi::alsactl_card_info_get_type(),
}
}
impl CardInfo {
pub const NONE: Option<&'static CardInfo> = None;
}
pub trait CardInfoExt: IsA<CardInfo> + 'static {
#[doc(alias = "card-id")]
fn card_id(&self) -> i32 {
ObjectExt::property(self.as_ref(), "card-id")
}
fn components(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "components")
}
fn driver(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "driver")
}
fn id(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "id")
}
#[doc(alias = "long-name")]
fn long_name(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "long-name")
}
#[doc(alias = "mixer-name")]
fn mixer_name(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "mixer-name")
}
fn name(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "name")
}
#[doc(alias = "card-id")]
fn connect_card_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_card_id_trampoline<P: IsA<CardInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSACtlCardInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(CardInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::card-id".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_card_id_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "components")]
fn connect_components_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_components_trampoline<P: IsA<CardInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSACtlCardInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(CardInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::components".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_components_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "driver")]
fn connect_driver_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_driver_trampoline<P: IsA<CardInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSACtlCardInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(CardInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::driver".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_driver_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "id")]
fn connect_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_id_trampoline<P: IsA<CardInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSACtlCardInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(CardInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::id".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_id_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "long-name")]
fn connect_long_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_long_name_trampoline<P: IsA<CardInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSACtlCardInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(CardInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::long-name".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_long_name_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "mixer-name")]
fn connect_mixer_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_mixer_name_trampoline<P: IsA<CardInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSACtlCardInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(CardInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::mixer-name".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_mixer_name_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "name")]
fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_name_trampoline<P: IsA<CardInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSACtlCardInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(CardInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::name".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_name_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<CardInfo>> CardInfoExt for O {}