MountOperation#
Superclasses: Object
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
objects – for example it is also used in start
and
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 is a discontinued system for encrypting file containers, partitions or whole disks, typically used with Windows. VeraCrypt is a maintained fork of TrueCrypt with various improvements and auditing fixes.
Constructors#
- class MountOperation
- classmethod new() MountOperation #
Creates a new mount operation.
Methods#
- class MountOperation
- get_anonymous() bool #
Check to see whether the mount operation is being used for an anonymous user.
Check to see whether the mount operation is being used for a TCRYPT hidden volume.
Added in version 2.58.
- get_is_tcrypt_system_volume() bool #
Check to see whether the mount operation is being used for a TCRYPT system volume.
Added in version 2.58.
- get_password_save() PasswordSave #
Gets the state of saving passwords for the mount operation.
- reply(result: MountOperationResult) None #
Emits the
MountOperation
::reply signal.- Parameters:
result – a
MountOperationResult
- set_anonymous(anonymous: bool) None #
Sets the mount operation to use an anonymous user if
anonymous
isTrue
.- Parameters:
anonymous – boolean value.
- set_choice(choice: int) None #
Sets a default choice for the mount operation.
- Parameters:
choice – an integer.
- set_domain(domain: str | None = None) None #
Sets the mount operation’s domain.
- Parameters:
domain – the domain to set.
Sets the mount operation to use a hidden volume if
hidden_volume
isTrue
.Added in version 2.58.
- Parameters:
hidden_volume – boolean value.
- set_is_tcrypt_system_volume(system_volume: bool) None #
Sets the mount operation to use a system volume if
system_volume
isTrue
.Added in version 2.58.
- Parameters:
system_volume – boolean value.
- set_password(password: str | None = None) None #
Sets the mount operation’s password to
password
.- Parameters:
password – password to set.
- set_password_save(save: PasswordSave) None #
Sets the state of saving passwords for the mount operation.
- Parameters:
save – a set of
PasswordSave
flags.
Properties#
- class MountOperation
-
The type of the None singleton.
Added in version 2.58.
- props.password_save: PasswordSave#
The type of the None singleton.
Signals#
- class MountOperation.signals
-
- ask_password(message: str, default_user: str, default_domain: str, flags: AskPasswordFlags) None #
The type of the None singleton.
- Parameters:
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
AskPasswordFlags
.
- ask_question(message: str, choices: Sequence[str]) None #
The type of the None singleton.
- Parameters:
message – string containing a message to display to the user.
choices – an array of strings for each possible choice.
- reply(result: MountOperationResult) None #
Emitted when the user has replied to the mount operation.
- Parameters:
result – a
MountOperationResult
indicating how the request was handled
- show_processes(message: str, processes: Sequence[int], choices: Sequence[str]) None #
The type of the None singleton.
Added in version 2.22.
- Parameters:
message – string containing a message to display to the user.
processes – an array of
Pid
for processes blocking the operation.choices – an array of strings for each possible choice.
- show_unmount_progress(message: str, time_left: int, bytes_left: int) None #
The type of the None singleton.
Added in version 2.34.
- Parameters:
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
Virtual Methods#
- class MountOperation
-
- do_ask_password(message: str, default_user: str, default_domain: str, flags: AskPasswordFlags) None #
The type of the None singleton.
- Parameters:
message
default_user
default_domain
flags
- do_ask_question(message: str, choices: Sequence[str]) None #
The type of the None singleton.
- Parameters:
message – string containing a message to display to the user
choices – an array of strings for each possible choice
- do_reply(result: MountOperationResult) None #
Emits the
MountOperation
::reply signal.- Parameters:
result – a
MountOperationResult
- do_show_processes(message: str, processes: Sequence[int], choices: Sequence[str]) None #
The type of the None singleton.
Added in version 2.22.
- Parameters:
message – string containing a message to display to the user
processes – an array of
Pid
for processes blocking the operationchoices – an array of strings for each possible choice