gio/auto/
mount_operation.rs

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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{ffi, AskPasswordFlags, MountOperationResult, PasswordSave};
use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    /// `GMountOperation` provides a mechanism for interacting with the user.
    /// It can be used for authenticating mountable operations, such as loop
    /// mounting files, hard drive partitions or server locations. It can
    /// also be used to ask the user questions or show a list of applications
    /// preventing unmount or eject operations from completing.
    ///
    /// Note that `GMountOperation` is used for more than just [`Mount`][crate::Mount]
    /// objects – for example it is also used in [`DriveExt::start()`][crate::prelude::DriveExt::start()] and
    /// [`DriveExt::stop()`][crate::prelude::DriveExt::stop()].
    ///
    /// Users should instantiate a subclass of this that implements all the
    /// various callbacks to show the required dialogs, such as
    /// [`GtkMountOperation`](https://docs.gtk.org/gtk4/class.MountOperation.html).
    /// If no user interaction is desired (for example when automounting
    /// filesystems at login time), usually `NULL` can be passed, see each method
    /// taking a `GMountOperation` for details.
    ///
    /// Throughout the API, the term ‘TCRYPT’ is used to mean ‘compatible with TrueCrypt and VeraCrypt’.
    /// [TrueCrypt](https://en.wikipedia.org/wiki/TrueCrypt) is a discontinued system for
    /// encrypting file containers, partitions or whole disks, typically used with Windows.
    /// [VeraCrypt](https://www.veracrypt.fr/) is a maintained fork of TrueCrypt with various
    /// improvements and auditing fixes.
    ///
    /// ## Properties
    ///
    ///
    /// #### `anonymous`
    ///  Whether to use an anonymous user when authenticating.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `choice`
    ///  The index of the user's choice when a question is asked during the
    /// mount operation. See the #GMountOperation::ask-question signal.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `domain`
    ///  The domain to use for the mount operation.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `is-tcrypt-hidden-volume`
    ///  Whether the device to be unlocked is a TCRYPT hidden volume.
    /// See [the VeraCrypt documentation](https://www.veracrypt.fr/en/Hidden`20Volume`).
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `is-tcrypt-system-volume`
    ///  Whether the device to be unlocked is a TCRYPT system volume.
    /// In this context, a system volume is a volume with a bootloader
    /// and operating system installed. This is only supported for Windows
    /// operating systems. For further documentation, see
    /// [the VeraCrypt documentation](https://www.veracrypt.fr/en/System`20Encryption`).
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `password`
    ///  The password that is used for authentication when carrying out
    /// the mount operation.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `password-save`
    ///  Determines if and how the password information should be saved.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `pim`
    ///  The VeraCrypt PIM value, when unlocking a VeraCrypt volume. See
    /// [the VeraCrypt documentation](https://www.veracrypt.fr/en/Personal`20Iterations``20Multiplier``20`(PIM).html).
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `username`
    ///  The user name that is used for authentication when carrying out
    /// the mount operation.
    ///
    /// Readable | Writeable
    ///
    /// ## Signals
    ///
    ///
    /// #### `aborted`
    ///  Emitted by the backend when e.g. a device becomes unavailable
    /// while a mount operation is in progress.
    ///
    /// Implementations of GMountOperation should handle this signal
    /// by dismissing open password dialogs.
    ///
    ///
    ///
    ///
    /// #### `ask-password`
    ///  Emitted when a mount operation asks the user for a password.
    ///
    /// If the message contains a line break, the first line should be
    /// presented as a heading. For example, it may be used as the
    /// primary text in a #GtkMessageDialog.
    ///
    ///
    ///
    ///
    /// #### `ask-question`
    ///  Emitted when asking the user a question and gives a list of
    /// choices for the user to choose from.
    ///
    /// If the message contains a line break, the first line should be
    /// presented as a heading. For example, it may be used as the
    /// primary text in a #GtkMessageDialog.
    ///
    ///
    ///
    ///
    /// #### `reply`
    ///  Emitted when the user has replied to the mount operation.
    ///
    ///
    ///
    ///
    /// #### `show-processes`
    ///  Emitted when one or more processes are blocking an operation
    /// e.g. unmounting/ejecting a #GMount or stopping a #GDrive.
    ///
    /// Note that this signal may be emitted several times to update the
    /// list of blocking processes as processes close files. The
    /// application should only respond with g_mount_operation_reply() to
    /// the latest signal (setting #GMountOperation:choice to the choice
    /// the user made).
    ///
    /// If the message contains a line break, the first line should be
    /// presented as a heading. For example, it may be used as the
    /// primary text in a #GtkMessageDialog.
    ///
    ///
    ///
    ///
    /// #### `show-unmount-progress`
    ///  Emitted when an unmount operation has been busy for more than some time
    /// (typically 1.5 seconds).
    ///
    /// When unmounting or ejecting a volume, the kernel might need to flush
    /// pending data in its buffers to the volume stable storage, and this operation
    /// can take a considerable amount of time. This signal may be emitted several
    /// times as long as the unmount operation is outstanding, and then one
    /// last time when the operation is completed, with @bytes_left set to zero.
    ///
    /// Implementations of GMountOperation should handle this signal by
    /// showing an UI notification, and then dismiss it, or show another notification
    /// of completion, when @bytes_left reaches zero.
    ///
    /// If the message contains a line break, the first line should be
    /// presented as a heading. For example, it may be used as the
    /// primary text in a #GtkMessageDialog.
    ///
    ///
    ///
    /// # Implements
    ///
    /// [`MountOperationExt`][trait@crate::prelude::MountOperationExt], [`trait@glib::ObjectExt`]
    #[doc(alias = "GMountOperation")]
    pub struct MountOperation(Object<ffi::GMountOperation, ffi::GMountOperationClass>);

    match fn {
        type_ => || ffi::g_mount_operation_get_type(),
    }
}

impl MountOperation {
    pub const NONE: Option<&'static MountOperation> = None;

    /// Creates a new mount operation.
    ///
    /// # Returns
    ///
    /// a #GMountOperation.
    #[doc(alias = "g_mount_operation_new")]
    pub fn new() -> MountOperation {
        unsafe { from_glib_full(ffi::g_mount_operation_new()) }
    }
}

impl Default for MountOperation {
    fn default() -> Self {
        Self::new()
    }
}

/// Trait containing all [`struct@MountOperation`] methods.
///
/// # Implementors
///
/// [`MountOperation`][struct@crate::MountOperation]
pub trait MountOperationExt: IsA<MountOperation> + 'static {
    /// Check to see whether the mount operation is being used
    /// for an anonymous user.
    ///
    /// # Returns
    ///
    /// [`true`] if mount operation is anonymous.
    #[doc(alias = "g_mount_operation_get_anonymous")]
    #[doc(alias = "get_anonymous")]
    #[doc(alias = "anonymous")]
    fn is_anonymous(&self) -> bool {
        unsafe {
            from_glib(ffi::g_mount_operation_get_anonymous(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets a choice from the mount operation.
    ///
    /// # Returns
    ///
    /// an integer containing an index of the user's choice from
    /// the choice's list, or `0`.
    #[doc(alias = "g_mount_operation_get_choice")]
    #[doc(alias = "get_choice")]
    fn choice(&self) -> i32 {
        unsafe { ffi::g_mount_operation_get_choice(self.as_ref().to_glib_none().0) }
    }

    /// Gets the domain of the mount operation.
    ///
    /// # Returns
    ///
    /// a string set to the domain.
    #[doc(alias = "g_mount_operation_get_domain")]
    #[doc(alias = "get_domain")]
    fn domain(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::g_mount_operation_get_domain(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Check to see whether the mount operation is being used
    /// for a TCRYPT hidden volume.
    ///
    /// # Returns
    ///
    /// [`true`] if mount operation is for hidden volume.
    #[cfg(feature = "v2_58")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
    #[doc(alias = "g_mount_operation_get_is_tcrypt_hidden_volume")]
    #[doc(alias = "get_is_tcrypt_hidden_volume")]
    #[doc(alias = "is-tcrypt-hidden-volume")]
    fn is_tcrypt_hidden_volume(&self) -> bool {
        unsafe {
            from_glib(ffi::g_mount_operation_get_is_tcrypt_hidden_volume(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Check to see whether the mount operation is being used
    /// for a TCRYPT system volume.
    ///
    /// # Returns
    ///
    /// [`true`] if mount operation is for system volume.
    #[cfg(feature = "v2_58")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
    #[doc(alias = "g_mount_operation_get_is_tcrypt_system_volume")]
    #[doc(alias = "get_is_tcrypt_system_volume")]
    #[doc(alias = "is-tcrypt-system-volume")]
    fn is_tcrypt_system_volume(&self) -> bool {
        unsafe {
            from_glib(ffi::g_mount_operation_get_is_tcrypt_system_volume(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets a password from the mount operation.
    ///
    /// # Returns
    ///
    /// a string containing the password within @self.
    #[doc(alias = "g_mount_operation_get_password")]
    #[doc(alias = "get_password")]
    fn password(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::g_mount_operation_get_password(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets the state of saving passwords for the mount operation.
    ///
    /// # Returns
    ///
    /// a #GPasswordSave flag.
    #[doc(alias = "g_mount_operation_get_password_save")]
    #[doc(alias = "get_password_save")]
    #[doc(alias = "password-save")]
    fn password_save(&self) -> PasswordSave {
        unsafe {
            from_glib(ffi::g_mount_operation_get_password_save(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets a PIM from the mount operation.
    ///
    /// # Returns
    ///
    /// The VeraCrypt PIM within @self.
    #[cfg(feature = "v2_58")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
    #[doc(alias = "g_mount_operation_get_pim")]
    #[doc(alias = "get_pim")]
    fn pim(&self) -> u32 {
        unsafe { ffi::g_mount_operation_get_pim(self.as_ref().to_glib_none().0) }
    }

    /// Get the user name from the mount operation.
    ///
    /// # Returns
    ///
    /// a string containing the user name.
    #[doc(alias = "g_mount_operation_get_username")]
    #[doc(alias = "get_username")]
    fn username(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::g_mount_operation_get_username(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Emits the #GMountOperation::reply signal.
    /// ## `result`
    /// a #GMountOperationResult
    #[doc(alias = "g_mount_operation_reply")]
    fn reply(&self, result: MountOperationResult) {
        unsafe {
            ffi::g_mount_operation_reply(self.as_ref().to_glib_none().0, result.into_glib());
        }
    }

    /// Sets the mount operation to use an anonymous user if @anonymous is [`true`].
    /// ## `anonymous`
    /// boolean value.
    #[doc(alias = "g_mount_operation_set_anonymous")]
    #[doc(alias = "anonymous")]
    fn set_anonymous(&self, anonymous: bool) {
        unsafe {
            ffi::g_mount_operation_set_anonymous(
                self.as_ref().to_glib_none().0,
                anonymous.into_glib(),
            );
        }
    }

    /// Sets a default choice for the mount operation.
    /// ## `choice`
    /// an integer.
    #[doc(alias = "g_mount_operation_set_choice")]
    #[doc(alias = "choice")]
    fn set_choice(&self, choice: i32) {
        unsafe {
            ffi::g_mount_operation_set_choice(self.as_ref().to_glib_none().0, choice);
        }
    }

    /// Sets the mount operation's domain.
    /// ## `domain`
    /// the domain to set.
    #[doc(alias = "g_mount_operation_set_domain")]
    #[doc(alias = "domain")]
    fn set_domain(&self, domain: Option<&str>) {
        unsafe {
            ffi::g_mount_operation_set_domain(
                self.as_ref().to_glib_none().0,
                domain.to_glib_none().0,
            );
        }
    }

    /// Sets the mount operation to use a hidden volume if @hidden_volume is [`true`].
    /// ## `hidden_volume`
    /// boolean value.
    #[cfg(feature = "v2_58")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
    #[doc(alias = "g_mount_operation_set_is_tcrypt_hidden_volume")]
    #[doc(alias = "is-tcrypt-hidden-volume")]
    fn set_is_tcrypt_hidden_volume(&self, hidden_volume: bool) {
        unsafe {
            ffi::g_mount_operation_set_is_tcrypt_hidden_volume(
                self.as_ref().to_glib_none().0,
                hidden_volume.into_glib(),
            );
        }
    }

    /// Sets the mount operation to use a system volume if @system_volume is [`true`].
    /// ## `system_volume`
    /// boolean value.
    #[cfg(feature = "v2_58")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
    #[doc(alias = "g_mount_operation_set_is_tcrypt_system_volume")]
    #[doc(alias = "is-tcrypt-system-volume")]
    fn set_is_tcrypt_system_volume(&self, system_volume: bool) {
        unsafe {
            ffi::g_mount_operation_set_is_tcrypt_system_volume(
                self.as_ref().to_glib_none().0,
                system_volume.into_glib(),
            );
        }
    }

    /// Sets the mount operation's password to @password.
    /// ## `password`
    /// password to set.
    #[doc(alias = "g_mount_operation_set_password")]
    #[doc(alias = "password")]
    fn set_password(&self, password: Option<&str>) {
        unsafe {
            ffi::g_mount_operation_set_password(
                self.as_ref().to_glib_none().0,
                password.to_glib_none().0,
            );
        }
    }

    /// Sets the state of saving passwords for the mount operation.
    /// ## `save`
    /// a set of #GPasswordSave flags.
    #[doc(alias = "g_mount_operation_set_password_save")]
    #[doc(alias = "password-save")]
    fn set_password_save(&self, save: PasswordSave) {
        unsafe {
            ffi::g_mount_operation_set_password_save(
                self.as_ref().to_glib_none().0,
                save.into_glib(),
            );
        }
    }

    /// Sets the mount operation's PIM to @pim.
    /// ## `pim`
    /// an unsigned integer.
    #[cfg(feature = "v2_58")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
    #[doc(alias = "g_mount_operation_set_pim")]
    #[doc(alias = "pim")]
    fn set_pim(&self, pim: u32) {
        unsafe {
            ffi::g_mount_operation_set_pim(self.as_ref().to_glib_none().0, pim);
        }
    }

    /// Sets the user name within @self to @username.
    /// ## `username`
    /// input username.
    #[doc(alias = "g_mount_operation_set_username")]
    #[doc(alias = "username")]
    fn set_username(&self, username: Option<&str>) {
        unsafe {
            ffi::g_mount_operation_set_username(
                self.as_ref().to_glib_none().0,
                username.to_glib_none().0,
            );
        }
    }

    /// Emitted by the backend when e.g. a device becomes unavailable
    /// while a mount operation is in progress.
    ///
    /// Implementations of GMountOperation should handle this signal
    /// by dismissing open password dialogs.
    #[doc(alias = "aborted")]
    fn connect_aborted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn aborted_trampoline<P: IsA<MountOperation>, F: Fn(&P) + 'static>(
            this: *mut ffi::GMountOperation,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"aborted".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    aborted_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    /// Emitted when a mount operation asks the user for a password.
    ///
    /// If the message contains a line break, the first line should be
    /// presented as a heading. For example, it may be used as the
    /// primary text in a #GtkMessageDialog.
    /// ## `message`
    /// string containing a message to display to the user.
    /// ## `default_user`
    /// string containing the default user name.
    /// ## `default_domain`
    /// string containing the default domain.
    /// ## `flags`
    /// a set of #GAskPasswordFlags.
    #[doc(alias = "ask-password")]
    fn connect_ask_password<F: Fn(&Self, &str, &str, &str, AskPasswordFlags) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn ask_password_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P, &str, &str, &str, AskPasswordFlags) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            message: *mut std::ffi::c_char,
            default_user: *mut std::ffi::c_char,
            default_domain: *mut std::ffi::c_char,
            flags: ffi::GAskPasswordFlags,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                MountOperation::from_glib_borrow(this).unsafe_cast_ref(),
                &glib::GString::from_glib_borrow(message),
                &glib::GString::from_glib_borrow(default_user),
                &glib::GString::from_glib_borrow(default_domain),
                from_glib(flags),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"ask-password".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    ask_password_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    //#[doc(alias = "ask-question")]
    //fn connect_ask_question<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
    //    Empty ctype choices: *.CArray TypeId { ns_id: 0, id: 28 }
    //}

    /// Emitted when the user has replied to the mount operation.
    /// ## `result`
    /// a #GMountOperationResult indicating how the request was handled
    #[doc(alias = "reply")]
    fn connect_reply<F: Fn(&Self, MountOperationResult) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn reply_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P, MountOperationResult) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            result: ffi::GMountOperationResult,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                MountOperation::from_glib_borrow(this).unsafe_cast_ref(),
                from_glib(result),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"reply".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    reply_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    //#[doc(alias = "show-processes")]
    //fn connect_show_processes<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
    //    Empty ctype processes: *.Array TypeId { ns_id: 2, id: 4 }
    //    Empty ctype choices: *.CArray TypeId { ns_id: 0, id: 28 }
    //}

    /// Emitted when an unmount operation has been busy for more than some time
    /// (typically 1.5 seconds).
    ///
    /// When unmounting or ejecting a volume, the kernel might need to flush
    /// pending data in its buffers to the volume stable storage, and this operation
    /// can take a considerable amount of time. This signal may be emitted several
    /// times as long as the unmount operation is outstanding, and then one
    /// last time when the operation is completed, with @bytes_left set to zero.
    ///
    /// Implementations of GMountOperation should handle this signal by
    /// showing an UI notification, and then dismiss it, or show another notification
    /// of completion, when @bytes_left reaches zero.
    ///
    /// If the message contains a line break, the first line should be
    /// presented as a heading. For example, it may be used as the
    /// primary text in a #GtkMessageDialog.
    /// ## `message`
    /// string containing a message to display to the user
    /// ## `time_left`
    /// the estimated time left before the operation completes,
    ///     in microseconds, or -1
    /// ## `bytes_left`
    /// the amount of bytes to be written before the operation
    ///     completes (or -1 if such amount is not known), or zero if the operation
    ///     is completed
    #[doc(alias = "show-unmount-progress")]
    fn connect_show_unmount_progress<F: Fn(&Self, &str, i64, i64) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn show_unmount_progress_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P, &str, i64, i64) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            message: *mut std::ffi::c_char,
            time_left: i64,
            bytes_left: i64,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                MountOperation::from_glib_borrow(this).unsafe_cast_ref(),
                &glib::GString::from_glib_borrow(message),
                time_left,
                bytes_left,
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"show-unmount-progress".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    show_unmount_progress_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "anonymous")]
    fn connect_anonymous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_anonymous_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::anonymous".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_anonymous_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "choice")]
    fn connect_choice_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_choice_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::choice".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_choice_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "domain")]
    fn connect_domain_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_domain_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::domain".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_domain_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v2_58")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
    #[doc(alias = "is-tcrypt-hidden-volume")]
    fn connect_is_tcrypt_hidden_volume_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_is_tcrypt_hidden_volume_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::is-tcrypt-hidden-volume".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_is_tcrypt_hidden_volume_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v2_58")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
    #[doc(alias = "is-tcrypt-system-volume")]
    fn connect_is_tcrypt_system_volume_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_is_tcrypt_system_volume_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::is-tcrypt-system-volume".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_is_tcrypt_system_volume_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "password")]
    fn connect_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_password_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::password".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_password_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "password-save")]
    fn connect_password_save_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_password_save_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::password-save".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_password_save_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v2_58")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
    #[doc(alias = "pim")]
    fn connect_pim_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_pim_trampoline<P: IsA<MountOperation>, F: Fn(&P) + 'static>(
            this: *mut ffi::GMountOperation,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::pim".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_pim_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "username")]
    fn connect_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_username_trampoline<
            P: IsA<MountOperation>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GMountOperation,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::username".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_username_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<MountOperation>> MountOperationExt for O {}