use crate::{AttendeeRole, AttendeeType, ParticipationStatus, ffi};
use glib::{
prelude::*,
signal::{SignalHandlerId, connect_raw},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
#[doc(alias = "ClepsydreAttendee")]
pub struct Attendee(Object<ffi::ClepsydreAttendee, ffi::ClepsydreAttendeeClass>);
match fn {
type_ => || ffi::clepsydre_attendee_get_type(),
}
}
impl Attendee {
#[doc(alias = "clepsydre_attendee_new")]
pub fn new(
uri: &str,
name: &str,
participation_status: ParticipationStatus,
attendee_type: AttendeeType,
attendee_role: AttendeeRole,
) -> Attendee {
unsafe {
from_glib_full(ffi::clepsydre_attendee_new(
uri.to_glib_none().0,
name.to_glib_none().0,
participation_status.into_glib(),
attendee_type.into_glib(),
attendee_role.into_glib(),
))
}
}
#[doc(alias = "clepsydre_attendee_get_attendee_role")]
#[doc(alias = "get_attendee_role")]
#[doc(alias = "attendee-role")]
pub fn attendee_role(&self) -> AttendeeRole {
unsafe {
from_glib(ffi::clepsydre_attendee_get_attendee_role(
self.to_glib_none().0,
))
}
}
#[doc(alias = "clepsydre_attendee_get_attendee_type")]
#[doc(alias = "get_attendee_type")]
#[doc(alias = "attendee-type")]
pub fn attendee_type(&self) -> AttendeeType {
unsafe {
from_glib(ffi::clepsydre_attendee_get_attendee_type(
self.to_glib_none().0,
))
}
}
#[doc(alias = "clepsydre_attendee_get_name")]
#[doc(alias = "get_name")]
pub fn name(&self) -> Option<glib::GString> {
unsafe { from_glib_none(ffi::clepsydre_attendee_get_name(self.to_glib_none().0)) }
}
#[doc(alias = "clepsydre_attendee_get_participation_status")]
#[doc(alias = "get_participation_status")]
#[doc(alias = "participation-status")]
pub fn participation_status(&self) -> ParticipationStatus {
unsafe {
from_glib(ffi::clepsydre_attendee_get_participation_status(
self.to_glib_none().0,
))
}
}
#[doc(alias = "clepsydre_attendee_get_uri")]
#[doc(alias = "get_uri")]
pub fn uri(&self) -> Option<glib::GString> {
unsafe { from_glib_none(ffi::clepsydre_attendee_get_uri(self.to_glib_none().0)) }
}
#[doc(alias = "attendee-role")]
pub fn set_attendee_role(&self, attendee_role: AttendeeRole) {
ObjectExt::set_property(self, "attendee-role", attendee_role)
}
#[doc(alias = "attendee-type")]
pub fn set_attendee_type(&self, attendee_type: AttendeeType) {
ObjectExt::set_property(self, "attendee-type", attendee_type)
}
pub fn set_name(&self, name: Option<&str>) {
ObjectExt::set_property(self, "name", name)
}
#[doc(alias = "participation-status")]
pub fn set_participation_status(&self, participation_status: ParticipationStatus) {
ObjectExt::set_property(self, "participation-status", participation_status)
}
pub fn set_uri(&self, uri: Option<&str>) {
ObjectExt::set_property(self, "uri", uri)
}
#[doc(alias = "attendee-role")]
pub fn connect_attendee_role_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_attendee_role_trampoline<F: Fn(&Attendee) + 'static>(
this: *mut ffi::ClepsydreAttendee,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::attendee-role".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_attendee_role_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "attendee-type")]
pub fn connect_attendee_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_attendee_type_trampoline<F: Fn(&Attendee) + 'static>(
this: *mut ffi::ClepsydreAttendee,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::attendee-type".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_attendee_type_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "name")]
pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_name_trampoline<F: Fn(&Attendee) + 'static>(
this: *mut ffi::ClepsydreAttendee,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::name".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_name_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "participation-status")]
pub fn connect_participation_status_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_participation_status_trampoline<F: Fn(&Attendee) + 'static>(
this: *mut ffi::ClepsydreAttendee,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::participation-status".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_participation_status_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "uri")]
pub fn connect_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_uri_trampoline<F: Fn(&Attendee) + 'static>(
this: *mut ffi::ClepsydreAttendee,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
unsafe {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
c"notify::uri".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_uri_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}