Gio.Mount¶
- Implementations:
None
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
Name |
Short Description |
|---|---|
Emitted when the mount has been changed. |
|
This signal may be emitted when the |
|
This signal is emitted when the |
Fields¶
None
Class Details¶
- class Gio.Mount¶
- Bases:
- Structure:
The
GMountinterface represents a user-visible mount, such as a mounted file system.GMountis a ‘mounted’ filesystem that you can access. Mounted is in quotes because it’s not the same as a UNIX mount, it might be a GVFS mount, but you can still access the files on it if you use GIO.A
GMountmight be associated with a [iface`Gio`.Volume] (such as a USB flash drive) which hosts it.Unmounting a
GMountinstance is an asynchronous operation. For more information about asynchronous operations, see [iface`Gio`.AsyncResult] and [class`Gio`.Task]. To unmount aGMountinstance, first call [method`Gio`.Mount.unmount_with_operation] with (at least) theGMountinstance and a [type`Gio`.AsyncReadyCallback]. The callback will be fired when the operation has resolved (either with success or failure), and a [iface`Gio`.AsyncResult] structure will be passed to the callback. That callback should then call [method`Gio`.Mount.unmount_with_operation_finish] with theGMountand the [iface`Gio`.AsyncResult] data to see if the operation was completed successfully. If anerroris present when [method`Gio`.Mount.unmount_with_operation_finish] is called, then it will be filled with any error information.Note, when porting from GnomeVFS,
GMountis the moral equivalent ofGnomeVFSVolume.- eject(flags, cancellable, callback, *user_data)[source]¶
- Parameters:
flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for ejectcancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Ejects a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.eject_finish() with the self andGio.AsyncResultdata returned in the callback.Deprecated since version 2.22: Use
Gio.Mount.eject_with_operation() instead.
- eject_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Raises:
- Returns:
Trueif the mount was successfully ejected.Falseotherwise.- Return type:
Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.Deprecated since version 2.22: Use
Gio.Mount.eject_with_operation_finish() instead.
- eject_with_operation(flags, mount_operation, cancellable, callback, *user_data)[source]¶
- Parameters:
flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for ejectmount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction.cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Ejects a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.eject_with_operation_finish() with the self andGio.AsyncResultdata returned in the callback.New in version 2.22.
- eject_with_operation_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Raises:
- Returns:
Trueif the mount was successfully ejected.Falseotherwise.- Return type:
Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.New in version 2.22.
- get_default_location()[source]¶
- Returns:
a
Gio.File. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the default location of self. The default location of the given self is a path that reflects the main entry point for the user (e.g. the home directory, or the root of the volume).
- get_drive()[source]¶
- Returns:
a
Gio.DriveorNoneif self is not associated with a volume or a drive. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the drive for the self.
This is a convenience method for getting the
Gio.Volumeand then using that object to get theGio.Drive.
- get_icon()[source]¶
- Returns:
a
Gio.Icon. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the icon for self.
- get_name()[source]¶
- Returns:
the name for the given self. The returned string should be freed with
GLib.free() when no longer needed.- Return type:
Gets the name of self.
- get_root()[source]¶
- Returns:
a
Gio.File. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the root directory on self.
- get_symbolic_icon()[source]¶
- Returns:
a
Gio.Icon. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the symbolic icon for self.
New in version 2.34.
- get_uuid()[source]¶
- Returns:
the UUID for self or
Noneif no UUID can be computed. The returned string should be freed withGLib.free() when no longer needed.- Return type:
Gets the UUID for the self. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns
Noneif there is no UUID available.
- get_volume()[source]¶
- Returns:
a
Gio.VolumeorNoneif self is not associated with a volume. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gio.VolumeorNone
Gets the volume for the self.
- guess_content_type(force_rescan, cancellable, callback, *user_data)[source]¶
- Parameters:
force_rescan (
bool) – Whether to force a rescan of the content. Otherwise a cached result will be used if availablecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignorecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback
Tries to guess the type of content stored on self. Returns one or more textual identifiers of well-known content types (typically prefixed with “x-content/”), e.g. x-content/image-dcf for camera memory cards. See the shared-mime-info specification for more on x-content types.
This is an asynchronous operation (see
Gio.Mount.guess_content_type_sync() for the synchronous version), and is finished by callingGio.Mount.guess_content_type_finish() with the self andGio.AsyncResultdata returned in the callback.New in version 2.18.
- guess_content_type_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult- Raises:
- Returns:
a
None-terminated array of content types orNoneon error. Caller should free this array withGLib.strfreev() when done with it.- Return type:
[
str]
Finishes guessing content types of self. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned. In particular, you may get anGio.IOErrorEnum.NOT_SUPPORTEDif the mount does not support content guessing.New in version 2.18.
- guess_content_type_sync(force_rescan, cancellable)[source]¶
- Parameters:
force_rescan (
bool) – Whether to force a rescan of the content. Otherwise a cached result will be used if availablecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- Raises:
- Returns:
a
None-terminated array of content types orNoneon error. Caller should free this array withGLib.strfreev() when done with it.- Return type:
[
str]
Tries to guess the type of content stored on self. Returns one or more textual identifiers of well-known content types (typically prefixed with “x-content/”), e.g. x-content/image-dcf for camera memory cards. See the shared-mime-info specification for more on x-content types.
This is a synchronous operation and as such may block doing IO; see
Gio.Mount.guess_content_type() for the asynchronous version.New in version 2.18.
- is_shadowed()[source]¶
-
Determines if self is shadowed. Applications or libraries should avoid displaying self in the user interface if it is shadowed.
A mount is said to be shadowed if there exists one or more user visible objects (currently
Gio.Mountobjects) with a root that is inside the root of self.One application of shadow mounts is when exposing a single file system that is used to address several logical volumes. In this situation, a
Gio.VolumeMonitorimplementation would create twoGio.Volumeobjects (for example, one for the camera functionality of the device and one for a SD card reader on the device) with activation URIsgphoto2://[usb:001,002]/store1/andgphoto2://[usb:001,002]/store2/. When the underlying mount (with rootgphoto2://[usb:001,002]/) is mounted, saidGio.VolumeMonitorimplementation would create twoGio.Mountobjects (each with their root matching the corresponding volume activation root) that would shadow the original mount.The proxy monitor in
Gio.Vfs2.26 and later, automatically creates and manage shadow mounts (and shadows the underlying mount) if the activation root on aGio.Volumeis set.New in version 2.20.
- remount(flags, mount_operation, cancellable, callback, *user_data)[source]¶
- Parameters:
flags (
Gio.MountMountFlags) – flags affecting the operationmount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction.cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Remounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.remount_finish() with the self andGio.AsyncResultsdata returned in the callback.Remounting is useful when some setting affecting the operation of the volume has been changed, as these may need a remount to take affect. While this is semantically equivalent with unmounting and then remounting not all backends might need to actually be unmounted.
- remount_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Raises:
- Returns:
Trueif the mount was successfully remounted.Falseotherwise.- Return type:
Finishes remounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.
- shadow()[source]¶
Increments the shadow count on self. Usually used by
Gio.VolumeMonitorimplementations when creating a shadow mount for self, seeGio.Mount.is_shadowed() for more information. The caller will need to emit theGio.Mount::changedsignal on self manually.New in version 2.20.
- unmount(flags, cancellable, callback, *user_data)[source]¶
- Parameters:
flags (
Gio.MountUnmountFlags) – flags affecting the operationcancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Unmounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.unmount_finish() with the self andGio.AsyncResultdata returned in the callback.Deprecated since version 2.22: Use
Gio.Mount.unmount_with_operation() instead.
- unmount_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Raises:
- Returns:
Trueif the mount was successfully unmounted.Falseotherwise.- Return type:
Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.Deprecated since version 2.22: Use
Gio.Mount.unmount_with_operation_finish() instead.
- unmount_with_operation(flags, mount_operation, cancellable, callback, *user_data)[source]¶
- Parameters:
flags (
Gio.MountUnmountFlags) – flags affecting the operationmount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction.cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Unmounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.unmount_with_operation_finish() with the self andGio.AsyncResultdata returned in the callback.New in version 2.22.
- unmount_with_operation_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Raises:
- Returns:
Trueif the mount was successfully unmounted.Falseotherwise.- Return type:
Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.New in version 2.22.
- unshadow()[source]¶
Decrements the shadow count on self. Usually used by
Gio.VolumeMonitorimplementations when destroying a shadow mount for self, seeGio.Mount.is_shadowed() for more information. The caller will need to emit theGio.Mount::changedsignal on self manually.New in version 2.20.
- do_can_eject() virtual¶
-
Checks if mount can be ejected.
- do_can_unmount() virtual¶
-
Checks if mount can be unmounted.
- do_changed() virtual¶
Changed signal that is emitted when the mount’s state has changed.
- do_eject(flags, cancellable, callback, *user_data) virtual¶
- Parameters:
flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for ejectcancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Ejects a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.eject_finish() with the mount andGio.AsyncResultdata returned in the callback.Deprecated since version 2.22: Use
Gio.Mount.eject_with_operation() instead.
- do_eject_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Returns:
Trueif the mount was successfully ejected.Falseotherwise.- Return type:
Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.Deprecated since version 2.22: Use
Gio.Mount.eject_with_operation_finish() instead.
- do_eject_with_operation(flags, mount_operation, cancellable, callback, *user_data) virtual¶
- Parameters:
flags (
Gio.MountUnmountFlags) – flags affecting the unmount if required for ejectmount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction.cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Ejects a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.eject_with_operation_finish() with the mount andGio.AsyncResultdata returned in the callback.New in version 2.22.
- do_eject_with_operation_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Returns:
Trueif the mount was successfully ejected.Falseotherwise.- Return type:
Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.New in version 2.22.
- do_get_default_location() virtual¶
- Returns:
a
Gio.File. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the default location of mount. The default location of the given mount is a path that reflects the main entry point for the user (e.g. the home directory, or the root of the volume).
- do_get_drive() virtual¶
- Returns:
a
Gio.DriveorNoneif mount is not associated with a volume or a drive. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the drive for the mount.
This is a convenience method for getting the
Gio.Volumeand then using that object to get theGio.Drive.
- do_get_icon() virtual¶
- Returns:
a
Gio.Icon. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the icon for mount.
- do_get_name() virtual¶
- Returns:
the name for the given mount. The returned string should be freed with
GLib.free() when no longer needed.- Return type:
Gets the name of mount.
- do_get_root() virtual¶
- Returns:
a
Gio.File. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the root directory on mount.
- do_get_sort_key() virtual¶
-
Gets the sort key for mount, if any.
New in version 2.32.
- do_get_symbolic_icon() virtual¶
- Returns:
a
Gio.Icon. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gets the symbolic icon for mount.
New in version 2.34.
- do_get_uuid() virtual¶
- Returns:
the UUID for mount or
Noneif no UUID can be computed. The returned string should be freed withGLib.free() when no longer needed.- Return type:
Gets the UUID for the mount. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns
Noneif there is no UUID available.
- do_get_volume() virtual¶
- Returns:
a
Gio.VolumeorNoneif mount is not associated with a volume. The returned object should be unreffed withGObject.Object.unref() when no longer needed.- Return type:
Gio.VolumeorNone
Gets the volume for the mount.
- do_guess_content_type(force_rescan, cancellable, callback, *user_data) virtual¶
- Parameters:
force_rescan (
bool) – Whether to force a rescan of the content. Otherwise a cached result will be used if availablecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignorecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback
Tries to guess the type of content stored on mount. Returns one or more textual identifiers of well-known content types (typically prefixed with “x-content/”), e.g. x-content/image-dcf for camera memory cards. See the shared-mime-info specification for more on x-content types.
This is an asynchronous operation (see
Gio.Mount.guess_content_type_sync() for the synchronous version), and is finished by callingGio.Mount.guess_content_type_finish() with the mount andGio.AsyncResultdata returned in the callback.New in version 2.18.
- do_guess_content_type_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult- Returns:
a
None-terminated array of content types orNoneon error. Caller should free this array withGLib.strfreev() when done with it.- Return type:
[
str]
Finishes guessing content types of mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned. In particular, you may get anGio.IOErrorEnum.NOT_SUPPORTEDif the mount does not support content guessing.New in version 2.18.
- do_guess_content_type_sync(force_rescan, cancellable) virtual¶
- Parameters:
force_rescan (
bool) – Whether to force a rescan of the content. Otherwise a cached result will be used if availablecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- Returns:
a
None-terminated array of content types orNoneon error. Caller should free this array withGLib.strfreev() when done with it.- Return type:
[
str]
Tries to guess the type of content stored on mount. Returns one or more textual identifiers of well-known content types (typically prefixed with “x-content/”), e.g. x-content/image-dcf for camera memory cards. See the shared-mime-info specification for more on x-content types.
This is a synchronous operation and as such may block doing IO; see
Gio.Mount.guess_content_type() for the asynchronous version.New in version 2.18.
- do_pre_unmount() virtual¶
The
::pre-unmountsignal that is emitted when theGio.Mountwill soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.
- do_remount(flags, mount_operation, cancellable, callback, *user_data) virtual¶
- Parameters:
flags (
Gio.MountMountFlags) – flags affecting the operationmount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction.cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Remounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.remount_finish() with the mount andGio.AsyncResultsdata returned in the callback.Remounting is useful when some setting affecting the operation of the volume has been changed, as these may need a remount to take affect. While this is semantically equivalent with unmounting and then remounting not all backends might need to actually be unmounted.
- do_remount_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Returns:
Trueif the mount was successfully remounted.Falseotherwise.- Return type:
Finishes remounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.
- do_unmount(flags, cancellable, callback, *user_data) virtual¶
- Parameters:
flags (
Gio.MountUnmountFlags) – flags affecting the operationcancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Unmounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.unmount_finish() with the mount andGio.AsyncResultdata returned in the callback.Deprecated since version 2.22: Use
Gio.Mount.unmount_with_operation() instead.
- do_unmount_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Returns:
Trueif the mount was successfully unmounted.Falseotherwise.- Return type:
Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.Deprecated since version 2.22: Use
Gio.Mount.unmount_with_operation_finish() instead.
- do_unmount_with_operation(flags, mount_operation, cancellable, callback, *user_data) virtual¶
- Parameters:
flags (
Gio.MountUnmountFlags) – flags affecting the operationmount_operation (
Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction.cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback, orNone.
Unmounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.unmount_with_operation_finish() with the mount andGio.AsyncResultdata returned in the callback.New in version 2.22.
- do_unmount_with_operation_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult.- Returns:
Trueif the mount was successfully unmounted.Falseotherwise.- Return type:
Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
Falsewill be returned.New in version 2.22.
Signal Details¶
- Gio.Mount.signals.changed(mount)¶
- Signal Name:
changed- Flags:
- Parameters:
mount (
Gio.Mount) – The object which received the signal
Emitted when the mount has been changed.
- Gio.Mount.signals.pre_unmount(mount)¶
- Signal Name:
pre-unmount- Flags:
- Parameters:
mount (
Gio.Mount) – The object which received the signal
This signal may be emitted when the
Gio.Mountis about to be unmounted.This signal depends on the backend and is only emitted if GIO was used to unmount.
New in version 2.22.
- Gio.Mount.signals.unmounted(mount)¶
- Signal Name:
unmounted- Flags:
- Parameters:
mount (
Gio.Mount) – The object which received the signal
This signal is emitted when the
Gio.Mounthave been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.