1use crate::{ffi,Device,Object};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11 #[doc(alias = "NMCheckpoint")]
60 pub struct Checkpoint(Object<ffi::NMCheckpoint, ffi::NMCheckpointClass>) @extends Object;
61
62 match fn {
63 type_ => || ffi::nm_checkpoint_get_type(),
64 }
65}
66
67impl Checkpoint {
68 #[doc(alias = "nm_checkpoint_get_created")]
77 #[doc(alias = "get_created")]
78 pub fn created(&self) -> i64 {
79 unsafe {
80 ffi::nm_checkpoint_get_created(self.to_glib_none().0)
81 }
82 }
83
84 #[doc(alias = "nm_checkpoint_get_devices")]
90 #[doc(alias = "get_devices")]
91 pub fn devices(&self) -> Vec<Device> {
92 unsafe {
93 FromGlibPtrContainer::from_glib_none(ffi::nm_checkpoint_get_devices(self.to_glib_none().0))
94 }
95 }
96
97 #[doc(alias = "nm_checkpoint_get_rollback_timeout")]
103 #[doc(alias = "get_rollback_timeout")]
104 #[doc(alias = "rollback-timeout")]
105 pub fn rollback_timeout(&self) -> u32 {
106 unsafe {
107 ffi::nm_checkpoint_get_rollback_timeout(self.to_glib_none().0)
108 }
109 }
110
111 #[cfg(feature = "v1_12")]
112 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
113 #[doc(alias = "created")]
114 pub fn connect_created_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
115 unsafe extern "C" fn notify_created_trampoline<F: Fn(&Checkpoint) + 'static>(this: *mut ffi::NMCheckpoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
116 let f: &F = &*(f as *const F);
117 f(&from_glib_borrow(this))
118 }
119 unsafe {
120 let f: Box_<F> = Box_::new(f);
121 connect_raw(self.as_ptr() as *mut _, c"notify::created".as_ptr() as *const _,
122 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_created_trampoline::<F> as *const ())), Box_::into_raw(f))
123 }
124 }
125
126 #[cfg(feature = "v1_12")]
127 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
128 #[doc(alias = "devices")]
129 pub fn connect_devices_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
130 unsafe extern "C" fn notify_devices_trampoline<F: Fn(&Checkpoint) + 'static>(this: *mut ffi::NMCheckpoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
131 let f: &F = &*(f as *const F);
132 f(&from_glib_borrow(this))
133 }
134 unsafe {
135 let f: Box_<F> = Box_::new(f);
136 connect_raw(self.as_ptr() as *mut _, c"notify::devices".as_ptr() as *const _,
137 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_devices_trampoline::<F> as *const ())), Box_::into_raw(f))
138 }
139 }
140
141 #[cfg(feature = "v1_12")]
142 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
143 #[doc(alias = "rollback-timeout")]
144 pub fn connect_rollback_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
145 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) {
146 let f: &F = &*(f as *const F);
147 f(&from_glib_borrow(this))
148 }
149 unsafe {
150 let f: Box_<F> = Box_::new(f);
151 connect_raw(self.as_ptr() as *mut _, c"notify::rollback-timeout".as_ptr() as *const _,
152 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_rollback_timeout_trampoline::<F> as *const ())), Box_::into_raw(f))
153 }
154 }
155}