gio/auto/mount_operation.rs
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
5use crate::{ffi, AskPasswordFlags, MountOperationResult, PasswordSave};
6use glib::{
7 object::ObjectType as _,
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 /// `GMountOperation` provides a mechanism for interacting with the user.
16 /// It can be used for authenticating mountable operations, such as loop
17 /// mounting files, hard drive partitions or server locations. It can
18 /// also be used to ask the user questions or show a list of applications
19 /// preventing unmount or eject operations from completing.
20 ///
21 /// Note that `GMountOperation` is used for more than just [`Mount`][crate::Mount]
22 /// objects – for example it is also used in [`DriveExt::start()`][crate::prelude::DriveExt::start()] and
23 /// [`DriveExt::stop()`][crate::prelude::DriveExt::stop()].
24 ///
25 /// Users should instantiate a subclass of this that implements all the
26 /// various callbacks to show the required dialogs, such as
27 /// [`GtkMountOperation`](https://docs.gtk.org/gtk4/class.MountOperation.html).
28 /// If no user interaction is desired (for example when automounting
29 /// filesystems at login time), usually `NULL` can be passed, see each method
30 /// taking a `GMountOperation` for details.
31 ///
32 /// Throughout the API, the term ‘TCRYPT’ is used to mean ‘compatible with TrueCrypt and VeraCrypt’.
33 /// [TrueCrypt](https://en.wikipedia.org/wiki/TrueCrypt) is a discontinued system for
34 /// encrypting file containers, partitions or whole disks, typically used with Windows.
35 /// [VeraCrypt](https://www.veracrypt.fr/) is a maintained fork of TrueCrypt with various
36 /// improvements and auditing fixes.
37 ///
38 /// ## Properties
39 ///
40 ///
41 /// #### `anonymous`
42 /// Whether to use an anonymous user when authenticating.
43 ///
44 /// Readable | Writeable
45 ///
46 ///
47 /// #### `choice`
48 /// The index of the user's choice when a question is asked during the
49 /// mount operation. See the #GMountOperation::ask-question signal.
50 ///
51 /// Readable | Writeable
52 ///
53 ///
54 /// #### `domain`
55 /// The domain to use for the mount operation.
56 ///
57 /// Readable | Writeable
58 ///
59 ///
60 /// #### `is-tcrypt-hidden-volume`
61 /// Whether the device to be unlocked is a TCRYPT hidden volume.
62 /// See [the VeraCrypt documentation](https://www.veracrypt.fr/en/Hidden`20Volume`).
63 ///
64 /// Readable | Writeable
65 ///
66 ///
67 /// #### `is-tcrypt-system-volume`
68 /// Whether the device to be unlocked is a TCRYPT system volume.
69 /// In this context, a system volume is a volume with a bootloader
70 /// and operating system installed. This is only supported for Windows
71 /// operating systems. For further documentation, see
72 /// [the VeraCrypt documentation](https://www.veracrypt.fr/en/System`20Encryption`).
73 ///
74 /// Readable | Writeable
75 ///
76 ///
77 /// #### `password`
78 /// The password that is used for authentication when carrying out
79 /// the mount operation.
80 ///
81 /// Readable | Writeable
82 ///
83 ///
84 /// #### `password-save`
85 /// Determines if and how the password information should be saved.
86 ///
87 /// Readable | Writeable
88 ///
89 ///
90 /// #### `pim`
91 /// The VeraCrypt PIM value, when unlocking a VeraCrypt volume. See
92 /// [the VeraCrypt documentation](https://www.veracrypt.fr/en/Personal`20Iterations``20Multiplier``20`(PIM).html).
93 ///
94 /// Readable | Writeable
95 ///
96 ///
97 /// #### `username`
98 /// The user name that is used for authentication when carrying out
99 /// the mount operation.
100 ///
101 /// Readable | Writeable
102 ///
103 /// ## Signals
104 ///
105 ///
106 /// #### `aborted`
107 /// Emitted by the backend when e.g. a device becomes unavailable
108 /// while a mount operation is in progress.
109 ///
110 /// Implementations of GMountOperation should handle this signal
111 /// by dismissing open password dialogs.
112 ///
113 ///
114 ///
115 ///
116 /// #### `ask-password`
117 /// Emitted when a mount operation asks the user for a password.
118 ///
119 /// If the message contains a line break, the first line should be
120 /// presented as a heading. For example, it may be used as the
121 /// primary text in a #GtkMessageDialog.
122 ///
123 ///
124 ///
125 ///
126 /// #### `ask-question`
127 /// Emitted when asking the user a question and gives a list of
128 /// choices for the user to choose from.
129 ///
130 /// If the message contains a line break, the first line should be
131 /// presented as a heading. For example, it may be used as the
132 /// primary text in a #GtkMessageDialog.
133 ///
134 ///
135 ///
136 ///
137 /// #### `reply`
138 /// Emitted when the user has replied to the mount operation.
139 ///
140 ///
141 ///
142 ///
143 /// #### `show-processes`
144 /// Emitted when one or more processes are blocking an operation
145 /// e.g. unmounting/ejecting a #GMount or stopping a #GDrive.
146 ///
147 /// Note that this signal may be emitted several times to update the
148 /// list of blocking processes as processes close files. The
149 /// application should only respond with g_mount_operation_reply() to
150 /// the latest signal (setting #GMountOperation:choice to the choice
151 /// the user made).
152 ///
153 /// If the message contains a line break, the first line should be
154 /// presented as a heading. For example, it may be used as the
155 /// primary text in a #GtkMessageDialog.
156 ///
157 ///
158 ///
159 ///
160 /// #### `show-unmount-progress`
161 /// Emitted when an unmount operation has been busy for more than some time
162 /// (typically 1.5 seconds).
163 ///
164 /// When unmounting or ejecting a volume, the kernel might need to flush
165 /// pending data in its buffers to the volume stable storage, and this operation
166 /// can take a considerable amount of time. This signal may be emitted several
167 /// times as long as the unmount operation is outstanding, and then one
168 /// last time when the operation is completed, with @bytes_left set to zero.
169 ///
170 /// Implementations of GMountOperation should handle this signal by
171 /// showing an UI notification, and then dismiss it, or show another notification
172 /// of completion, when @bytes_left reaches zero.
173 ///
174 /// If the message contains a line break, the first line should be
175 /// presented as a heading. For example, it may be used as the
176 /// primary text in a #GtkMessageDialog.
177 ///
178 ///
179 ///
180 /// # Implements
181 ///
182 /// [`MountOperationExt`][trait@crate::prelude::MountOperationExt], [`trait@glib::ObjectExt`]
183 #[doc(alias = "GMountOperation")]
184 pub struct MountOperation(Object<ffi::GMountOperation, ffi::GMountOperationClass>);
185
186 match fn {
187 type_ => || ffi::g_mount_operation_get_type(),
188 }
189}
190
191impl MountOperation {
192 pub const NONE: Option<&'static MountOperation> = None;
193
194 /// Creates a new mount operation.
195 ///
196 /// # Returns
197 ///
198 /// a #GMountOperation.
199 #[doc(alias = "g_mount_operation_new")]
200 pub fn new() -> MountOperation {
201 unsafe { from_glib_full(ffi::g_mount_operation_new()) }
202 }
203}
204
205impl Default for MountOperation {
206 fn default() -> Self {
207 Self::new()
208 }
209}
210
211mod sealed {
212 pub trait Sealed {}
213 impl<T: super::IsA<super::MountOperation>> Sealed for T {}
214}
215
216/// Trait containing all [`struct@MountOperation`] methods.
217///
218/// # Implementors
219///
220/// [`MountOperation`][struct@crate::MountOperation]
221pub trait MountOperationExt: IsA<MountOperation> + sealed::Sealed + 'static {
222 /// Check to see whether the mount operation is being used
223 /// for an anonymous user.
224 ///
225 /// # Returns
226 ///
227 /// [`true`] if mount operation is anonymous.
228 #[doc(alias = "g_mount_operation_get_anonymous")]
229 #[doc(alias = "get_anonymous")]
230 #[doc(alias = "anonymous")]
231 fn is_anonymous(&self) -> bool {
232 unsafe {
233 from_glib(ffi::g_mount_operation_get_anonymous(
234 self.as_ref().to_glib_none().0,
235 ))
236 }
237 }
238
239 /// Gets a choice from the mount operation.
240 ///
241 /// # Returns
242 ///
243 /// an integer containing an index of the user's choice from
244 /// the choice's list, or `0`.
245 #[doc(alias = "g_mount_operation_get_choice")]
246 #[doc(alias = "get_choice")]
247 fn choice(&self) -> i32 {
248 unsafe { ffi::g_mount_operation_get_choice(self.as_ref().to_glib_none().0) }
249 }
250
251 /// Gets the domain of the mount operation.
252 ///
253 /// # Returns
254 ///
255 /// a string set to the domain.
256 #[doc(alias = "g_mount_operation_get_domain")]
257 #[doc(alias = "get_domain")]
258 fn domain(&self) -> Option<glib::GString> {
259 unsafe {
260 from_glib_none(ffi::g_mount_operation_get_domain(
261 self.as_ref().to_glib_none().0,
262 ))
263 }
264 }
265
266 /// Check to see whether the mount operation is being used
267 /// for a TCRYPT hidden volume.
268 ///
269 /// # Returns
270 ///
271 /// [`true`] if mount operation is for hidden volume.
272 #[cfg(feature = "v2_58")]
273 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
274 #[doc(alias = "g_mount_operation_get_is_tcrypt_hidden_volume")]
275 #[doc(alias = "get_is_tcrypt_hidden_volume")]
276 #[doc(alias = "is-tcrypt-hidden-volume")]
277 fn is_tcrypt_hidden_volume(&self) -> bool {
278 unsafe {
279 from_glib(ffi::g_mount_operation_get_is_tcrypt_hidden_volume(
280 self.as_ref().to_glib_none().0,
281 ))
282 }
283 }
284
285 /// Check to see whether the mount operation is being used
286 /// for a TCRYPT system volume.
287 ///
288 /// # Returns
289 ///
290 /// [`true`] if mount operation is for system volume.
291 #[cfg(feature = "v2_58")]
292 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
293 #[doc(alias = "g_mount_operation_get_is_tcrypt_system_volume")]
294 #[doc(alias = "get_is_tcrypt_system_volume")]
295 #[doc(alias = "is-tcrypt-system-volume")]
296 fn is_tcrypt_system_volume(&self) -> bool {
297 unsafe {
298 from_glib(ffi::g_mount_operation_get_is_tcrypt_system_volume(
299 self.as_ref().to_glib_none().0,
300 ))
301 }
302 }
303
304 /// Gets a password from the mount operation.
305 ///
306 /// # Returns
307 ///
308 /// a string containing the password within @self.
309 #[doc(alias = "g_mount_operation_get_password")]
310 #[doc(alias = "get_password")]
311 fn password(&self) -> Option<glib::GString> {
312 unsafe {
313 from_glib_none(ffi::g_mount_operation_get_password(
314 self.as_ref().to_glib_none().0,
315 ))
316 }
317 }
318
319 /// Gets the state of saving passwords for the mount operation.
320 ///
321 /// # Returns
322 ///
323 /// a #GPasswordSave flag.
324 #[doc(alias = "g_mount_operation_get_password_save")]
325 #[doc(alias = "get_password_save")]
326 #[doc(alias = "password-save")]
327 fn password_save(&self) -> PasswordSave {
328 unsafe {
329 from_glib(ffi::g_mount_operation_get_password_save(
330 self.as_ref().to_glib_none().0,
331 ))
332 }
333 }
334
335 /// Gets a PIM from the mount operation.
336 ///
337 /// # Returns
338 ///
339 /// The VeraCrypt PIM within @self.
340 #[cfg(feature = "v2_58")]
341 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
342 #[doc(alias = "g_mount_operation_get_pim")]
343 #[doc(alias = "get_pim")]
344 fn pim(&self) -> u32 {
345 unsafe { ffi::g_mount_operation_get_pim(self.as_ref().to_glib_none().0) }
346 }
347
348 /// Get the user name from the mount operation.
349 ///
350 /// # Returns
351 ///
352 /// a string containing the user name.
353 #[doc(alias = "g_mount_operation_get_username")]
354 #[doc(alias = "get_username")]
355 fn username(&self) -> Option<glib::GString> {
356 unsafe {
357 from_glib_none(ffi::g_mount_operation_get_username(
358 self.as_ref().to_glib_none().0,
359 ))
360 }
361 }
362
363 /// Emits the #GMountOperation::reply signal.
364 /// ## `result`
365 /// a #GMountOperationResult
366 #[doc(alias = "g_mount_operation_reply")]
367 fn reply(&self, result: MountOperationResult) {
368 unsafe {
369 ffi::g_mount_operation_reply(self.as_ref().to_glib_none().0, result.into_glib());
370 }
371 }
372
373 /// Sets the mount operation to use an anonymous user if @anonymous is [`true`].
374 /// ## `anonymous`
375 /// boolean value.
376 #[doc(alias = "g_mount_operation_set_anonymous")]
377 #[doc(alias = "anonymous")]
378 fn set_anonymous(&self, anonymous: bool) {
379 unsafe {
380 ffi::g_mount_operation_set_anonymous(
381 self.as_ref().to_glib_none().0,
382 anonymous.into_glib(),
383 );
384 }
385 }
386
387 /// Sets a default choice for the mount operation.
388 /// ## `choice`
389 /// an integer.
390 #[doc(alias = "g_mount_operation_set_choice")]
391 #[doc(alias = "choice")]
392 fn set_choice(&self, choice: i32) {
393 unsafe {
394 ffi::g_mount_operation_set_choice(self.as_ref().to_glib_none().0, choice);
395 }
396 }
397
398 /// Sets the mount operation's domain.
399 /// ## `domain`
400 /// the domain to set.
401 #[doc(alias = "g_mount_operation_set_domain")]
402 #[doc(alias = "domain")]
403 fn set_domain(&self, domain: Option<&str>) {
404 unsafe {
405 ffi::g_mount_operation_set_domain(
406 self.as_ref().to_glib_none().0,
407 domain.to_glib_none().0,
408 );
409 }
410 }
411
412 /// Sets the mount operation to use a hidden volume if @hidden_volume is [`true`].
413 /// ## `hidden_volume`
414 /// boolean value.
415 #[cfg(feature = "v2_58")]
416 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
417 #[doc(alias = "g_mount_operation_set_is_tcrypt_hidden_volume")]
418 #[doc(alias = "is-tcrypt-hidden-volume")]
419 fn set_is_tcrypt_hidden_volume(&self, hidden_volume: bool) {
420 unsafe {
421 ffi::g_mount_operation_set_is_tcrypt_hidden_volume(
422 self.as_ref().to_glib_none().0,
423 hidden_volume.into_glib(),
424 );
425 }
426 }
427
428 /// Sets the mount operation to use a system volume if @system_volume is [`true`].
429 /// ## `system_volume`
430 /// boolean value.
431 #[cfg(feature = "v2_58")]
432 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
433 #[doc(alias = "g_mount_operation_set_is_tcrypt_system_volume")]
434 #[doc(alias = "is-tcrypt-system-volume")]
435 fn set_is_tcrypt_system_volume(&self, system_volume: bool) {
436 unsafe {
437 ffi::g_mount_operation_set_is_tcrypt_system_volume(
438 self.as_ref().to_glib_none().0,
439 system_volume.into_glib(),
440 );
441 }
442 }
443
444 /// Sets the mount operation's password to @password.
445 /// ## `password`
446 /// password to set.
447 #[doc(alias = "g_mount_operation_set_password")]
448 #[doc(alias = "password")]
449 fn set_password(&self, password: Option<&str>) {
450 unsafe {
451 ffi::g_mount_operation_set_password(
452 self.as_ref().to_glib_none().0,
453 password.to_glib_none().0,
454 );
455 }
456 }
457
458 /// Sets the state of saving passwords for the mount operation.
459 /// ## `save`
460 /// a set of #GPasswordSave flags.
461 #[doc(alias = "g_mount_operation_set_password_save")]
462 #[doc(alias = "password-save")]
463 fn set_password_save(&self, save: PasswordSave) {
464 unsafe {
465 ffi::g_mount_operation_set_password_save(
466 self.as_ref().to_glib_none().0,
467 save.into_glib(),
468 );
469 }
470 }
471
472 /// Sets the mount operation's PIM to @pim.
473 /// ## `pim`
474 /// an unsigned integer.
475 #[cfg(feature = "v2_58")]
476 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
477 #[doc(alias = "g_mount_operation_set_pim")]
478 #[doc(alias = "pim")]
479 fn set_pim(&self, pim: u32) {
480 unsafe {
481 ffi::g_mount_operation_set_pim(self.as_ref().to_glib_none().0, pim);
482 }
483 }
484
485 /// Sets the user name within @self to @username.
486 /// ## `username`
487 /// input username.
488 #[doc(alias = "g_mount_operation_set_username")]
489 #[doc(alias = "username")]
490 fn set_username(&self, username: Option<&str>) {
491 unsafe {
492 ffi::g_mount_operation_set_username(
493 self.as_ref().to_glib_none().0,
494 username.to_glib_none().0,
495 );
496 }
497 }
498
499 /// Emitted by the backend when e.g. a device becomes unavailable
500 /// while a mount operation is in progress.
501 ///
502 /// Implementations of GMountOperation should handle this signal
503 /// by dismissing open password dialogs.
504 #[doc(alias = "aborted")]
505 fn connect_aborted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
506 unsafe extern "C" fn aborted_trampoline<P: IsA<MountOperation>, F: Fn(&P) + 'static>(
507 this: *mut ffi::GMountOperation,
508 f: glib::ffi::gpointer,
509 ) {
510 let f: &F = &*(f as *const F);
511 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
512 }
513 unsafe {
514 let f: Box_<F> = Box_::new(f);
515 connect_raw(
516 self.as_ptr() as *mut _,
517 b"aborted\0".as_ptr() as *const _,
518 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
519 aborted_trampoline::<Self, F> as *const (),
520 )),
521 Box_::into_raw(f),
522 )
523 }
524 }
525
526 /// Emitted when a mount operation asks the user for a password.
527 ///
528 /// If the message contains a line break, the first line should be
529 /// presented as a heading. For example, it may be used as the
530 /// primary text in a #GtkMessageDialog.
531 /// ## `message`
532 /// string containing a message to display to the user.
533 /// ## `default_user`
534 /// string containing the default user name.
535 /// ## `default_domain`
536 /// string containing the default domain.
537 /// ## `flags`
538 /// a set of #GAskPasswordFlags.
539 #[doc(alias = "ask-password")]
540 fn connect_ask_password<F: Fn(&Self, &str, &str, &str, AskPasswordFlags) + 'static>(
541 &self,
542 f: F,
543 ) -> SignalHandlerId {
544 unsafe extern "C" fn ask_password_trampoline<
545 P: IsA<MountOperation>,
546 F: Fn(&P, &str, &str, &str, AskPasswordFlags) + 'static,
547 >(
548 this: *mut ffi::GMountOperation,
549 message: *mut std::ffi::c_char,
550 default_user: *mut std::ffi::c_char,
551 default_domain: *mut std::ffi::c_char,
552 flags: ffi::GAskPasswordFlags,
553 f: glib::ffi::gpointer,
554 ) {
555 let f: &F = &*(f as *const F);
556 f(
557 MountOperation::from_glib_borrow(this).unsafe_cast_ref(),
558 &glib::GString::from_glib_borrow(message),
559 &glib::GString::from_glib_borrow(default_user),
560 &glib::GString::from_glib_borrow(default_domain),
561 from_glib(flags),
562 )
563 }
564 unsafe {
565 let f: Box_<F> = Box_::new(f);
566 connect_raw(
567 self.as_ptr() as *mut _,
568 b"ask-password\0".as_ptr() as *const _,
569 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
570 ask_password_trampoline::<Self, F> as *const (),
571 )),
572 Box_::into_raw(f),
573 )
574 }
575 }
576
577 //#[doc(alias = "ask-question")]
578 //fn connect_ask_question<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
579 // Empty ctype choices: *.CArray TypeId { ns_id: 0, id: 28 }
580 //}
581
582 /// Emitted when the user has replied to the mount operation.
583 /// ## `result`
584 /// a #GMountOperationResult indicating how the request was handled
585 #[doc(alias = "reply")]
586 fn connect_reply<F: Fn(&Self, MountOperationResult) + 'static>(&self, f: F) -> SignalHandlerId {
587 unsafe extern "C" fn reply_trampoline<
588 P: IsA<MountOperation>,
589 F: Fn(&P, MountOperationResult) + 'static,
590 >(
591 this: *mut ffi::GMountOperation,
592 result: ffi::GMountOperationResult,
593 f: glib::ffi::gpointer,
594 ) {
595 let f: &F = &*(f as *const F);
596 f(
597 MountOperation::from_glib_borrow(this).unsafe_cast_ref(),
598 from_glib(result),
599 )
600 }
601 unsafe {
602 let f: Box_<F> = Box_::new(f);
603 connect_raw(
604 self.as_ptr() as *mut _,
605 b"reply\0".as_ptr() as *const _,
606 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
607 reply_trampoline::<Self, F> as *const (),
608 )),
609 Box_::into_raw(f),
610 )
611 }
612 }
613
614 //#[doc(alias = "show-processes")]
615 //fn connect_show_processes<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
616 // Empty ctype processes: *.Array TypeId { ns_id: 2, id: 4 }
617 // Empty ctype choices: *.CArray TypeId { ns_id: 0, id: 28 }
618 //}
619
620 /// Emitted when an unmount operation has been busy for more than some time
621 /// (typically 1.5 seconds).
622 ///
623 /// When unmounting or ejecting a volume, the kernel might need to flush
624 /// pending data in its buffers to the volume stable storage, and this operation
625 /// can take a considerable amount of time. This signal may be emitted several
626 /// times as long as the unmount operation is outstanding, and then one
627 /// last time when the operation is completed, with @bytes_left set to zero.
628 ///
629 /// Implementations of GMountOperation should handle this signal by
630 /// showing an UI notification, and then dismiss it, or show another notification
631 /// of completion, when @bytes_left reaches zero.
632 ///
633 /// If the message contains a line break, the first line should be
634 /// presented as a heading. For example, it may be used as the
635 /// primary text in a #GtkMessageDialog.
636 /// ## `message`
637 /// string containing a message to display to the user
638 /// ## `time_left`
639 /// the estimated time left before the operation completes,
640 /// in microseconds, or -1
641 /// ## `bytes_left`
642 /// the amount of bytes to be written before the operation
643 /// completes (or -1 if such amount is not known), or zero if the operation
644 /// is completed
645 #[doc(alias = "show-unmount-progress")]
646 fn connect_show_unmount_progress<F: Fn(&Self, &str, i64, i64) + 'static>(
647 &self,
648 f: F,
649 ) -> SignalHandlerId {
650 unsafe extern "C" fn show_unmount_progress_trampoline<
651 P: IsA<MountOperation>,
652 F: Fn(&P, &str, i64, i64) + 'static,
653 >(
654 this: *mut ffi::GMountOperation,
655 message: *mut std::ffi::c_char,
656 time_left: i64,
657 bytes_left: i64,
658 f: glib::ffi::gpointer,
659 ) {
660 let f: &F = &*(f as *const F);
661 f(
662 MountOperation::from_glib_borrow(this).unsafe_cast_ref(),
663 &glib::GString::from_glib_borrow(message),
664 time_left,
665 bytes_left,
666 )
667 }
668 unsafe {
669 let f: Box_<F> = Box_::new(f);
670 connect_raw(
671 self.as_ptr() as *mut _,
672 b"show-unmount-progress\0".as_ptr() as *const _,
673 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
674 show_unmount_progress_trampoline::<Self, F> as *const (),
675 )),
676 Box_::into_raw(f),
677 )
678 }
679 }
680
681 #[doc(alias = "anonymous")]
682 fn connect_anonymous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
683 unsafe extern "C" fn notify_anonymous_trampoline<
684 P: IsA<MountOperation>,
685 F: Fn(&P) + 'static,
686 >(
687 this: *mut ffi::GMountOperation,
688 _param_spec: glib::ffi::gpointer,
689 f: glib::ffi::gpointer,
690 ) {
691 let f: &F = &*(f as *const F);
692 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
693 }
694 unsafe {
695 let f: Box_<F> = Box_::new(f);
696 connect_raw(
697 self.as_ptr() as *mut _,
698 b"notify::anonymous\0".as_ptr() as *const _,
699 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
700 notify_anonymous_trampoline::<Self, F> as *const (),
701 )),
702 Box_::into_raw(f),
703 )
704 }
705 }
706
707 #[doc(alias = "choice")]
708 fn connect_choice_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
709 unsafe extern "C" fn notify_choice_trampoline<
710 P: IsA<MountOperation>,
711 F: Fn(&P) + 'static,
712 >(
713 this: *mut ffi::GMountOperation,
714 _param_spec: glib::ffi::gpointer,
715 f: glib::ffi::gpointer,
716 ) {
717 let f: &F = &*(f as *const F);
718 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
719 }
720 unsafe {
721 let f: Box_<F> = Box_::new(f);
722 connect_raw(
723 self.as_ptr() as *mut _,
724 b"notify::choice\0".as_ptr() as *const _,
725 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
726 notify_choice_trampoline::<Self, F> as *const (),
727 )),
728 Box_::into_raw(f),
729 )
730 }
731 }
732
733 #[doc(alias = "domain")]
734 fn connect_domain_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
735 unsafe extern "C" fn notify_domain_trampoline<
736 P: IsA<MountOperation>,
737 F: Fn(&P) + 'static,
738 >(
739 this: *mut ffi::GMountOperation,
740 _param_spec: glib::ffi::gpointer,
741 f: glib::ffi::gpointer,
742 ) {
743 let f: &F = &*(f as *const F);
744 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
745 }
746 unsafe {
747 let f: Box_<F> = Box_::new(f);
748 connect_raw(
749 self.as_ptr() as *mut _,
750 b"notify::domain\0".as_ptr() as *const _,
751 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
752 notify_domain_trampoline::<Self, F> as *const (),
753 )),
754 Box_::into_raw(f),
755 )
756 }
757 }
758
759 #[cfg(feature = "v2_58")]
760 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
761 #[doc(alias = "is-tcrypt-hidden-volume")]
762 fn connect_is_tcrypt_hidden_volume_notify<F: Fn(&Self) + 'static>(
763 &self,
764 f: F,
765 ) -> SignalHandlerId {
766 unsafe extern "C" fn notify_is_tcrypt_hidden_volume_trampoline<
767 P: IsA<MountOperation>,
768 F: Fn(&P) + 'static,
769 >(
770 this: *mut ffi::GMountOperation,
771 _param_spec: glib::ffi::gpointer,
772 f: glib::ffi::gpointer,
773 ) {
774 let f: &F = &*(f as *const F);
775 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
776 }
777 unsafe {
778 let f: Box_<F> = Box_::new(f);
779 connect_raw(
780 self.as_ptr() as *mut _,
781 b"notify::is-tcrypt-hidden-volume\0".as_ptr() as *const _,
782 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
783 notify_is_tcrypt_hidden_volume_trampoline::<Self, F> as *const (),
784 )),
785 Box_::into_raw(f),
786 )
787 }
788 }
789
790 #[cfg(feature = "v2_58")]
791 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
792 #[doc(alias = "is-tcrypt-system-volume")]
793 fn connect_is_tcrypt_system_volume_notify<F: Fn(&Self) + 'static>(
794 &self,
795 f: F,
796 ) -> SignalHandlerId {
797 unsafe extern "C" fn notify_is_tcrypt_system_volume_trampoline<
798 P: IsA<MountOperation>,
799 F: Fn(&P) + 'static,
800 >(
801 this: *mut ffi::GMountOperation,
802 _param_spec: glib::ffi::gpointer,
803 f: glib::ffi::gpointer,
804 ) {
805 let f: &F = &*(f as *const F);
806 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
807 }
808 unsafe {
809 let f: Box_<F> = Box_::new(f);
810 connect_raw(
811 self.as_ptr() as *mut _,
812 b"notify::is-tcrypt-system-volume\0".as_ptr() as *const _,
813 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
814 notify_is_tcrypt_system_volume_trampoline::<Self, F> as *const (),
815 )),
816 Box_::into_raw(f),
817 )
818 }
819 }
820
821 #[doc(alias = "password")]
822 fn connect_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
823 unsafe extern "C" fn notify_password_trampoline<
824 P: IsA<MountOperation>,
825 F: Fn(&P) + 'static,
826 >(
827 this: *mut ffi::GMountOperation,
828 _param_spec: glib::ffi::gpointer,
829 f: glib::ffi::gpointer,
830 ) {
831 let f: &F = &*(f as *const F);
832 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
833 }
834 unsafe {
835 let f: Box_<F> = Box_::new(f);
836 connect_raw(
837 self.as_ptr() as *mut _,
838 b"notify::password\0".as_ptr() as *const _,
839 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
840 notify_password_trampoline::<Self, F> as *const (),
841 )),
842 Box_::into_raw(f),
843 )
844 }
845 }
846
847 #[doc(alias = "password-save")]
848 fn connect_password_save_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
849 unsafe extern "C" fn notify_password_save_trampoline<
850 P: IsA<MountOperation>,
851 F: Fn(&P) + 'static,
852 >(
853 this: *mut ffi::GMountOperation,
854 _param_spec: glib::ffi::gpointer,
855 f: glib::ffi::gpointer,
856 ) {
857 let f: &F = &*(f as *const F);
858 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
859 }
860 unsafe {
861 let f: Box_<F> = Box_::new(f);
862 connect_raw(
863 self.as_ptr() as *mut _,
864 b"notify::password-save\0".as_ptr() as *const _,
865 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
866 notify_password_save_trampoline::<Self, F> as *const (),
867 )),
868 Box_::into_raw(f),
869 )
870 }
871 }
872
873 #[cfg(feature = "v2_58")]
874 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
875 #[doc(alias = "pim")]
876 fn connect_pim_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
877 unsafe extern "C" fn notify_pim_trampoline<P: IsA<MountOperation>, F: Fn(&P) + 'static>(
878 this: *mut ffi::GMountOperation,
879 _param_spec: glib::ffi::gpointer,
880 f: glib::ffi::gpointer,
881 ) {
882 let f: &F = &*(f as *const F);
883 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
884 }
885 unsafe {
886 let f: Box_<F> = Box_::new(f);
887 connect_raw(
888 self.as_ptr() as *mut _,
889 b"notify::pim\0".as_ptr() as *const _,
890 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
891 notify_pim_trampoline::<Self, F> as *const (),
892 )),
893 Box_::into_raw(f),
894 )
895 }
896 }
897
898 #[doc(alias = "username")]
899 fn connect_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
900 unsafe extern "C" fn notify_username_trampoline<
901 P: IsA<MountOperation>,
902 F: Fn(&P) + 'static,
903 >(
904 this: *mut ffi::GMountOperation,
905 _param_spec: glib::ffi::gpointer,
906 f: glib::ffi::gpointer,
907 ) {
908 let f: &F = &*(f as *const F);
909 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
910 }
911 unsafe {
912 let f: Box_<F> = Box_::new(f);
913 connect_raw(
914 self.as_ptr() as *mut _,
915 b"notify::username\0".as_ptr() as *const _,
916 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
917 notify_username_trampoline::<Self, F> as *const (),
918 )),
919 Box_::into_raw(f),
920 )
921 }
922 }
923}
924
925impl<O: IsA<MountOperation>> MountOperationExt for O {}