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