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
211/// Trait containing all [`struct@MountOperation`] methods.
212///
213/// # Implementors
214///
215/// [`MountOperation`][struct@crate::MountOperation]
216pub trait MountOperationExt: IsA<MountOperation> + 'static {
217 /// Check to see whether the mount operation is being used
218 /// for an anonymous user.
219 ///
220 /// # Returns
221 ///
222 /// [`true`] if mount operation is anonymous.
223 #[doc(alias = "g_mount_operation_get_anonymous")]
224 #[doc(alias = "get_anonymous")]
225 #[doc(alias = "anonymous")]
226 fn is_anonymous(&self) -> bool {
227 unsafe {
228 from_glib(ffi::g_mount_operation_get_anonymous(
229 self.as_ref().to_glib_none().0,
230 ))
231 }
232 }
233
234 /// Gets a choice from the mount operation.
235 ///
236 /// # Returns
237 ///
238 /// an integer containing an index of the user's choice from
239 /// the choice's list, or `0`.
240 #[doc(alias = "g_mount_operation_get_choice")]
241 #[doc(alias = "get_choice")]
242 fn choice(&self) -> i32 {
243 unsafe { ffi::g_mount_operation_get_choice(self.as_ref().to_glib_none().0) }
244 }
245
246 /// Gets the domain of the mount operation.
247 ///
248 /// # Returns
249 ///
250 /// a string set to the domain.
251 #[doc(alias = "g_mount_operation_get_domain")]
252 #[doc(alias = "get_domain")]
253 fn domain(&self) -> Option<glib::GString> {
254 unsafe {
255 from_glib_none(ffi::g_mount_operation_get_domain(
256 self.as_ref().to_glib_none().0,
257 ))
258 }
259 }
260
261 /// Check to see whether the mount operation is being used
262 /// for a TCRYPT hidden volume.
263 ///
264 /// # Returns
265 ///
266 /// [`true`] if mount operation is for hidden volume.
267 #[cfg(feature = "v2_58")]
268 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
269 #[doc(alias = "g_mount_operation_get_is_tcrypt_hidden_volume")]
270 #[doc(alias = "get_is_tcrypt_hidden_volume")]
271 #[doc(alias = "is-tcrypt-hidden-volume")]
272 fn is_tcrypt_hidden_volume(&self) -> bool {
273 unsafe {
274 from_glib(ffi::g_mount_operation_get_is_tcrypt_hidden_volume(
275 self.as_ref().to_glib_none().0,
276 ))
277 }
278 }
279
280 /// Check to see whether the mount operation is being used
281 /// for a TCRYPT system volume.
282 ///
283 /// # Returns
284 ///
285 /// [`true`] if mount operation is for system volume.
286 #[cfg(feature = "v2_58")]
287 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
288 #[doc(alias = "g_mount_operation_get_is_tcrypt_system_volume")]
289 #[doc(alias = "get_is_tcrypt_system_volume")]
290 #[doc(alias = "is-tcrypt-system-volume")]
291 fn is_tcrypt_system_volume(&self) -> bool {
292 unsafe {
293 from_glib(ffi::g_mount_operation_get_is_tcrypt_system_volume(
294 self.as_ref().to_glib_none().0,
295 ))
296 }
297 }
298
299 /// Gets a password from the mount operation.
300 ///
301 /// # Returns
302 ///
303 /// a string containing the password within @self.
304 #[doc(alias = "g_mount_operation_get_password")]
305 #[doc(alias = "get_password")]
306 fn password(&self) -> Option<glib::GString> {
307 unsafe {
308 from_glib_none(ffi::g_mount_operation_get_password(
309 self.as_ref().to_glib_none().0,
310 ))
311 }
312 }
313
314 /// Gets the state of saving passwords for the mount operation.
315 ///
316 /// # Returns
317 ///
318 /// a #GPasswordSave flag.
319 #[doc(alias = "g_mount_operation_get_password_save")]
320 #[doc(alias = "get_password_save")]
321 #[doc(alias = "password-save")]
322 fn password_save(&self) -> PasswordSave {
323 unsafe {
324 from_glib(ffi::g_mount_operation_get_password_save(
325 self.as_ref().to_glib_none().0,
326 ))
327 }
328 }
329
330 /// Gets a PIM from the mount operation.
331 ///
332 /// # Returns
333 ///
334 /// The VeraCrypt PIM within @self.
335 #[cfg(feature = "v2_58")]
336 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
337 #[doc(alias = "g_mount_operation_get_pim")]
338 #[doc(alias = "get_pim")]
339 fn pim(&self) -> u32 {
340 unsafe { ffi::g_mount_operation_get_pim(self.as_ref().to_glib_none().0) }
341 }
342
343 /// Get the user name from the mount operation.
344 ///
345 /// # Returns
346 ///
347 /// a string containing the user name.
348 #[doc(alias = "g_mount_operation_get_username")]
349 #[doc(alias = "get_username")]
350 fn username(&self) -> Option<glib::GString> {
351 unsafe {
352 from_glib_none(ffi::g_mount_operation_get_username(
353 self.as_ref().to_glib_none().0,
354 ))
355 }
356 }
357
358 /// Emits the #GMountOperation::reply signal.
359 /// ## `result`
360 /// a #GMountOperationResult
361 #[doc(alias = "g_mount_operation_reply")]
362 fn reply(&self, result: MountOperationResult) {
363 unsafe {
364 ffi::g_mount_operation_reply(self.as_ref().to_glib_none().0, result.into_glib());
365 }
366 }
367
368 /// Sets the mount operation to use an anonymous user if @anonymous is [`true`].
369 /// ## `anonymous`
370 /// boolean value.
371 #[doc(alias = "g_mount_operation_set_anonymous")]
372 #[doc(alias = "anonymous")]
373 fn set_anonymous(&self, anonymous: bool) {
374 unsafe {
375 ffi::g_mount_operation_set_anonymous(
376 self.as_ref().to_glib_none().0,
377 anonymous.into_glib(),
378 );
379 }
380 }
381
382 /// Sets a default choice for the mount operation.
383 /// ## `choice`
384 /// an integer.
385 #[doc(alias = "g_mount_operation_set_choice")]
386 #[doc(alias = "choice")]
387 fn set_choice(&self, choice: i32) {
388 unsafe {
389 ffi::g_mount_operation_set_choice(self.as_ref().to_glib_none().0, choice);
390 }
391 }
392
393 /// Sets the mount operation's domain.
394 /// ## `domain`
395 /// the domain to set.
396 #[doc(alias = "g_mount_operation_set_domain")]
397 #[doc(alias = "domain")]
398 fn set_domain(&self, domain: Option<&str>) {
399 unsafe {
400 ffi::g_mount_operation_set_domain(
401 self.as_ref().to_glib_none().0,
402 domain.to_glib_none().0,
403 );
404 }
405 }
406
407 /// Sets the mount operation to use a hidden volume if @hidden_volume is [`true`].
408 /// ## `hidden_volume`
409 /// boolean value.
410 #[cfg(feature = "v2_58")]
411 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
412 #[doc(alias = "g_mount_operation_set_is_tcrypt_hidden_volume")]
413 #[doc(alias = "is-tcrypt-hidden-volume")]
414 fn set_is_tcrypt_hidden_volume(&self, hidden_volume: bool) {
415 unsafe {
416 ffi::g_mount_operation_set_is_tcrypt_hidden_volume(
417 self.as_ref().to_glib_none().0,
418 hidden_volume.into_glib(),
419 );
420 }
421 }
422
423 /// Sets the mount operation to use a system volume if @system_volume is [`true`].
424 /// ## `system_volume`
425 /// boolean value.
426 #[cfg(feature = "v2_58")]
427 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
428 #[doc(alias = "g_mount_operation_set_is_tcrypt_system_volume")]
429 #[doc(alias = "is-tcrypt-system-volume")]
430 fn set_is_tcrypt_system_volume(&self, system_volume: bool) {
431 unsafe {
432 ffi::g_mount_operation_set_is_tcrypt_system_volume(
433 self.as_ref().to_glib_none().0,
434 system_volume.into_glib(),
435 );
436 }
437 }
438
439 /// Sets the mount operation's password to @password.
440 /// ## `password`
441 /// password to set.
442 #[doc(alias = "g_mount_operation_set_password")]
443 #[doc(alias = "password")]
444 fn set_password(&self, password: Option<&str>) {
445 unsafe {
446 ffi::g_mount_operation_set_password(
447 self.as_ref().to_glib_none().0,
448 password.to_glib_none().0,
449 );
450 }
451 }
452
453 /// Sets the state of saving passwords for the mount operation.
454 /// ## `save`
455 /// a set of #GPasswordSave flags.
456 #[doc(alias = "g_mount_operation_set_password_save")]
457 #[doc(alias = "password-save")]
458 fn set_password_save(&self, save: PasswordSave) {
459 unsafe {
460 ffi::g_mount_operation_set_password_save(
461 self.as_ref().to_glib_none().0,
462 save.into_glib(),
463 );
464 }
465 }
466
467 /// Sets the mount operation's PIM to @pim.
468 /// ## `pim`
469 /// an unsigned integer.
470 #[cfg(feature = "v2_58")]
471 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
472 #[doc(alias = "g_mount_operation_set_pim")]
473 #[doc(alias = "pim")]
474 fn set_pim(&self, pim: u32) {
475 unsafe {
476 ffi::g_mount_operation_set_pim(self.as_ref().to_glib_none().0, pim);
477 }
478 }
479
480 /// Sets the user name within @self to @username.
481 /// ## `username`
482 /// input username.
483 #[doc(alias = "g_mount_operation_set_username")]
484 #[doc(alias = "username")]
485 fn set_username(&self, username: Option<&str>) {
486 unsafe {
487 ffi::g_mount_operation_set_username(
488 self.as_ref().to_glib_none().0,
489 username.to_glib_none().0,
490 );
491 }
492 }
493
494 /// Emitted by the backend when e.g. a device becomes unavailable
495 /// while a mount operation is in progress.
496 ///
497 /// Implementations of GMountOperation should handle this signal
498 /// by dismissing open password dialogs.
499 #[doc(alias = "aborted")]
500 fn connect_aborted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
501 unsafe extern "C" fn aborted_trampoline<P: IsA<MountOperation>, F: Fn(&P) + 'static>(
502 this: *mut ffi::GMountOperation,
503 f: glib::ffi::gpointer,
504 ) {
505 let f: &F = &*(f as *const F);
506 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
507 }
508 unsafe {
509 let f: Box_<F> = Box_::new(f);
510 connect_raw(
511 self.as_ptr() as *mut _,
512 c"aborted".as_ptr() as *const _,
513 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
514 aborted_trampoline::<Self, F> as *const (),
515 )),
516 Box_::into_raw(f),
517 )
518 }
519 }
520
521 /// Emitted when a mount operation asks the user for a password.
522 ///
523 /// If the message contains a line break, the first line should be
524 /// presented as a heading. For example, it may be used as the
525 /// primary text in a #GtkMessageDialog.
526 /// ## `message`
527 /// string containing a message to display to the user.
528 /// ## `default_user`
529 /// string containing the default user name.
530 /// ## `default_domain`
531 /// string containing the default domain.
532 /// ## `flags`
533 /// a set of #GAskPasswordFlags.
534 #[doc(alias = "ask-password")]
535 fn connect_ask_password<F: Fn(&Self, &str, &str, &str, AskPasswordFlags) + 'static>(
536 &self,
537 f: F,
538 ) -> SignalHandlerId {
539 unsafe extern "C" fn ask_password_trampoline<
540 P: IsA<MountOperation>,
541 F: Fn(&P, &str, &str, &str, AskPasswordFlags) + 'static,
542 >(
543 this: *mut ffi::GMountOperation,
544 message: *mut std::ffi::c_char,
545 default_user: *mut std::ffi::c_char,
546 default_domain: *mut std::ffi::c_char,
547 flags: ffi::GAskPasswordFlags,
548 f: glib::ffi::gpointer,
549 ) {
550 let f: &F = &*(f as *const F);
551 f(
552 MountOperation::from_glib_borrow(this).unsafe_cast_ref(),
553 &glib::GString::from_glib_borrow(message),
554 &glib::GString::from_glib_borrow(default_user),
555 &glib::GString::from_glib_borrow(default_domain),
556 from_glib(flags),
557 )
558 }
559 unsafe {
560 let f: Box_<F> = Box_::new(f);
561 connect_raw(
562 self.as_ptr() as *mut _,
563 c"ask-password".as_ptr() as *const _,
564 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
565 ask_password_trampoline::<Self, F> as *const (),
566 )),
567 Box_::into_raw(f),
568 )
569 }
570 }
571
572 //#[doc(alias = "ask-question")]
573 //fn connect_ask_question<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
574 // Empty ctype choices: *.CArray TypeId { ns_id: 0, id: 28 }
575 //}
576
577 /// Emitted when the user has replied to the mount operation.
578 /// ## `result`
579 /// a #GMountOperationResult indicating how the request was handled
580 #[doc(alias = "reply")]
581 fn connect_reply<F: Fn(&Self, MountOperationResult) + 'static>(&self, f: F) -> SignalHandlerId {
582 unsafe extern "C" fn reply_trampoline<
583 P: IsA<MountOperation>,
584 F: Fn(&P, MountOperationResult) + 'static,
585 >(
586 this: *mut ffi::GMountOperation,
587 result: ffi::GMountOperationResult,
588 f: glib::ffi::gpointer,
589 ) {
590 let f: &F = &*(f as *const F);
591 f(
592 MountOperation::from_glib_borrow(this).unsafe_cast_ref(),
593 from_glib(result),
594 )
595 }
596 unsafe {
597 let f: Box_<F> = Box_::new(f);
598 connect_raw(
599 self.as_ptr() as *mut _,
600 c"reply".as_ptr() as *const _,
601 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
602 reply_trampoline::<Self, F> as *const (),
603 )),
604 Box_::into_raw(f),
605 )
606 }
607 }
608
609 //#[doc(alias = "show-processes")]
610 //fn connect_show_processes<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
611 // Empty ctype processes: *.Array TypeId { ns_id: 2, id: 4 }
612 // Empty ctype choices: *.CArray TypeId { ns_id: 0, id: 28 }
613 //}
614
615 /// Emitted when an unmount operation has been busy for more than some time
616 /// (typically 1.5 seconds).
617 ///
618 /// When unmounting or ejecting a volume, the kernel might need to flush
619 /// pending data in its buffers to the volume stable storage, and this operation
620 /// can take a considerable amount of time. This signal may be emitted several
621 /// times as long as the unmount operation is outstanding, and then one
622 /// last time when the operation is completed, with @bytes_left set to zero.
623 ///
624 /// Implementations of GMountOperation should handle this signal by
625 /// showing an UI notification, and then dismiss it, or show another notification
626 /// of completion, when @bytes_left reaches zero.
627 ///
628 /// If the message contains a line break, the first line should be
629 /// presented as a heading. For example, it may be used as the
630 /// primary text in a #GtkMessageDialog.
631 /// ## `message`
632 /// string containing a message to display to the user
633 /// ## `time_left`
634 /// the estimated time left before the operation completes,
635 /// in microseconds, or -1
636 /// ## `bytes_left`
637 /// the amount of bytes to be written before the operation
638 /// completes (or -1 if such amount is not known), or zero if the operation
639 /// is completed
640 #[doc(alias = "show-unmount-progress")]
641 fn connect_show_unmount_progress<F: Fn(&Self, &str, i64, i64) + 'static>(
642 &self,
643 f: F,
644 ) -> SignalHandlerId {
645 unsafe extern "C" fn show_unmount_progress_trampoline<
646 P: IsA<MountOperation>,
647 F: Fn(&P, &str, i64, i64) + 'static,
648 >(
649 this: *mut ffi::GMountOperation,
650 message: *mut std::ffi::c_char,
651 time_left: i64,
652 bytes_left: i64,
653 f: glib::ffi::gpointer,
654 ) {
655 let f: &F = &*(f as *const F);
656 f(
657 MountOperation::from_glib_borrow(this).unsafe_cast_ref(),
658 &glib::GString::from_glib_borrow(message),
659 time_left,
660 bytes_left,
661 )
662 }
663 unsafe {
664 let f: Box_<F> = Box_::new(f);
665 connect_raw(
666 self.as_ptr() as *mut _,
667 c"show-unmount-progress".as_ptr() as *const _,
668 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
669 show_unmount_progress_trampoline::<Self, F> as *const (),
670 )),
671 Box_::into_raw(f),
672 )
673 }
674 }
675
676 #[doc(alias = "anonymous")]
677 fn connect_anonymous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
678 unsafe extern "C" fn notify_anonymous_trampoline<
679 P: IsA<MountOperation>,
680 F: Fn(&P) + 'static,
681 >(
682 this: *mut ffi::GMountOperation,
683 _param_spec: glib::ffi::gpointer,
684 f: glib::ffi::gpointer,
685 ) {
686 let f: &F = &*(f as *const F);
687 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
688 }
689 unsafe {
690 let f: Box_<F> = Box_::new(f);
691 connect_raw(
692 self.as_ptr() as *mut _,
693 c"notify::anonymous".as_ptr() as *const _,
694 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
695 notify_anonymous_trampoline::<Self, F> as *const (),
696 )),
697 Box_::into_raw(f),
698 )
699 }
700 }
701
702 #[doc(alias = "choice")]
703 fn connect_choice_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
704 unsafe extern "C" fn notify_choice_trampoline<
705 P: IsA<MountOperation>,
706 F: Fn(&P) + 'static,
707 >(
708 this: *mut ffi::GMountOperation,
709 _param_spec: glib::ffi::gpointer,
710 f: glib::ffi::gpointer,
711 ) {
712 let f: &F = &*(f as *const F);
713 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
714 }
715 unsafe {
716 let f: Box_<F> = Box_::new(f);
717 connect_raw(
718 self.as_ptr() as *mut _,
719 c"notify::choice".as_ptr() as *const _,
720 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
721 notify_choice_trampoline::<Self, F> as *const (),
722 )),
723 Box_::into_raw(f),
724 )
725 }
726 }
727
728 #[doc(alias = "domain")]
729 fn connect_domain_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
730 unsafe extern "C" fn notify_domain_trampoline<
731 P: IsA<MountOperation>,
732 F: Fn(&P) + 'static,
733 >(
734 this: *mut ffi::GMountOperation,
735 _param_spec: glib::ffi::gpointer,
736 f: glib::ffi::gpointer,
737 ) {
738 let f: &F = &*(f as *const F);
739 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
740 }
741 unsafe {
742 let f: Box_<F> = Box_::new(f);
743 connect_raw(
744 self.as_ptr() as *mut _,
745 c"notify::domain".as_ptr() as *const _,
746 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
747 notify_domain_trampoline::<Self, F> as *const (),
748 )),
749 Box_::into_raw(f),
750 )
751 }
752 }
753
754 #[cfg(feature = "v2_58")]
755 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
756 #[doc(alias = "is-tcrypt-hidden-volume")]
757 fn connect_is_tcrypt_hidden_volume_notify<F: Fn(&Self) + 'static>(
758 &self,
759 f: F,
760 ) -> SignalHandlerId {
761 unsafe extern "C" fn notify_is_tcrypt_hidden_volume_trampoline<
762 P: IsA<MountOperation>,
763 F: Fn(&P) + 'static,
764 >(
765 this: *mut ffi::GMountOperation,
766 _param_spec: glib::ffi::gpointer,
767 f: glib::ffi::gpointer,
768 ) {
769 let f: &F = &*(f as *const F);
770 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
771 }
772 unsafe {
773 let f: Box_<F> = Box_::new(f);
774 connect_raw(
775 self.as_ptr() as *mut _,
776 c"notify::is-tcrypt-hidden-volume".as_ptr() as *const _,
777 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
778 notify_is_tcrypt_hidden_volume_trampoline::<Self, F> as *const (),
779 )),
780 Box_::into_raw(f),
781 )
782 }
783 }
784
785 #[cfg(feature = "v2_58")]
786 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
787 #[doc(alias = "is-tcrypt-system-volume")]
788 fn connect_is_tcrypt_system_volume_notify<F: Fn(&Self) + 'static>(
789 &self,
790 f: F,
791 ) -> SignalHandlerId {
792 unsafe extern "C" fn notify_is_tcrypt_system_volume_trampoline<
793 P: IsA<MountOperation>,
794 F: Fn(&P) + 'static,
795 >(
796 this: *mut ffi::GMountOperation,
797 _param_spec: glib::ffi::gpointer,
798 f: glib::ffi::gpointer,
799 ) {
800 let f: &F = &*(f as *const F);
801 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
802 }
803 unsafe {
804 let f: Box_<F> = Box_::new(f);
805 connect_raw(
806 self.as_ptr() as *mut _,
807 c"notify::is-tcrypt-system-volume".as_ptr() as *const _,
808 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
809 notify_is_tcrypt_system_volume_trampoline::<Self, F> as *const (),
810 )),
811 Box_::into_raw(f),
812 )
813 }
814 }
815
816 #[doc(alias = "password")]
817 fn connect_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
818 unsafe extern "C" fn notify_password_trampoline<
819 P: IsA<MountOperation>,
820 F: Fn(&P) + 'static,
821 >(
822 this: *mut ffi::GMountOperation,
823 _param_spec: glib::ffi::gpointer,
824 f: glib::ffi::gpointer,
825 ) {
826 let f: &F = &*(f as *const F);
827 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
828 }
829 unsafe {
830 let f: Box_<F> = Box_::new(f);
831 connect_raw(
832 self.as_ptr() as *mut _,
833 c"notify::password".as_ptr() as *const _,
834 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
835 notify_password_trampoline::<Self, F> as *const (),
836 )),
837 Box_::into_raw(f),
838 )
839 }
840 }
841
842 #[doc(alias = "password-save")]
843 fn connect_password_save_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
844 unsafe extern "C" fn notify_password_save_trampoline<
845 P: IsA<MountOperation>,
846 F: Fn(&P) + 'static,
847 >(
848 this: *mut ffi::GMountOperation,
849 _param_spec: glib::ffi::gpointer,
850 f: glib::ffi::gpointer,
851 ) {
852 let f: &F = &*(f as *const F);
853 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
854 }
855 unsafe {
856 let f: Box_<F> = Box_::new(f);
857 connect_raw(
858 self.as_ptr() as *mut _,
859 c"notify::password-save".as_ptr() as *const _,
860 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
861 notify_password_save_trampoline::<Self, F> as *const (),
862 )),
863 Box_::into_raw(f),
864 )
865 }
866 }
867
868 #[cfg(feature = "v2_58")]
869 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
870 #[doc(alias = "pim")]
871 fn connect_pim_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
872 unsafe extern "C" fn notify_pim_trampoline<P: IsA<MountOperation>, F: Fn(&P) + 'static>(
873 this: *mut ffi::GMountOperation,
874 _param_spec: glib::ffi::gpointer,
875 f: glib::ffi::gpointer,
876 ) {
877 let f: &F = &*(f as *const F);
878 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
879 }
880 unsafe {
881 let f: Box_<F> = Box_::new(f);
882 connect_raw(
883 self.as_ptr() as *mut _,
884 c"notify::pim".as_ptr() as *const _,
885 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
886 notify_pim_trampoline::<Self, F> as *const (),
887 )),
888 Box_::into_raw(f),
889 )
890 }
891 }
892
893 #[doc(alias = "username")]
894 fn connect_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
895 unsafe extern "C" fn notify_username_trampoline<
896 P: IsA<MountOperation>,
897 F: Fn(&P) + 'static,
898 >(
899 this: *mut ffi::GMountOperation,
900 _param_spec: glib::ffi::gpointer,
901 f: glib::ffi::gpointer,
902 ) {
903 let f: &F = &*(f as *const F);
904 f(MountOperation::from_glib_borrow(this).unsafe_cast_ref())
905 }
906 unsafe {
907 let f: Box_<F> = Box_::new(f);
908 connect_raw(
909 self.as_ptr() as *mut _,
910 c"notify::username".as_ptr() as *const _,
911 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
912 notify_username_trampoline::<Self, F> as *const (),
913 )),
914 Box_::into_raw(f),
915 )
916 }
917 }
918}
919
920impl<O: IsA<MountOperation>> MountOperationExt for O {}