Gio.MountOperation

g GObject.Object GObject.Object Gio.MountOperation Gio.MountOperation GObject.Object->Gio.MountOperation

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

get_anonymous ()

get_choice ()

get_domain ()

get_is_tcrypt_hidden_volume ()

get_is_tcrypt_system_volume ()

get_password ()

get_password_save ()

get_pim ()

get_username ()

reply (result)

set_anonymous (anonymous)

set_choice (choice)

set_domain (domain)

set_is_tcrypt_hidden_volume (hidden_volume)

set_is_tcrypt_system_volume (system_volume)

set_password (password)

set_password_save (save)

set_pim (pim)

set_username (username)

Virtual Methods

Inherited:

GObject.Object (7)

do_aborted ()

do_ask_password (message, default_user, default_domain, flags)

do_ask_question (message, choices)

do_reply (result)

do_show_processes (message, processes, choices)

do_show_unmount_progress (message, time_left, bytes_left)

Properties

Name

Type

Flags

Short Description

anonymous

bool

r/w

choice

int

r/w

domain

str

r/w

is-tcrypt-hidden-volume

bool

r/w

is-tcrypt-system-volume

bool

r/w

password

str

r/w

password-save

Gio.PasswordSave

r/w

pim

int

r/w

username

str

r/w

Signals

Inherited:

GObject.Object (1)

Name

Short Description

aborted

Emitted by the backend when e.g.

ask-password

Emitted when a mount operation asks the user for a password.

ask-question

Emitted when asking the user a question and gives a list of choices for the user to choose from.

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.

show-unmount-progress

Emitted when an unmount operation has been busy for more than some time (typically 1.5 seconds).

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Gio.MountOperation(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gio.MountOperationClass

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 [iface`Gio`.Mount] objects – for example it is also used in [method`Gio`.Drive.start] and [method`Gio`.Drive.stop].

Users should instantiate a subclass of this that implements all the various callbacks to show the required dialogs, such as GtkMountOperation. 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.

classmethod new()[source]
Returns:

a Gio.MountOperation.

Return type:

Gio.MountOperation

Creates a new mount operation.

get_anonymous()[source]
Returns:

True if mount operation is anonymous.

Return type:

bool

Check to see whether the mount operation is being used for an anonymous user.

get_choice()[source]
Returns:

an integer containing an index of the user’s choice from the choice’s list, or 0.

Return type:

int

Gets a choice from the mount operation.

get_domain()[source]
Returns:

a string set to the domain.

Return type:

str or None

Gets the domain of the mount operation.

get_is_tcrypt_hidden_volume()[source]
Returns:

True if mount operation is for hidden volume.

Return type:

bool

Check to see whether the mount operation is being used for a TCRYPT hidden volume.

New in version 2.58.

get_is_tcrypt_system_volume()[source]
Returns:

True if mount operation is for system volume.

Return type:

bool

Check to see whether the mount operation is being used for a TCRYPT system volume.

New in version 2.58.

get_password()[source]
Returns:

a string containing the password within self.

Return type:

str or None

Gets a password from the mount operation.

get_password_save()[source]
Returns:

a Gio.PasswordSave flag.

Return type:

Gio.PasswordSave

Gets the state of saving passwords for the mount operation.

get_pim()[source]
Returns:

The VeraCrypt PIM within self.

Return type:

int

Gets a PIM from the mount operation.

New in version 2.58.

get_username()[source]
Returns:

a string containing the user name.

Return type:

str or None

Get the user name from the mount operation.

reply(result)[source]
Parameters:

result (Gio.MountOperationResult) – a Gio.MountOperationResult

Emits the Gio.MountOperation ::reply signal.

set_anonymous(anonymous)[source]
Parameters:

anonymous (bool) – boolean value.

Sets the mount operation to use an anonymous user if anonymous is True.

set_choice(choice)[source]
Parameters:

choice (int) – an integer.

Sets a default choice for the mount operation.

set_domain(domain)[source]
Parameters:

domain (str or None) – the domain to set.

Sets the mount operation’s domain.

set_is_tcrypt_hidden_volume(hidden_volume)[source]
Parameters:

hidden_volume (bool) – boolean value.

Sets the mount operation to use a hidden volume if hidden_volume is True.

New in version 2.58.

set_is_tcrypt_system_volume(system_volume)[source]
Parameters:

system_volume (bool) – boolean value.

Sets the mount operation to use a system volume if system_volume is True.

New in version 2.58.

set_password(password)[source]
Parameters:

password (str or None) – password to set.

Sets the mount operation’s password to password.

set_password_save(save)[source]
Parameters:

save (Gio.PasswordSave) – a set of Gio.PasswordSave flags.

Sets the state of saving passwords for the mount operation.

set_pim(pim)[source]
Parameters:

pim (int) – an unsigned integer.

Sets the mount operation’s PIM to pim.

New in version 2.58.

set_username(username)[source]
Parameters:

username (str or None) – input username.

Sets the user name within self to username.

do_aborted() virtual
do_ask_password(message, default_user, default_domain, flags) virtual
Parameters:
do_ask_question(message, choices) virtual
Parameters:
  • message (str) – string containing a message to display to the user

  • choices ([str]) – an array of strings for each possible choice

Virtual implementation of Gio.MountOperation ::ask-question.

do_reply(result) virtual
Parameters:

result (Gio.MountOperationResult) – a Gio.MountOperationResult

Emits the Gio.MountOperation ::reply signal.

do_show_processes(message, processes, choices) virtual
Parameters:
  • message (str) – string containing a message to display to the user

  • processes ([int]) – an array of #GPid for processes blocking the operation

  • choices ([str]) – an array of strings for each possible choice

Virtual implementation of Gio.MountOperation ::show-processes.

New in version 2.22.

do_show_unmount_progress(message, time_left, bytes_left) virtual
Parameters:
  • message (str) –

  • time_left (int) –

  • bytes_left (int) –

Signal Details

Gio.MountOperation.signals.aborted(mount_operation)
Signal Name:

aborted

Flags:

RUN_LAST

Parameters:

mount_operation (Gio.MountOperation) – The object which received the signal

Emitted by the backend when e.g. a device becomes unavailable while a mount operation is in progress.

Implementations of Gio.MountOperation should handle this signal by dismissing open password dialogs.

New in version 2.20.

Gio.MountOperation.signals.ask_password(mount_operation, message, default_user, default_domain, flags)
Signal Name:

ask-password

Flags:

RUN_LAST

Parameters:
  • mount_operation (Gio.MountOperation) – The object which received the signal

  • message (str) – string containing a message to display to the user.

  • default_user (str) – string containing the default user name.

  • default_domain (str) – string containing the default domain.

  • flags (Gio.AskPasswordFlags) – a set of Gio.AskPasswordFlags.

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.

Gio.MountOperation.signals.ask_question(mount_operation, message, choices)
Signal Name:

ask-question

Flags:

RUN_LAST

Parameters:
  • mount_operation (Gio.MountOperation) – The object which received the signal

  • message (str) – string containing a message to display to the user.

  • choices ([str]) – an array of strings for each possible choice.

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.

Gio.MountOperation.signals.reply(mount_operation, result)
Signal Name:

reply

Flags:

RUN_LAST

Parameters:

Emitted when the user has replied to the mount operation.

Gio.MountOperation.signals.show_processes(mount_operation, message, processes, choices)
Signal Name:

show-processes

Flags:

RUN_LAST

Parameters:
  • mount_operation (Gio.MountOperation) – The object which received the signal

  • message (str) – string containing a message to display to the user.

  • processes ([int]) – an array of #GPid for processes blocking the operation.

  • choices ([str]) – an array of strings for each possible choice.

Emitted when one or more processes are blocking an operation e.g. unmounting/ejecting a Gio.Mount or stopping a Gio.Drive.

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 Gio.MountOperation.reply() to the latest signal (setting Gio.MountOperation :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.

New in version 2.22.

Gio.MountOperation.signals.show_unmount_progress(mount_operation, message, time_left, bytes_left)
Signal Name:

show-unmount-progress

Flags:

RUN_LAST

Parameters:
  • mount_operation (Gio.MountOperation) – The object which received the signal

  • message (str) – string containing a message to display to the user

  • time_left (int) – the estimated time left before the operation completes, in microseconds, or -1

  • bytes_left (int) – 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

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 Gio.MountOperation 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.

New in version 2.34.

Property Details

Gio.MountOperation.props.anonymous
Name:

anonymous

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether to use an anonymous user when authenticating.

Gio.MountOperation.props.choice
Name:

choice

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The index of the user’s choice when a question is asked during the mount operation. See the Gio.MountOperation ::ask-question signal.

Gio.MountOperation.props.domain
Name:

domain

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The domain to use for the mount operation.

Gio.MountOperation.props.is_tcrypt_hidden_volume
Name:

is-tcrypt-hidden-volume

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the device to be unlocked is a TCRYPT hidden volume. See the VeraCrypt documentation.

New in version 2.58.

Gio.MountOperation.props.is_tcrypt_system_volume
Name:

is-tcrypt-system-volume

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

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.

New in version 2.58.

Gio.MountOperation.props.password
Name:

password

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The password that is used for authentication when carrying out the mount operation.

Gio.MountOperation.props.password_save
Name:

password-save

Type:

Gio.PasswordSave

Default Value:

Gio.PasswordSave.NEVER

Flags:

READABLE, WRITABLE

Determines if and how the password information should be saved.

Gio.MountOperation.props.pim
Name:

pim

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The VeraCrypt PIM value, when unlocking a VeraCrypt volume. See the VeraCrypt documentation.html).

New in version 2.58.

Gio.MountOperation.props.username
Name:

username

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The user name that is used for authentication when carrying out the mount operation.