use crate::{ffi,Device,Object};
use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
use std::{boxed::Box as Box_};
glib::wrapper! {
#[doc(alias = "NMCheckpoint")]
pub struct Checkpoint(Object<ffi::NMCheckpoint, ffi::NMCheckpointClass>) @extends Object;
match fn {
type_ => || ffi::nm_checkpoint_get_type(),
}
}
impl Checkpoint {
#[doc(alias = "nm_checkpoint_get_created")]
#[doc(alias = "get_created")]
pub fn created(&self) -> i64 {
unsafe {
ffi::nm_checkpoint_get_created(self.to_glib_none().0)
}
}
#[doc(alias = "nm_checkpoint_get_devices")]
#[doc(alias = "get_devices")]
pub fn devices(&self) -> Vec<Device> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::nm_checkpoint_get_devices(self.to_glib_none().0))
}
}
#[doc(alias = "nm_checkpoint_get_rollback_timeout")]
#[doc(alias = "get_rollback_timeout")]
#[doc(alias = "rollback-timeout")]
pub fn rollback_timeout(&self) -> u32 {
unsafe {
ffi::nm_checkpoint_get_rollback_timeout(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "created")]
pub fn connect_created_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_created_trampoline<F: Fn(&Checkpoint) + 'static>(this: *mut ffi::NMCheckpoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
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::created".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_created_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "devices")]
pub fn connect_devices_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_devices_trampoline<F: Fn(&Checkpoint) + 'static>(this: *mut ffi::NMCheckpoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
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::devices".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_devices_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "rollback-timeout")]
pub fn connect_rollback_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_rollback_timeout_trampoline<F: Fn(&Checkpoint) + 'static>(this: *mut ffi::NMCheckpoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
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::rollback-timeout".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_rollback_timeout_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
}