nm_rs/auto/
remote_connection.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{ffi,Connection,Object};
8#[cfg(feature = "v1_12")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
10use crate::{SettingsConnectionFlags};
11use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
12use std::{boxed::Box as Box_,pin::Pin};
13
14glib::wrapper! {
15    ///
16    ///
17    /// ## Properties
18    ///
19    ///
20    /// #### `filename`
21    ///  File that stores the connection in case the connection is
22    /// file-backed.
23    ///
24    /// Readable
25    ///
26    ///
27    /// #### `flags`
28    ///  The flags of the connection as unsigned integer. The values
29    /// correspond to the #NMSettingsConnectionFlags enum.
30    ///
31    /// Readable
32    ///
33    ///
34    /// #### `unsaved`
35    ///  [`true`] if the remote connection contains changes that have not been saved
36    /// to disk, [`false`] if the connection is the same as its on-disk representation.
37    ///
38    /// Readable
39    ///
40    ///
41    /// #### `version-id`
42    ///  The version ID of the profile that is incremented when the profile gets modified.
43    /// This can be used to track concurrent modifications of the profile.
44    ///
45    /// Readable
46    ///
47    ///
48    /// #### `visible`
49    ///  [`true`] if the remote connection is visible to the current user, [`false`] if
50    /// not.  If the connection is not visible then it is essentially useless; it
51    /// will not contain any settings, and operations such as
52    /// nm_remote_connection_save() and nm_remote_connection_delete() will always
53    /// fail. (#NMRemoteSettings will not normally return non-visible connections
54    /// to callers, but it is possible for a connection's visibility to change
55    /// after you already have a reference to it.)
56    ///
57    /// Readable
58    /// <details><summary><h4>Object</h4></summary>
59    ///
60    ///
61    /// #### `client`
62    ///  The NMClient instance as returned by nm_object_get_client().
63    ///
64    /// When an NMObject gets removed from the NMClient cache,
65    /// the NMObject:path property stays unchanged, but this client
66    /// instance gets reset to [`None`]. You can use this property to
67    /// track removal of the object from the cache.
68    ///
69    /// Readable
70    ///
71    ///
72    /// #### `path`
73    ///  The D-Bus object path.
74    ///
75    /// The D-Bus path of an object instance never changes, even if the object
76    /// gets removed from the cache. To see whether the object is still in the
77    /// cache, check NMObject:client.
78    ///
79    /// Readable
80    /// </details>
81    ///
82    /// # Implements
83    ///
84    /// [`ObjectExt`][trait@crate::prelude::ObjectExt], [`ConnectionExt`][trait@crate::prelude::ConnectionExt]
85    #[doc(alias = "NMRemoteConnection")]
86    pub struct RemoteConnection(Object<ffi::NMRemoteConnection, ffi::NMRemoteConnectionClass>) @extends Object, @implements Connection;
87
88    match fn {
89        type_ => || ffi::nm_remote_connection_get_type(),
90    }
91}
92
93impl RemoteConnection {
94    /// Send any local changes to the settings and properties of @self to
95    /// NetworkManager. If @save_to_disk is [`true`], the updated connection will be saved to
96    /// disk; if [`false`], then only the in-memory representation will be changed.
97    ///
98    /// # Deprecated since 1.22
99    ///
100    /// Use nm_remote_connection_commit_changes_async() or GDBusConnection.
101    /// ## `save_to_disk`
102    /// whether to persist the changes to disk
103    /// ## `cancellable`
104    /// a #GCancellable, or [`None`]
105    ///
106    /// # Returns
107    ///
108    /// [`true`] on success, [`false`] on error, in which case @error will be set.
109    #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
110    #[allow(deprecated)]
111    #[doc(alias = "nm_remote_connection_commit_changes")]
112    pub fn commit_changes(&self, save_to_disk: bool, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
113        unsafe {
114            let mut error = std::ptr::null_mut();
115            let is_ok = ffi::nm_remote_connection_commit_changes(self.to_glib_none().0, save_to_disk.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
116            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
117            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
118        }
119    }
120
121    /// Asynchronously sends any local changes to the settings and properties of
122    /// @self to NetworkManager. If @save is [`true`], the updated connection will
123    /// be saved to disk; if [`false`], then only the in-memory representation will be
124    /// changed.
125    /// ## `save_to_disk`
126    /// whether to save the changes to persistent storage
127    /// ## `cancellable`
128    /// a #GCancellable, or [`None`]
129    /// ## `callback`
130    /// callback to be called when the commit operation completes
131    #[doc(alias = "nm_remote_connection_commit_changes_async")]
132    pub fn commit_changes_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, save_to_disk: bool, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
133        
134                let main_context = glib::MainContext::ref_thread_default();
135                let is_main_context_owner = main_context.is_owner();
136                let has_acquired_main_context = (!is_main_context_owner)
137                    .then(|| main_context.acquire().ok())
138                    .flatten();
139                assert!(
140                    is_main_context_owner || has_acquired_main_context.is_some(),
141                    "Async operations only allowed if the thread is owning the MainContext"
142                );
143        
144        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
145        unsafe extern "C" fn commit_changes_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
146            let mut error = std::ptr::null_mut();
147            ffi::nm_remote_connection_commit_changes_finish(_source_object as *mut _, res, &mut error);
148            let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
149            let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
150            let callback: P = callback.into_inner();
151            callback(result);
152        }
153        let callback = commit_changes_async_trampoline::<P>;
154        unsafe {
155            ffi::nm_remote_connection_commit_changes_async(self.to_glib_none().0, save_to_disk.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
156        }
157    }
158
159    
160    pub fn commit_changes_future(&self, save_to_disk: bool) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
161
162        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
163            obj.commit_changes_async(
164                save_to_disk,
165                Some(cancellable),
166                move |res| {
167                    send.resolve(res);
168                },
169            );
170        }))
171    }
172
173    /// Deletes the connection.
174    ///
175    /// # Deprecated since 1.22
176    ///
177    /// Use nm_remote_connection_delete_async() or GDBusConnection.
178    /// ## `cancellable`
179    /// a #GCancellable, or [`None`]
180    ///
181    /// # Returns
182    ///
183    /// [`true`] on success, [`false`] on error, in which case @error will be set.
184    #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
185    #[allow(deprecated)]
186    #[doc(alias = "nm_remote_connection_delete")]
187    pub fn delete(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
188        unsafe {
189            let mut error = std::ptr::null_mut();
190            let is_ok = ffi::nm_remote_connection_delete(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
191            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
192            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
193        }
194    }
195
196    /// Asynchronously deletes the connection.
197    /// ## `cancellable`
198    /// a #GCancellable, or [`None`]
199    /// ## `callback`
200    /// callback to be called when the delete operation completes
201    #[doc(alias = "nm_remote_connection_delete_async")]
202    pub fn delete_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
203        
204                let main_context = glib::MainContext::ref_thread_default();
205                let is_main_context_owner = main_context.is_owner();
206                let has_acquired_main_context = (!is_main_context_owner)
207                    .then(|| main_context.acquire().ok())
208                    .flatten();
209                assert!(
210                    is_main_context_owner || has_acquired_main_context.is_some(),
211                    "Async operations only allowed if the thread is owning the MainContext"
212                );
213        
214        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
215        unsafe extern "C" fn delete_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
216            let mut error = std::ptr::null_mut();
217            ffi::nm_remote_connection_delete_finish(_source_object as *mut _, res, &mut error);
218            let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
219            let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
220            let callback: P = callback.into_inner();
221            callback(result);
222        }
223        let callback = delete_async_trampoline::<P>;
224        unsafe {
225            ffi::nm_remote_connection_delete_async(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
226        }
227    }
228
229    
230    pub fn delete_future(&self) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
231
232        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
233            obj.delete_async(
234                Some(cancellable),
235                move |res| {
236                    send.resolve(res);
237                },
238            );
239        }))
240    }
241
242    ///
243    /// # Returns
244    ///
245    /// file that stores the connection in case the connection is file-backed.
246    #[cfg(feature = "v1_12")]
247    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
248    #[doc(alias = "nm_remote_connection_get_filename")]
249    #[doc(alias = "get_filename")]
250    pub fn filename(&self) -> glib::GString {
251        unsafe {
252            from_glib_none(ffi::nm_remote_connection_get_filename(self.to_glib_none().0))
253        }
254    }
255
256    ///
257    /// # Returns
258    ///
259    /// the flags of the connection of type #NMSettingsConnectionFlags.
260    #[cfg(feature = "v1_12")]
261    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
262    #[doc(alias = "nm_remote_connection_get_flags")]
263    #[doc(alias = "get_flags")]
264    pub fn flags(&self) -> SettingsConnectionFlags {
265        unsafe {
266            from_glib(ffi::nm_remote_connection_get_flags(self.to_glib_none().0))
267        }
268    }
269
270    //#[doc(alias = "nm_remote_connection_get_secrets")]
271    //#[doc(alias = "get_secrets")]
272    //pub fn secrets(&self, setting_name: &str, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result</*Ignored*/glib::Variant, glib::Error> {
273    //    unsafe { TODO: call ffi:nm_remote_connection_get_secrets() }
274    //}
275
276    //#[doc(alias = "nm_remote_connection_get_secrets_async")]
277    //#[doc(alias = "get_secrets_async")]
278    //pub fn secrets_async<P: FnOnce(Result</*Ignored*/glib::Variant, glib::Error>) + 'static>(&self, setting_name: &str, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
279    //    unsafe { TODO: call ffi:nm_remote_connection_get_secrets_async() }
280    //}
281
282    //
283    //pub fn secrets_future(&self, setting_name: &str) -> Pin<Box_<dyn std::future::Future<Output = Result</*Ignored*/glib::Variant, glib::Error>> + 'static>> {
284
285        //let setting_name = String::from(setting_name);
286        //Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
287        //    obj.secrets_async(
288        //        &setting_name,
289        //        Some(cancellable),
290        //        move |res| {
291        //            send.resolve(res);
292        //        },
293        //    );
294        //}))
295    //}
296
297    ///
298    /// # Returns
299    ///
300    /// [`true`] if the remote connection contains changes that have not
301    /// been saved to disk, [`false`] if the connection is the same as its on-disk
302    /// representation.
303    #[doc(alias = "nm_remote_connection_get_unsaved")]
304    #[doc(alias = "get_unsaved")]
305    #[doc(alias = "unsaved")]
306    pub fn is_unsaved(&self) -> bool {
307        unsafe {
308            from_glib(ffi::nm_remote_connection_get_unsaved(self.to_glib_none().0))
309        }
310    }
311
312    ///
313    /// # Returns
314    ///
315    /// the version-id of the profile. This ID is incremented
316    ///   whenever the profile is modified.
317    #[cfg(feature = "v1_44")]
318    #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
319    #[doc(alias = "nm_remote_connection_get_version_id")]
320    #[doc(alias = "get_version_id")]
321    #[doc(alias = "version-id")]
322    pub fn version_id(&self) -> u64 {
323        unsafe {
324            ffi::nm_remote_connection_get_version_id(self.to_glib_none().0)
325        }
326    }
327
328    /// Checks if the connection is visible to the current user.  If the
329    /// connection is not visible then it is essentially useless; it will
330    /// not contain any settings, and operations such as
331    /// nm_remote_connection_save() and nm_remote_connection_delete() will
332    /// always fail. (#NMRemoteSettings will not normally return
333    /// non-visible connections to callers, but it is possible for a
334    /// connection's visibility to change after you already have a
335    /// reference to it.)
336    ///
337    /// # Returns
338    ///
339    /// [`true`] if the remote connection is visible to the current
340    /// user, [`false`] if not.
341    #[doc(alias = "nm_remote_connection_get_visible")]
342    #[doc(alias = "get_visible")]
343    #[doc(alias = "visible")]
344    pub fn is_visible(&self) -> bool {
345        unsafe {
346            from_glib(ffi::nm_remote_connection_get_visible(self.to_glib_none().0))
347        }
348    }
349
350    /// Saves the connection to disk if the connection has changes that have not yet
351    /// been written to disk, or if the connection has never been saved.
352    ///
353    /// # Deprecated since 1.22
354    ///
355    /// Use nm_remote_connection_save_async() or GDBusConnection.
356    /// ## `cancellable`
357    /// a #GCancellable, or [`None`]
358    ///
359    /// # Returns
360    ///
361    /// [`true`] on success, [`false`] on error, in which case @error will be set.
362    #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
363    #[allow(deprecated)]
364    #[doc(alias = "nm_remote_connection_save")]
365    pub fn save(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
366        unsafe {
367            let mut error = std::ptr::null_mut();
368            let is_ok = ffi::nm_remote_connection_save(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
369            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
370            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
371        }
372    }
373
374    /// Saves the connection to disk if the connection has changes that have not yet
375    /// been written to disk, or if the connection has never been saved.
376    /// ## `cancellable`
377    /// a #GCancellable, or [`None`]
378    /// ## `callback`
379    /// callback to be called when the save operation completes
380    #[doc(alias = "nm_remote_connection_save_async")]
381    pub fn save_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
382        
383                let main_context = glib::MainContext::ref_thread_default();
384                let is_main_context_owner = main_context.is_owner();
385                let has_acquired_main_context = (!is_main_context_owner)
386                    .then(|| main_context.acquire().ok())
387                    .flatten();
388                assert!(
389                    is_main_context_owner || has_acquired_main_context.is_some(),
390                    "Async operations only allowed if the thread is owning the MainContext"
391                );
392        
393        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
394        unsafe extern "C" fn save_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
395            let mut error = std::ptr::null_mut();
396            ffi::nm_remote_connection_save_finish(_source_object as *mut _, res, &mut error);
397            let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
398            let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
399            let callback: P = callback.into_inner();
400            callback(result);
401        }
402        let callback = save_async_trampoline::<P>;
403        unsafe {
404            ffi::nm_remote_connection_save_async(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
405        }
406    }
407
408    
409    pub fn save_future(&self) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
410
411        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
412            obj.save_async(
413                Some(cancellable),
414                move |res| {
415                    send.resolve(res);
416                },
417            );
418        }))
419    }
420
421    //#[cfg(feature = "v1_12")]
422    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
423    //#[doc(alias = "nm_remote_connection_update2")]
424    //pub fn update2<P: FnOnce(Result</*Ignored*/glib::Variant, glib::Error>) + 'static>(&self, settings: /*Ignored*/Option<&glib::Variant>, flags: SettingsUpdate2Flags, args: /*Ignored*/Option<&glib::Variant>, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
425    //    unsafe { TODO: call ffi:nm_remote_connection_update2() }
426    //}
427
428    //
429    //#[cfg(feature = "v1_12")]
430    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
431    //pub fn update2_future(&self, settings: /*Ignored*/Option<&glib::Variant>, flags: SettingsUpdate2Flags, args: /*Ignored*/Option<&glib::Variant>) -> Pin<Box_<dyn std::future::Future<Output = Result</*Ignored*/glib::Variant, glib::Error>> + 'static>> {
432
433        //let settings = settings.map(ToOwned::to_owned);
434        //let args = args.map(ToOwned::to_owned);
435        //Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
436        //    obj.update2(
437        //        settings.as_ref().map(::std::borrow::Borrow::borrow),
438        //        flags,
439        //        args.as_ref().map(::std::borrow::Borrow::borrow),
440        //        Some(cancellable),
441        //        move |res| {
442        //            send.resolve(res);
443        //        },
444        //    );
445        //}))
446    //}
447
448    #[cfg(feature = "v1_12")]
449    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
450    #[doc(alias = "filename")]
451    pub fn connect_filename_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
452        unsafe extern "C" fn notify_filename_trampoline<F: Fn(&RemoteConnection) + 'static>(this: *mut ffi::NMRemoteConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
453            let f: &F = &*(f as *const F);
454            f(&from_glib_borrow(this))
455        }
456        unsafe {
457            let f: Box_<F> = Box_::new(f);
458            connect_raw(self.as_ptr() as *mut _, c"notify::filename".as_ptr() as *const _,
459                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_filename_trampoline::<F> as *const ())), Box_::into_raw(f))
460        }
461    }
462
463    #[cfg(feature = "v1_12")]
464    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
465    #[doc(alias = "flags")]
466    pub fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
467        unsafe extern "C" fn notify_flags_trampoline<F: Fn(&RemoteConnection) + 'static>(this: *mut ffi::NMRemoteConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
468            let f: &F = &*(f as *const F);
469            f(&from_glib_borrow(this))
470        }
471        unsafe {
472            let f: Box_<F> = Box_::new(f);
473            connect_raw(self.as_ptr() as *mut _, c"notify::flags".as_ptr() as *const _,
474                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
475        }
476    }
477
478    #[doc(alias = "unsaved")]
479    pub fn connect_unsaved_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
480        unsafe extern "C" fn notify_unsaved_trampoline<F: Fn(&RemoteConnection) + 'static>(this: *mut ffi::NMRemoteConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
481            let f: &F = &*(f as *const F);
482            f(&from_glib_borrow(this))
483        }
484        unsafe {
485            let f: Box_<F> = Box_::new(f);
486            connect_raw(self.as_ptr() as *mut _, c"notify::unsaved".as_ptr() as *const _,
487                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_unsaved_trampoline::<F> as *const ())), Box_::into_raw(f))
488        }
489    }
490
491    #[cfg(feature = "v1_44")]
492    #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
493    #[doc(alias = "version-id")]
494    pub fn connect_version_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
495        unsafe extern "C" fn notify_version_id_trampoline<F: Fn(&RemoteConnection) + 'static>(this: *mut ffi::NMRemoteConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
496            let f: &F = &*(f as *const F);
497            f(&from_glib_borrow(this))
498        }
499        unsafe {
500            let f: Box_<F> = Box_::new(f);
501            connect_raw(self.as_ptr() as *mut _, c"notify::version-id".as_ptr() as *const _,
502                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_version_id_trampoline::<F> as *const ())), Box_::into_raw(f))
503        }
504    }
505
506    #[doc(alias = "visible")]
507    pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
508        unsafe extern "C" fn notify_visible_trampoline<F: Fn(&RemoteConnection) + 'static>(this: *mut ffi::NMRemoteConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
509            let f: &F = &*(f as *const F);
510            f(&from_glib_borrow(this))
511        }
512        unsafe {
513            let f: Box_<F> = Box_::new(f);
514            connect_raw(self.as_ptr() as *mut _, c"notify::visible".as_ptr() as *const _,
515                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_visible_trampoline::<F> as *const ())), Box_::into_raw(f))
516        }
517    }
518}