Description
The gio.Mount
interface represents user-visible mounts. Note, when porting from GnomeVFS,
gio.Mount
is the moral equivalent of GnomeVFSVolume.
gio.Mount
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 GAsyncReady and GSimpleAsyncReady. To unmount
a gio.Mount
instance,
first call
g_mount_unmount()
with (at least) the GMount instance and a GAsyncReadyCallback. The callback will
be fired when the operation has resolved (either with success or failure), and a
GAsyncReady structure will be passed to the callback. That callback should then call
g_mount_unmount_finish()
with the GMount and the GAsyncReady data to see if the operation was completed successfully.
If an error is present when g_mount_unmount_finish() is called, then it will be filled
with any error information.
Methods
gio.Mount.can_eject
def can_eject()
Returns : | True if the mount can be ejected,
False otherwise.
|
The can_eject
() method checks if a mount can be ejected.
gio.Mount.can_unmount
def can_unmount()
Returns : | True if the mount can be unmounted,
False otherwise.
|
The can_eject
() method checks if a mount can be unmounted.
gio.Mount.eject
def eject(callback
, flags
=gio.MOUNT_UNMOUNT_NONE, cancellable
=None, user_data
=None)
callback :
| A GAsyncReadyCallback to call when the request is satisfied.
|
flags :
| flags affecting the unmount if required for eject
Gio Mount Unmount Flags Constants.
|
cancellable :
| Optional
gio.Cancellable
object, None to ignore.
|
user_data :
| The data to pass to callback function.
|
The eject
() method asynchronously ejects a mount.
When the operation is finished, callback will be called. You can then call
gio.Mount.eject_finish
()
to obtain the result of the operation.
gio.Mount.eject_finish
def eject_finish(result
)
result :
| a gio.AsyncResult .
|
Returns : | True if the mount has been ejected
successfully, False otherwise.
|
The eject_finish
() method finishes ejecting a mount.
gio.Mount.get_drive
def get_drive()
Returns : | gio.Drive
or None if mount is not associated with a volume or a drive.
|
The get_drive
() method gets the drive for the mount.
This is a convenience method for getting the
gio.Volume
and then using that object to get the
gio.Drive
.
gio.Mount.get_icon
def get_icon()
The get_icon
() method gets the icon for mount.
gio.Mount.get_name
def get_name()
Returns : | the name for the given mount.
|
The get_name
() method gets the name of mount.
gio.Mount.get_root
def get_root()
The get_root
() method gets the root directory on mount.
gio.Mount.get_uuid
def get_uuid()
Returns : | the UUID for mount or None
if no UUID can be computed.
|
The get_uuid
() method 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
gio.Mount.get_volume
def get_volume()
Returns : | a gio.Volume
or None if mount is not associated with a volume.
|
The get_volume
() method gets the volume for the mount.
gio.Mount.guess_content_type
def guess_content_type(callback
, force_rescan
, cancellable
=None, user_data
=None)
callback :
| A GAsyncReadyCallback to call when the request is satisfied.
|
force_rescan :
| Whether to force a rescan of the content. Otherwise a cached result will be used if available.
|
cancellable :
| Optional
gio.Cancellable
object, None to ignore.
|
user_data :
| The data to pass to callback function.
|
The guess_content_type
() method asynchronously 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.
If cancellable is not None
, then the operation can be cancelled
by triggering the cancellable object from another thread. If the operation was cancelled,
the error gio.ERROR_CANCELLED will be returned.
When the operation is finished, callback will be called. You can then call
gio.Mount.guess_content_type_finish
()
to obtain the result of the operation.
gio.Mount.guess_content_type_finish
def guess_content_type_finish(result
)
The guess_content_type_finish
() method finishes guessing content
types of mount. If any errors occured during the operation, error will be set to
contain the errors and False
will be returned. In particular, you may get an
gio.ERROR_NOT_SUPPORTED if the mount does not support content guessing.
gio.Mount.guess_content_type_sync
def guess_content_type_sync(force_rescan
, cancellable
=None)
force_rescan :
| Whether to force a rescan of the content. Otherwise a cached result will be used if available.
|
cancellable :
| Optional
gio.Cancellable
object, None to ignore.
|
The guess_content_type_sync
() method 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.
If cancellable is not None
, then the operation can be cancelled
by triggering the cancellable object from another thread. If the operation was cancelled,
the error gio.ERROR_CANCELLED will be returned.
This is an synchronous operation and as such may block doing IO; see
gio.Mount.guess_content_type
()
for the asynchronous version.
gio.Mount.is_shadowed
def is_shadowed()
Returns : | True if mount is shadowed.
|
The is_shadowed
() method determines if mount
is shadowed. Applications or libraries should avoid displaying mount
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 mount.
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 two
gio.Volume
objects (for example, one for the camera functionality of the device
and one for a SD card reader on the device) with activation URIs
gphoto2://[usb:001,002]/store1/ and gphoto2://[usb:001,002]/store2/.
When the underlying mount (with root gphoto2://[usb:001,002]/) is
mounted, said
gio.VolumeMonitor
implementation would create two
gio.Mount
objects (each with their root matching the corresponding volume
activation root) that would shadow the original mount.
The proxy monitor in GVfs 2.26 and later, automatically creates and
manage shadow mounts (and shadows the underlying mount) if the activation
root on a gio.Volume
is set.
gio.Mount.remount
def remount(callback
, flags
=gio.MOUNT_UNMOUNT_NONE, mount_operation
=None, cancellable
=None, user_data
=None)
callback :
| A GAsyncReadyCallback to call when the request is satisfied.
|
flags :
| flags affecting the unmount if required for eject
Gio Mount Unmount Flags Constants.
|
mount_operation :
| a gio.MountOperation
or None to avoid user interaction.
|
cancellable :
| Optional
gio.Cancellable
object, None to ignore.
|
user_data :
| The data to pass to callback function.
|
The remount
() method asynchronously remounts a mount.
If cancellable is not None
, then the operation can be cancelled
by triggering the cancellable object from another thread. If the operation was cancelled,
the error gio.ERROR_CANCELLED will be returned.
When the operation is finished, callback will be called. You can then call
gio.Mount.remount_finish
()
to obtain the result of the operation.
gio.Mount.remount_finish
def remount_finish(result
)
result :
| a gio.AsyncResult .
|
Returns : | True if the mount has been remounted
successfully, False otherwise.
|
The remount_finish
() method finishes remounting a mount.
gio.Mount.shadow
def shadow()
The shadow
() method increments the shadow
count on mount. Usually used by
gio.VolumeMonitor
implementations when creating a shadow mount for mount, see
gio.Mount.is_shadowed
()
for more information. The caller will need to emit the "changed"
signal on mount manually.
gio.Mount.unmount
def unmount(callback
, flags
=gio.MOUNT_UNMOUNT_NONE, cancellable
=None, user_data
=None)
callback :
| A GAsyncReadyCallback to call when the request is satisfied.
|
flags :
| flags affecting the unmount if required for eject
Gio Mount Unmount Flags Constants.
|
cancellable :
| Optional
gio.Cancellable
object, None to ignore.
|
user_data :
| The data to pass to callback function.
|
The unmount
() method asynchronously unmounts a mount.
If cancellable is not None
, then the operation can be cancelled
by triggering the cancellable object from another thread. If the operation was cancelled,
the error gio.ERROR_CANCELLED will be returned.
When the operation is finished, callback will be called. You can then call
gio.Mount.unmount_finish
()
to obtain the result of the operation.
gio.Mount.unmount_finish
def unmount_finish(result
)
result :
| a gio.AsyncResult .
|
Returns : | True if the mount has been unmounted
successfully, False otherwise.
|
The unmount_finish
() method finishes unmounting a mount.
gio.Mount.unshadow
def unshadow()
The unshadow
() method decrements the shadow
count on mount. Usually used by
gio.VolumeMonitor
implementations when destroying a shadow mount for mount, see
gio.Mount.is_shadowed
()
for more information. The caller will need to emit the "changed"
signal on mount manually.