1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use crate::AsyncResult;
6 use crate::Cancellable;
7 use crate::Drive;
8 use crate::File;
9 use crate::Icon;
10 use crate::MountMountFlags;
11 use crate::MountOperation;
12 use crate::MountUnmountFlags;
13 use crate::Volume;
14 use glib::object::Cast;
15 use glib::object::IsA;
16 use glib::signal::connect_raw;
17 use glib::signal::SignalHandlerId;
18 use glib::translate::*;
19 use std::boxed::Box as Box_;
20 use std::fmt;
21 use std::mem::transmute;
22 use std::pin::Pin;
23 use std::ptr;
24 
25 glib::wrapper! {
26     #[doc(alias = "GMount")]
27     pub struct Mount(Interface<ffi::GMount, ffi::GMountIface>);
28 
29     match fn {
30         type_ => || ffi::g_mount_get_type(),
31     }
32 }
33 
34 pub const NONE_MOUNT: Option<&Mount> = None;
35 
36 pub trait MountExt: 'static {
37     #[doc(alias = "g_mount_can_eject")]
can_eject(&self) -> bool38     fn can_eject(&self) -> bool;
39 
40     #[doc(alias = "g_mount_can_unmount")]
can_unmount(&self) -> bool41     fn can_unmount(&self) -> bool;
42 
43     #[doc(alias = "g_mount_eject_with_operation")]
eject_with_operation< P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), glib::Error>) + Send + 'static, >( &self, flags: MountUnmountFlags, mount_operation: Option<&P>, cancellable: Option<&Q>, callback: R, )44     fn eject_with_operation<
45         P: IsA<MountOperation>,
46         Q: IsA<Cancellable>,
47         R: FnOnce(Result<(), glib::Error>) + Send + 'static,
48     >(
49         &self,
50         flags: MountUnmountFlags,
51         mount_operation: Option<&P>,
52         cancellable: Option<&Q>,
53         callback: R,
54     );
55 
eject_with_operation_future<P: IsA<MountOperation> + Clone + 'static>( &self, flags: MountUnmountFlags, mount_operation: Option<&P>, ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>56     fn eject_with_operation_future<P: IsA<MountOperation> + Clone + 'static>(
57         &self,
58         flags: MountUnmountFlags,
59         mount_operation: Option<&P>,
60     ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>;
61 
62     #[doc(alias = "g_mount_get_default_location")]
63     #[doc(alias = "get_default_location")]
default_location(&self) -> File64     fn default_location(&self) -> File;
65 
66     #[doc(alias = "g_mount_get_drive")]
67     #[doc(alias = "get_drive")]
drive(&self) -> Option<Drive>68     fn drive(&self) -> Option<Drive>;
69 
70     #[doc(alias = "g_mount_get_icon")]
71     #[doc(alias = "get_icon")]
icon(&self) -> Icon72     fn icon(&self) -> Icon;
73 
74     #[doc(alias = "g_mount_get_name")]
75     #[doc(alias = "get_name")]
name(&self) -> glib::GString76     fn name(&self) -> glib::GString;
77 
78     #[doc(alias = "g_mount_get_root")]
79     #[doc(alias = "get_root")]
root(&self) -> File80     fn root(&self) -> File;
81 
82     #[doc(alias = "g_mount_get_sort_key")]
83     #[doc(alias = "get_sort_key")]
sort_key(&self) -> Option<glib::GString>84     fn sort_key(&self) -> Option<glib::GString>;
85 
86     #[doc(alias = "g_mount_get_symbolic_icon")]
87     #[doc(alias = "get_symbolic_icon")]
symbolic_icon(&self) -> Icon88     fn symbolic_icon(&self) -> Icon;
89 
90     #[doc(alias = "g_mount_get_uuid")]
91     #[doc(alias = "get_uuid")]
uuid(&self) -> Option<glib::GString>92     fn uuid(&self) -> Option<glib::GString>;
93 
94     #[doc(alias = "g_mount_get_volume")]
95     #[doc(alias = "get_volume")]
volume(&self) -> Option<Volume>96     fn volume(&self) -> Option<Volume>;
97 
98     #[doc(alias = "g_mount_guess_content_type")]
guess_content_type< P: IsA<Cancellable>, Q: FnOnce(Result<Vec<glib::GString>, glib::Error>) + Send + 'static, >( &self, force_rescan: bool, cancellable: Option<&P>, callback: Q, )99     fn guess_content_type<
100         P: IsA<Cancellable>,
101         Q: FnOnce(Result<Vec<glib::GString>, glib::Error>) + Send + 'static,
102     >(
103         &self,
104         force_rescan: bool,
105         cancellable: Option<&P>,
106         callback: Q,
107     );
108 
guess_content_type_future( &self, force_rescan: bool, ) -> Pin< Box_<dyn std::future::Future<Output = Result<Vec<glib::GString>, glib::Error>> + 'static>, >109     fn guess_content_type_future(
110         &self,
111         force_rescan: bool,
112     ) -> Pin<
113         Box_<dyn std::future::Future<Output = Result<Vec<glib::GString>, glib::Error>> + 'static>,
114     >;
115 
116     #[doc(alias = "g_mount_guess_content_type_sync")]
guess_content_type_sync<P: IsA<Cancellable>>( &self, force_rescan: bool, cancellable: Option<&P>, ) -> Result<Vec<glib::GString>, glib::Error>117     fn guess_content_type_sync<P: IsA<Cancellable>>(
118         &self,
119         force_rescan: bool,
120         cancellable: Option<&P>,
121     ) -> Result<Vec<glib::GString>, glib::Error>;
122 
123     #[doc(alias = "g_mount_is_shadowed")]
is_shadowed(&self) -> bool124     fn is_shadowed(&self) -> bool;
125 
126     #[doc(alias = "g_mount_remount")]
remount< P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), glib::Error>) + Send + 'static, >( &self, flags: MountMountFlags, mount_operation: Option<&P>, cancellable: Option<&Q>, callback: R, )127     fn remount<
128         P: IsA<MountOperation>,
129         Q: IsA<Cancellable>,
130         R: FnOnce(Result<(), glib::Error>) + Send + 'static,
131     >(
132         &self,
133         flags: MountMountFlags,
134         mount_operation: Option<&P>,
135         cancellable: Option<&Q>,
136         callback: R,
137     );
138 
remount_future<P: IsA<MountOperation> + Clone + 'static>( &self, flags: MountMountFlags, mount_operation: Option<&P>, ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>139     fn remount_future<P: IsA<MountOperation> + Clone + 'static>(
140         &self,
141         flags: MountMountFlags,
142         mount_operation: Option<&P>,
143     ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>;
144 
145     #[doc(alias = "g_mount_shadow")]
shadow(&self)146     fn shadow(&self);
147 
148     #[doc(alias = "g_mount_unmount_with_operation")]
unmount_with_operation< P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), glib::Error>) + Send + 'static, >( &self, flags: MountUnmountFlags, mount_operation: Option<&P>, cancellable: Option<&Q>, callback: R, )149     fn unmount_with_operation<
150         P: IsA<MountOperation>,
151         Q: IsA<Cancellable>,
152         R: FnOnce(Result<(), glib::Error>) + Send + 'static,
153     >(
154         &self,
155         flags: MountUnmountFlags,
156         mount_operation: Option<&P>,
157         cancellable: Option<&Q>,
158         callback: R,
159     );
160 
unmount_with_operation_future<P: IsA<MountOperation> + Clone + 'static>( &self, flags: MountUnmountFlags, mount_operation: Option<&P>, ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>161     fn unmount_with_operation_future<P: IsA<MountOperation> + Clone + 'static>(
162         &self,
163         flags: MountUnmountFlags,
164         mount_operation: Option<&P>,
165     ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>;
166 
167     #[doc(alias = "g_mount_unshadow")]
unshadow(&self)168     fn unshadow(&self);
169 
170     #[doc(alias = "changed")]
connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId171     fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
172 
173     #[doc(alias = "pre-unmount")]
connect_pre_unmount<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId174     fn connect_pre_unmount<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
175 
176     #[doc(alias = "unmounted")]
connect_unmounted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId177     fn connect_unmounted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
178 }
179 
180 impl<O: IsA<Mount>> MountExt for O {
can_eject(&self) -> bool181     fn can_eject(&self) -> bool {
182         unsafe { from_glib(ffi::g_mount_can_eject(self.as_ref().to_glib_none().0)) }
183     }
184 
can_unmount(&self) -> bool185     fn can_unmount(&self) -> bool {
186         unsafe { from_glib(ffi::g_mount_can_unmount(self.as_ref().to_glib_none().0)) }
187     }
188 
eject_with_operation< P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), glib::Error>) + Send + 'static, >( &self, flags: MountUnmountFlags, mount_operation: Option<&P>, cancellable: Option<&Q>, callback: R, )189     fn eject_with_operation<
190         P: IsA<MountOperation>,
191         Q: IsA<Cancellable>,
192         R: FnOnce(Result<(), glib::Error>) + Send + 'static,
193     >(
194         &self,
195         flags: MountUnmountFlags,
196         mount_operation: Option<&P>,
197         cancellable: Option<&Q>,
198         callback: R,
199     ) {
200         let user_data: Box_<R> = Box_::new(callback);
201         unsafe extern "C" fn eject_with_operation_trampoline<
202             R: FnOnce(Result<(), glib::Error>) + Send + 'static,
203         >(
204             _source_object: *mut glib::gobject_ffi::GObject,
205             res: *mut crate::ffi::GAsyncResult,
206             user_data: glib::ffi::gpointer,
207         ) {
208             let mut error = ptr::null_mut();
209             let _ =
210                 ffi::g_mount_eject_with_operation_finish(_source_object as *mut _, res, &mut error);
211             let result = if error.is_null() {
212                 Ok(())
213             } else {
214                 Err(from_glib_full(error))
215             };
216             let callback: Box_<R> = Box_::from_raw(user_data as *mut _);
217             callback(result);
218         }
219         let callback = eject_with_operation_trampoline::<R>;
220         unsafe {
221             ffi::g_mount_eject_with_operation(
222                 self.as_ref().to_glib_none().0,
223                 flags.into_glib(),
224                 mount_operation.map(|p| p.as_ref()).to_glib_none().0,
225                 cancellable.map(|p| p.as_ref()).to_glib_none().0,
226                 Some(callback),
227                 Box_::into_raw(user_data) as *mut _,
228             );
229         }
230     }
231 
eject_with_operation_future<P: IsA<MountOperation> + Clone + 'static>( &self, flags: MountUnmountFlags, mount_operation: Option<&P>, ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>232     fn eject_with_operation_future<P: IsA<MountOperation> + Clone + 'static>(
233         &self,
234         flags: MountUnmountFlags,
235         mount_operation: Option<&P>,
236     ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
237         let mount_operation = mount_operation.map(ToOwned::to_owned);
238         Box_::pin(crate::GioFuture::new(
239             self,
240             move |obj, cancellable, send| {
241                 obj.eject_with_operation(
242                     flags,
243                     mount_operation.as_ref().map(::std::borrow::Borrow::borrow),
244                     Some(cancellable),
245                     move |res| {
246                         send.resolve(res);
247                     },
248                 );
249             },
250         ))
251     }
252 
default_location(&self) -> File253     fn default_location(&self) -> File {
254         unsafe {
255             from_glib_full(ffi::g_mount_get_default_location(
256                 self.as_ref().to_glib_none().0,
257             ))
258         }
259     }
260 
drive(&self) -> Option<Drive>261     fn drive(&self) -> Option<Drive> {
262         unsafe { from_glib_full(ffi::g_mount_get_drive(self.as_ref().to_glib_none().0)) }
263     }
264 
icon(&self) -> Icon265     fn icon(&self) -> Icon {
266         unsafe { from_glib_full(ffi::g_mount_get_icon(self.as_ref().to_glib_none().0)) }
267     }
268 
name(&self) -> glib::GString269     fn name(&self) -> glib::GString {
270         unsafe { from_glib_full(ffi::g_mount_get_name(self.as_ref().to_glib_none().0)) }
271     }
272 
root(&self) -> File273     fn root(&self) -> File {
274         unsafe { from_glib_full(ffi::g_mount_get_root(self.as_ref().to_glib_none().0)) }
275     }
276 
sort_key(&self) -> Option<glib::GString>277     fn sort_key(&self) -> Option<glib::GString> {
278         unsafe { from_glib_none(ffi::g_mount_get_sort_key(self.as_ref().to_glib_none().0)) }
279     }
280 
symbolic_icon(&self) -> Icon281     fn symbolic_icon(&self) -> Icon {
282         unsafe {
283             from_glib_full(ffi::g_mount_get_symbolic_icon(
284                 self.as_ref().to_glib_none().0,
285             ))
286         }
287     }
288 
uuid(&self) -> Option<glib::GString>289     fn uuid(&self) -> Option<glib::GString> {
290         unsafe { from_glib_full(ffi::g_mount_get_uuid(self.as_ref().to_glib_none().0)) }
291     }
292 
volume(&self) -> Option<Volume>293     fn volume(&self) -> Option<Volume> {
294         unsafe { from_glib_full(ffi::g_mount_get_volume(self.as_ref().to_glib_none().0)) }
295     }
296 
guess_content_type< P: IsA<Cancellable>, Q: FnOnce(Result<Vec<glib::GString>, glib::Error>) + Send + 'static, >( &self, force_rescan: bool, cancellable: Option<&P>, callback: Q, )297     fn guess_content_type<
298         P: IsA<Cancellable>,
299         Q: FnOnce(Result<Vec<glib::GString>, glib::Error>) + Send + 'static,
300     >(
301         &self,
302         force_rescan: bool,
303         cancellable: Option<&P>,
304         callback: Q,
305     ) {
306         let user_data: Box_<Q> = Box_::new(callback);
307         unsafe extern "C" fn guess_content_type_trampoline<
308             Q: FnOnce(Result<Vec<glib::GString>, glib::Error>) + Send + 'static,
309         >(
310             _source_object: *mut glib::gobject_ffi::GObject,
311             res: *mut crate::ffi::GAsyncResult,
312             user_data: glib::ffi::gpointer,
313         ) {
314             let mut error = ptr::null_mut();
315             let ret =
316                 ffi::g_mount_guess_content_type_finish(_source_object as *mut _, res, &mut error);
317             let result = if error.is_null() {
318                 Ok(FromGlibPtrContainer::from_glib_full(ret))
319             } else {
320                 Err(from_glib_full(error))
321             };
322             let callback: Box_<Q> = Box_::from_raw(user_data as *mut _);
323             callback(result);
324         }
325         let callback = guess_content_type_trampoline::<Q>;
326         unsafe {
327             ffi::g_mount_guess_content_type(
328                 self.as_ref().to_glib_none().0,
329                 force_rescan.into_glib(),
330                 cancellable.map(|p| p.as_ref()).to_glib_none().0,
331                 Some(callback),
332                 Box_::into_raw(user_data) as *mut _,
333             );
334         }
335     }
336 
guess_content_type_future( &self, force_rescan: bool, ) -> Pin< Box_<dyn std::future::Future<Output = Result<Vec<glib::GString>, glib::Error>> + 'static>, >337     fn guess_content_type_future(
338         &self,
339         force_rescan: bool,
340     ) -> Pin<
341         Box_<dyn std::future::Future<Output = Result<Vec<glib::GString>, glib::Error>> + 'static>,
342     > {
343         Box_::pin(crate::GioFuture::new(
344             self,
345             move |obj, cancellable, send| {
346                 obj.guess_content_type(force_rescan, Some(cancellable), move |res| {
347                     send.resolve(res);
348                 });
349             },
350         ))
351     }
352 
guess_content_type_sync<P: IsA<Cancellable>>( &self, force_rescan: bool, cancellable: Option<&P>, ) -> Result<Vec<glib::GString>, glib::Error>353     fn guess_content_type_sync<P: IsA<Cancellable>>(
354         &self,
355         force_rescan: bool,
356         cancellable: Option<&P>,
357     ) -> Result<Vec<glib::GString>, glib::Error> {
358         unsafe {
359             let mut error = ptr::null_mut();
360             let ret = ffi::g_mount_guess_content_type_sync(
361                 self.as_ref().to_glib_none().0,
362                 force_rescan.into_glib(),
363                 cancellable.map(|p| p.as_ref()).to_glib_none().0,
364                 &mut error,
365             );
366             if error.is_null() {
367                 Ok(FromGlibPtrContainer::from_glib_full(ret))
368             } else {
369                 Err(from_glib_full(error))
370             }
371         }
372     }
373 
is_shadowed(&self) -> bool374     fn is_shadowed(&self) -> bool {
375         unsafe { from_glib(ffi::g_mount_is_shadowed(self.as_ref().to_glib_none().0)) }
376     }
377 
remount< P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), glib::Error>) + Send + 'static, >( &self, flags: MountMountFlags, mount_operation: Option<&P>, cancellable: Option<&Q>, callback: R, )378     fn remount<
379         P: IsA<MountOperation>,
380         Q: IsA<Cancellable>,
381         R: FnOnce(Result<(), glib::Error>) + Send + 'static,
382     >(
383         &self,
384         flags: MountMountFlags,
385         mount_operation: Option<&P>,
386         cancellable: Option<&Q>,
387         callback: R,
388     ) {
389         let user_data: Box_<R> = Box_::new(callback);
390         unsafe extern "C" fn remount_trampoline<
391             R: FnOnce(Result<(), glib::Error>) + Send + 'static,
392         >(
393             _source_object: *mut glib::gobject_ffi::GObject,
394             res: *mut crate::ffi::GAsyncResult,
395             user_data: glib::ffi::gpointer,
396         ) {
397             let mut error = ptr::null_mut();
398             let _ = ffi::g_mount_remount_finish(_source_object as *mut _, res, &mut error);
399             let result = if error.is_null() {
400                 Ok(())
401             } else {
402                 Err(from_glib_full(error))
403             };
404             let callback: Box_<R> = Box_::from_raw(user_data as *mut _);
405             callback(result);
406         }
407         let callback = remount_trampoline::<R>;
408         unsafe {
409             ffi::g_mount_remount(
410                 self.as_ref().to_glib_none().0,
411                 flags.into_glib(),
412                 mount_operation.map(|p| p.as_ref()).to_glib_none().0,
413                 cancellable.map(|p| p.as_ref()).to_glib_none().0,
414                 Some(callback),
415                 Box_::into_raw(user_data) as *mut _,
416             );
417         }
418     }
419 
remount_future<P: IsA<MountOperation> + Clone + 'static>( &self, flags: MountMountFlags, mount_operation: Option<&P>, ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>420     fn remount_future<P: IsA<MountOperation> + Clone + 'static>(
421         &self,
422         flags: MountMountFlags,
423         mount_operation: Option<&P>,
424     ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
425         let mount_operation = mount_operation.map(ToOwned::to_owned);
426         Box_::pin(crate::GioFuture::new(
427             self,
428             move |obj, cancellable, send| {
429                 obj.remount(
430                     flags,
431                     mount_operation.as_ref().map(::std::borrow::Borrow::borrow),
432                     Some(cancellable),
433                     move |res| {
434                         send.resolve(res);
435                     },
436                 );
437             },
438         ))
439     }
440 
shadow(&self)441     fn shadow(&self) {
442         unsafe {
443             ffi::g_mount_shadow(self.as_ref().to_glib_none().0);
444         }
445     }
446 
unmount_with_operation< P: IsA<MountOperation>, Q: IsA<Cancellable>, R: FnOnce(Result<(), glib::Error>) + Send + 'static, >( &self, flags: MountUnmountFlags, mount_operation: Option<&P>, cancellable: Option<&Q>, callback: R, )447     fn unmount_with_operation<
448         P: IsA<MountOperation>,
449         Q: IsA<Cancellable>,
450         R: FnOnce(Result<(), glib::Error>) + Send + 'static,
451     >(
452         &self,
453         flags: MountUnmountFlags,
454         mount_operation: Option<&P>,
455         cancellable: Option<&Q>,
456         callback: R,
457     ) {
458         let user_data: Box_<R> = Box_::new(callback);
459         unsafe extern "C" fn unmount_with_operation_trampoline<
460             R: FnOnce(Result<(), glib::Error>) + Send + 'static,
461         >(
462             _source_object: *mut glib::gobject_ffi::GObject,
463             res: *mut crate::ffi::GAsyncResult,
464             user_data: glib::ffi::gpointer,
465         ) {
466             let mut error = ptr::null_mut();
467             let _ = ffi::g_mount_unmount_with_operation_finish(
468                 _source_object as *mut _,
469                 res,
470                 &mut error,
471             );
472             let result = if error.is_null() {
473                 Ok(())
474             } else {
475                 Err(from_glib_full(error))
476             };
477             let callback: Box_<R> = Box_::from_raw(user_data as *mut _);
478             callback(result);
479         }
480         let callback = unmount_with_operation_trampoline::<R>;
481         unsafe {
482             ffi::g_mount_unmount_with_operation(
483                 self.as_ref().to_glib_none().0,
484                 flags.into_glib(),
485                 mount_operation.map(|p| p.as_ref()).to_glib_none().0,
486                 cancellable.map(|p| p.as_ref()).to_glib_none().0,
487                 Some(callback),
488                 Box_::into_raw(user_data) as *mut _,
489             );
490         }
491     }
492 
unmount_with_operation_future<P: IsA<MountOperation> + Clone + 'static>( &self, flags: MountUnmountFlags, mount_operation: Option<&P>, ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>493     fn unmount_with_operation_future<P: IsA<MountOperation> + Clone + 'static>(
494         &self,
495         flags: MountUnmountFlags,
496         mount_operation: Option<&P>,
497     ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
498         let mount_operation = mount_operation.map(ToOwned::to_owned);
499         Box_::pin(crate::GioFuture::new(
500             self,
501             move |obj, cancellable, send| {
502                 obj.unmount_with_operation(
503                     flags,
504                     mount_operation.as_ref().map(::std::borrow::Borrow::borrow),
505                     Some(cancellable),
506                     move |res| {
507                         send.resolve(res);
508                     },
509                 );
510             },
511         ))
512     }
513 
unshadow(&self)514     fn unshadow(&self) {
515         unsafe {
516             ffi::g_mount_unshadow(self.as_ref().to_glib_none().0);
517         }
518     }
519 
connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId520     fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
521         unsafe extern "C" fn changed_trampoline<P: IsA<Mount>, F: Fn(&P) + 'static>(
522             this: *mut ffi::GMount,
523             f: glib::ffi::gpointer,
524         ) {
525             let f: &F = &*(f as *const F);
526             f(Mount::from_glib_borrow(this).unsafe_cast_ref())
527         }
528         unsafe {
529             let f: Box_<F> = Box_::new(f);
530             connect_raw(
531                 self.as_ptr() as *mut _,
532                 b"changed\0".as_ptr() as *const _,
533                 Some(transmute::<_, unsafe extern "C" fn()>(
534                     changed_trampoline::<Self, F> as *const (),
535                 )),
536                 Box_::into_raw(f),
537             )
538         }
539     }
540 
connect_pre_unmount<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId541     fn connect_pre_unmount<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
542         unsafe extern "C" fn pre_unmount_trampoline<P: IsA<Mount>, F: Fn(&P) + 'static>(
543             this: *mut ffi::GMount,
544             f: glib::ffi::gpointer,
545         ) {
546             let f: &F = &*(f as *const F);
547             f(Mount::from_glib_borrow(this).unsafe_cast_ref())
548         }
549         unsafe {
550             let f: Box_<F> = Box_::new(f);
551             connect_raw(
552                 self.as_ptr() as *mut _,
553                 b"pre-unmount\0".as_ptr() as *const _,
554                 Some(transmute::<_, unsafe extern "C" fn()>(
555                     pre_unmount_trampoline::<Self, F> as *const (),
556                 )),
557                 Box_::into_raw(f),
558             )
559         }
560     }
561 
connect_unmounted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId562     fn connect_unmounted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
563         unsafe extern "C" fn unmounted_trampoline<P: IsA<Mount>, F: Fn(&P) + 'static>(
564             this: *mut ffi::GMount,
565             f: glib::ffi::gpointer,
566         ) {
567             let f: &F = &*(f as *const F);
568             f(Mount::from_glib_borrow(this).unsafe_cast_ref())
569         }
570         unsafe {
571             let f: Box_<F> = Box_::new(f);
572             connect_raw(
573                 self.as_ptr() as *mut _,
574                 b"unmounted\0".as_ptr() as *const _,
575                 Some(transmute::<_, unsafe extern "C" fn()>(
576                     unmounted_trampoline::<Self, F> as *const (),
577                 )),
578                 Box_::into_raw(f),
579             )
580         }
581     }
582 }
583 
584 impl fmt::Display for Mount {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result585     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
586         f.write_str("Mount")
587     }
588 }
589