use crate::{ffi, Addr, EventTstampMode};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "ALSASeqSubscribeData")]
pub struct SubscribeData(Object<ffi::ALSASeqSubscribeData, ffi::ALSASeqSubscribeDataClass>);
match fn {
type_ => || ffi::alsaseq_subscribe_data_get_type(),
}
}
impl SubscribeData {
pub const NONE: Option<&'static SubscribeData> = None;
#[doc(alias = "alsaseq_subscribe_data_new")]
pub fn new() -> SubscribeData {
unsafe { from_glib_full(ffi::alsaseq_subscribe_data_new()) }
}
}
impl Default for SubscribeData {
fn default() -> Self {
Self::new()
}
}
pub trait SubscribeDataExt: IsA<SubscribeData> + 'static {
fn dest(&self) -> Option<Addr> {
ObjectExt::property(self.as_ref(), "dest")
}
fn set_dest(&self, dest: Option<&Addr>) {
ObjectExt::set_property(self.as_ref(), "dest", dest)
}
#[doc(alias = "has-tstamp")]
fn has_tstamp(&self) -> bool {
ObjectExt::property(self.as_ref(), "has-tstamp")
}
#[doc(alias = "has-tstamp")]
fn set_has_tstamp(&self, has_tstamp: bool) {
ObjectExt::set_property(self.as_ref(), "has-tstamp", has_tstamp)
}
#[doc(alias = "is-exclusive")]
fn is_exclusive(&self) -> bool {
ObjectExt::property(self.as_ref(), "is-exclusive")
}
#[doc(alias = "is-exclusive")]
fn set_is_exclusive(&self, is_exclusive: bool) {
ObjectExt::set_property(self.as_ref(), "is-exclusive", is_exclusive)
}
#[doc(alias = "queue-id")]
fn queue_id(&self) -> u8 {
ObjectExt::property(self.as_ref(), "queue-id")
}
#[doc(alias = "queue-id")]
fn set_queue_id(&self, queue_id: u8) {
ObjectExt::set_property(self.as_ref(), "queue-id", queue_id)
}
fn sender(&self) -> Option<Addr> {
ObjectExt::property(self.as_ref(), "sender")
}
fn set_sender(&self, sender: Option<&Addr>) {
ObjectExt::set_property(self.as_ref(), "sender", sender)
}
#[doc(alias = "tstamp-mode")]
fn tstamp_mode(&self) -> EventTstampMode {
ObjectExt::property(self.as_ref(), "tstamp-mode")
}
#[doc(alias = "tstamp-mode")]
fn set_tstamp_mode(&self, tstamp_mode: EventTstampMode) {
ObjectExt::set_property(self.as_ref(), "tstamp-mode", tstamp_mode)
}
#[doc(alias = "dest")]
fn connect_dest_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_dest_trampoline<P: IsA<SubscribeData>, F: Fn(&P) + 'static>(
this: *mut ffi::ALSASeqSubscribeData,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubscribeData::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::dest".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_dest_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "has-tstamp")]
fn connect_has_tstamp_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_has_tstamp_trampoline<
P: IsA<SubscribeData>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqSubscribeData,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubscribeData::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::has-tstamp".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_has_tstamp_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "is-exclusive")]
fn connect_is_exclusive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_is_exclusive_trampoline<
P: IsA<SubscribeData>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqSubscribeData,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubscribeData::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::is-exclusive".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_is_exclusive_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "queue-id")]
fn connect_queue_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_queue_id_trampoline<
P: IsA<SubscribeData>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqSubscribeData,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubscribeData::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-id".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_queue_id_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "sender")]
fn connect_sender_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_sender_trampoline<
P: IsA<SubscribeData>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqSubscribeData,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubscribeData::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::sender".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_sender_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "tstamp-mode")]
fn connect_tstamp_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_tstamp_mode_trampoline<
P: IsA<SubscribeData>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::ALSASeqSubscribeData,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(SubscribeData::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::tstamp-mode".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_tstamp_mode_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<SubscribeData>> SubscribeDataExt for O {}