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
// 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;
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
/// An interface to operate notification with quadlet message.
///
/// Some of units supported by drivers in ALSA firewire stack have the function to notify quadlet
/// message for specific purposes. The [`QuadletNotification`][crate::QuadletNotification] is an interface to operate
/// the notification.
///
/// ## Signals
///
///
/// #### `notified`
/// Emitted when the target unit transfers notification.
///
/// Action
///
/// # Implements
///
/// [`QuadletNotificationExt`][trait@crate::prelude::QuadletNotificationExt]
#[doc(alias = "HitakiQuadletNotification")]
pub struct QuadletNotification(Interface<ffi::HitakiQuadletNotification, ffi::HitakiQuadletNotificationInterface>);
match fn {
type_ => || ffi::hitaki_quadlet_notification_get_type(),
}
}
impl QuadletNotification {
pub const NONE: Option<&'static QuadletNotification> = None;
}
/// Trait containing all [`struct@QuadletNotification`] methods.
///
/// # Implementors
///
/// [`QuadletNotification`][struct@crate::QuadletNotification], [`SndDice`][struct@crate::SndDice], [`SndDigi00x`][struct@crate::SndDigi00x], [`SndMotu`][struct@crate::SndMotu]
pub trait QuadletNotificationExt: IsA<QuadletNotification> + 'static {
/// Emitted when the target unit transfers notification.
/// ## `message`
/// A quadlet message in notification.
#[doc(alias = "notified")]
fn connect_notified<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notified_trampoline<
P: IsA<QuadletNotification>,
F: Fn(&P, u32) + 'static,
>(
this: *mut ffi::HitakiQuadletNotification,
message: std::ffi::c_uint,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
QuadletNotification::from_glib_borrow(this).unsafe_cast_ref(),
message,
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notified".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notified_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn emit_notified(&self, message: u32) {
self.emit_by_name::<()>("notified", &[&message]);
}
}
impl<O: IsA<QuadletNotification>> QuadletNotificationExt for O {}