use crate::{ffi, StreamDirection, StreamPairInfoFlag};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "ALSARawmidiSubstreamInfo")]
pub struct SubstreamInfo(Object<ffi::ALSARawmidiSubstreamInfo, ffi::ALSARawmidiSubstreamInfoClass>);
match fn {
type_ => || ffi::alsarawmidi_substream_info_get_type(),
}
}
impl SubstreamInfo {
pub const NONE: Option<&'static SubstreamInfo> = None;
}
pub trait SubstreamInfoExt: IsA<SubstreamInfo> + 'static {
#[doc(alias = "card-id")]
fn card_id(&self) -> i32 {
ObjectExt::property(self.as_ref(), "card-id")
}
#[doc(alias = "device-id")]
fn device_id(&self) -> u32 {
ObjectExt::property(self.as_ref(), "device-id")
}
fn direction(&self) -> StreamDirection {
ObjectExt::property(self.as_ref(), "direction")
}
fn flags(&self) -> StreamPairInfoFlag {
ObjectExt::property(self.as_ref(), "flags")
}
fn id(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "id")
}
fn name(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "name")
}
#[doc(alias = "subdevice-id")]
fn subdevice_id(&self) -> u32 {
ObjectExt::property(self.as_ref(), "subdevice-id")
}
#[doc(alias = "subdevice-name")]
fn subdevice_name(&self) -> Option<glib::GString> {
ObjectExt::property(self.as_ref(), "subdevice-name")
}
#[doc(alias = "subdevices-avail")]
fn subdevices_avail(&self) -> u32 {
ObjectExt::property(self.as_ref(), "subdevices-avail")
}
#[doc(alias = "subdevices-count")]
fn subdevices_count(&self) -> u32 {
ObjectExt::property(self.as_ref(), "subdevices-count")
}
#[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<SubstreamInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::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 = "device-id")]
fn connect_device_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_device_id_trampoline<
P: IsA<SubstreamInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::device-id".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_device_id_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "direction")]
fn connect_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_direction_trampoline<
P: IsA<SubstreamInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::direction".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_direction_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "flags")]
fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_flags_trampoline<P: IsA<SubstreamInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::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 = "id")]
fn connect_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_id_trampoline<P: IsA<SubstreamInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::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 = "name")]
fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_name_trampoline<P: IsA<SubstreamInfo>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::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),
)
}
}
#[doc(alias = "subdevice-id")]
fn connect_subdevice_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_subdevice_id_trampoline<
P: IsA<SubstreamInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::subdevice-id".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_subdevice_id_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "subdevice-name")]
fn connect_subdevice_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_subdevice_name_trampoline<
P: IsA<SubstreamInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::subdevice-name".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_subdevice_name_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "subdevices-avail")]
fn connect_subdevices_avail_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_subdevices_avail_trampoline<
P: IsA<SubstreamInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::subdevices-avail".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_subdevices_avail_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "subdevices-count")]
fn connect_subdevices_count_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_subdevices_count_trampoline<
P: IsA<SubstreamInfo>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSARawmidiSubstreamInfo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubstreamInfo::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::subdevices-count".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_subdevices_count_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<SubstreamInfo>> SubstreamInfoExt for O {}