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
GMount
interface represents user-visible mounts. Note, when porting from GnomeVFS,GMount
is the moral equivalent ofGnomeVFSVolume
.GMount
is 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. Might or might not be related to a volume object.Unmounting a
GMount
instance is an asynchronous operation. For more information about asynchronous operations, see [iface`Gio`.AsyncResult] and [class`Gio`.Task]. To unmount aGMount
instance, first call [method`Gio`.Mount.unmount_with_operation] with (at least) theGMount
instance 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 theGMount
and the [iface`Gio`.AsyncResult] data to see if the operation was completed successfully. If anerror
is present when [method`Gio`.Mount.unmount_with_operation_finish] is called, then it will be filled with any error information.- eject(flags, cancellable, callback, *user_data)[source]¶
- Parameters:
flags (
Gio.MountUnmountFlags
) – flags affecting the unmount if required for ejectcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
, orNone
.
Ejects a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.eject_finish
() with the self andGio.AsyncResult
data 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:
True
if the mount was successfully ejected.False
otherwise.- Return type:
Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will 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.MountOperation
orNone
) – aGio.MountOperation
orNone
to avoid user interaction.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – 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.AsyncResult
data returned in the callback.New in version 2.22.
- eject_with_operation_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
.- Raises:
- Returns:
True
if the mount was successfully ejected.False
otherwise.- Return type:
Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will 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.Drive
orNone
if 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.Volume
and 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
None
if 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
None
if there is no UUID available.
- get_volume()[source]¶
- Returns:
a
Gio.Volume
orNone
if self is not associated with a volume. The returned object should be unreffed withGObject.Object.unref
() when no longer needed.- Return type:
Gio.Volume
orNone
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.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – 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.AsyncResult
data 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 orNone
on 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
False
will be returned. In particular, you may get anGio.IOErrorEnum.NOT_SUPPORTED
if 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.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore
- Raises:
- Returns:
a
None
-terminated array of content types orNone
on 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.Mount
objects) 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.VolumeMonitor
implementation would create twoGio.Volume
objects (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.VolumeMonitor
implementation would create twoGio.Mount
objects (each with their root matching the corresponding volume activation root) that would shadow the original mount.The proxy monitor in
Gio.Vfs
2.26 and later, automatically creates and manage shadow mounts (and shadows the underlying mount) if the activation root on aGio.Volume
is 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.MountOperation
orNone
) – aGio.MountOperation
orNone
to avoid user interaction.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
, orNone
.
Remounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.remount_finish
() with the self andGio.AsyncResults
data 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:
True
if the mount was successfully remounted.False
otherwise.- Return type:
Finishes remounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will be returned.
- shadow()[source]¶
Increments the shadow count on self. Usually used by
Gio.VolumeMonitor
implementations when creating a shadow mount for self, seeGio.Mount.is_shadowed
() for more information. The caller will need to emit theGio.Mount
::changed
signal on self manually.New in version 2.20.
- unmount(flags, cancellable, callback, *user_data)[source]¶
- Parameters:
flags (
Gio.MountUnmountFlags
) – flags affecting the operationcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
, orNone
.
Unmounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.unmount_finish
() with the self andGio.AsyncResult
data 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:
True
if the mount was successfully unmounted.False
otherwise.- Return type:
Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will 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.MountOperation
orNone
) – aGio.MountOperation
orNone
to avoid user interaction.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – 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.AsyncResult
data returned in the callback.New in version 2.22.
- unmount_with_operation_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
.- Raises:
- Returns:
True
if the mount was successfully unmounted.False
otherwise.- Return type:
Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will be returned.New in version 2.22.
- unshadow()[source]¶
Decrements the shadow count on self. Usually used by
Gio.VolumeMonitor
implementations when destroying a shadow mount for self, seeGio.Mount.is_shadowed
() for more information. The caller will need to emit theGio.Mount
::changed
signal 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.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
, orNone
.
Ejects a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.eject_finish
() with the mount andGio.AsyncResult
data 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:
True
if the mount was successfully ejected.False
otherwise.- Return type:
Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will 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.MountOperation
orNone
) – aGio.MountOperation
orNone
to avoid user interaction.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – 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.AsyncResult
data returned in the callback.New in version 2.22.
- do_eject_with_operation_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
.- Returns:
True
if the mount was successfully ejected.False
otherwise.- Return type:
Finishes ejecting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will 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.Drive
orNone
if 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.Volume
and 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
None
if 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
None
if there is no UUID available.
- do_get_volume() virtual¶
- Returns:
a
Gio.Volume
orNone
if mount is not associated with a volume. The returned object should be unreffed withGObject.Object.unref
() when no longer needed.- Return type:
Gio.Volume
orNone
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.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – 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.AsyncResult
data 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 orNone
on 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
False
will be returned. In particular, you may get anGio.IOErrorEnum.NOT_SUPPORTED
if 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.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore
- Returns:
a
None
-terminated array of content types orNone
on 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-unmount
signal that is emitted when theGio.Mount
will 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.MountOperation
orNone
) – aGio.MountOperation
orNone
to avoid user interaction.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
, orNone
.
Remounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.remount_finish
() with the mount andGio.AsyncResults
data 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:
True
if the mount was successfully remounted.False
otherwise.- Return type:
Finishes remounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will be returned.
- do_unmount(flags, cancellable, callback, *user_data) virtual¶
- Parameters:
flags (
Gio.MountUnmountFlags
) – flags affecting the operationcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
, orNone
.
Unmounts a mount. This is an asynchronous operation, and is finished by calling
Gio.Mount.unmount_finish
() with the mount andGio.AsyncResult
data 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:
True
if the mount was successfully unmounted.False
otherwise.- Return type:
Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will 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.MountOperation
orNone
) – aGio.MountOperation
orNone
to avoid user interaction.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – 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.AsyncResult
data returned in the callback.New in version 2.22.
- do_unmount_with_operation_finish(result) virtual¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
.- Returns:
True
if the mount was successfully unmounted.False
otherwise.- Return type:
Finishes unmounting a mount. If any errors occurred during the operation, error will be set to contain the errors and
False
will 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.Mount
is 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.Mount
have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.