Module: Gio::Mount
- Defined in:
- (unknown)
Overview
The GMount interface represents user-visible mounts. Note, when
porting from GnomeVFS, GMount is the moral
equivalent of GnomeVFSVolume.
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 [ifaceGio.AsyncResult]
and [classGio.Task]. To unmount a GMount instance, first call
[methodGio.Mount.unmount_with_operation] with (at least) the GMount
instance and a [typeGio.AsyncReadyCallback]. The callback will be fired
when the operation has resolved (either with success or failure), and a
[ifaceGio.AsyncResult] structure will be passed to the callback. That
callback should then call [methodGio.Mount.unmount_with_operation_finish]
with the GMount and the [ifaceGio.AsyncResult] data to see if the
operation was completed successfully. If an error is present when
[methodGio.Mount.unmount_with_operation_finish] is called, then it will be
filled with any error information.
Instance Method Summary collapse
-
#can_eject(mount) ⇒ Boolean
True if the mount can be ejected.
-
#can_unmount(mount) ⇒ Boolean
True if the mount can be unmounted.
- #changed(mount) ⇒ nil
-
#default_location ⇒ Gio::File
Gets the default location of mount.
-
#drive ⇒ Gio::Drive
Gets the drive for the mount.
- #eject(mount, flags, cancellable, callback, user_data) ⇒ nil
-
#eject_finish(mount, result) ⇒ Boolean
True if the mount was successfully ejected.
- #eject_with_operation(mount, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
-
#eject_with_operation_finish(mount, result) ⇒ Boolean
True if the mount was successfully ejected.
-
#get_default_location(mount) ⇒ Gio::File
A #GFile.
-
#get_drive(mount) ⇒ Gio::Drive
A #GDrive or nil if mount is not associated with a volume or a drive.
-
#get_icon(mount) ⇒ Gio::Icon
A #GIcon.
-
#get_name(mount) ⇒ String
The name for the given mount.
-
#get_root(mount) ⇒ Gio::File
A #GFile.
-
#get_sort_key(mount) ⇒ String
Sorting key for mount or nil if no such key is available.
-
#get_symbolic_icon(mount) ⇒ Gio::Icon
A #GIcon.
-
#get_uuid(mount) ⇒ String
The UUID for mount or nil if no UUID can be computed.
-
#get_volume(mount) ⇒ Gio::Volume
A #GVolume or nil if mount is not associated with a volume.
- #guess_content_type(mount, force_rescan, cancellable, callback, user_data) ⇒ nil
-
#guess_content_type_finish(mount, result) ⇒ Array<String>
An array of content types or nil on error.
-
#guess_content_type_sync(mount, force_rescan, cancellable) ⇒ Array<String>
An array of content types or nil on error.
-
#icon ⇒ Gio::Icon
Gets the icon for mount.
-
#is_shadowed ⇒ Boolean
Determines if mount is shadowed.
-
#name ⇒ String
Gets the name of mount.
- #pre_unmount(mount) ⇒ nil
- #remount(mount, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
-
#remount_finish(mount, result) ⇒ Boolean
True if the mount was successfully remounted.
-
#root ⇒ Gio::File
Gets the root directory on mount.
-
#shadow ⇒ nil
Increments the shadow count on mount.
-
#sort_key ⇒ String
Gets the sort key for mount, if any.
-
#symbolic_icon ⇒ Gio::Icon
Gets the symbolic icon for mount.
- #unmount(mount, flags, cancellable, callback, user_data) ⇒ nil
-
#unmount_finish(mount, result) ⇒ Boolean
True if the mount was successfully unmounted.
- #unmount_with_operation(mount, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
-
#unmount_with_operation_finish(mount, result) ⇒ Boolean
True if the mount was successfully unmounted.
- #unmounted(mount) ⇒ nil
-
#unshadow ⇒ nil
Decrements the shadow count on mount.
-
#uuid ⇒ String
Gets the UUID for the mount.
-
#volume ⇒ Gio::Volume
Gets the volume for the mount.
Instance Method Details
#can_eject(mount) ⇒ Boolean
Returns true if the mount can be ejected.
#can_unmount(mount) ⇒ Boolean
Returns true if the mount can be unmounted.
#changed(mount) ⇒ nil
#default_location ⇒ Gio::File
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).
#drive ⇒ Gio::Drive
Gets the drive for the mount.
This is a convenience method for getting the #GVolume and then using that object to get the #GDrive.
#eject(mount, flags, cancellable, callback, user_data) ⇒ nil
#eject_finish(mount, result) ⇒ Boolean
Returns true if the mount was successfully ejected. false otherwise.
#eject_with_operation(mount, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
#eject_with_operation_finish(mount, result) ⇒ Boolean
Returns true if the mount was successfully ejected. false otherwise.
#get_default_location(mount) ⇒ Gio::File
Returns a #GFile. The returned object should be unreffed with g_object_unref() when no longer needed.
#get_drive(mount) ⇒ Gio::Drive
Returns a #GDrive or nil if mount is not associated with a volume or a drive. The returned object should be unreffed with g_object_unref() when no longer needed.
#get_icon(mount) ⇒ Gio::Icon
Returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
#get_name(mount) ⇒ String
Returns the name for the given mount. The returned string should be freed with g_free() when no longer needed.
#get_root(mount) ⇒ Gio::File
Returns a #GFile. The returned object should be unreffed with g_object_unref() when no longer needed.
#get_sort_key(mount) ⇒ String
Returns Sorting key for mount or nil if no such key is available.
#get_symbolic_icon(mount) ⇒ Gio::Icon
Returns a #GIcon. The returned object should be unreffed with g_object_unref() when no longer needed.
#get_uuid(mount) ⇒ String
Returns the UUID for mount or nil if no UUID can be computed. The returned string should be freed with g_free() when no longer needed.
#get_volume(mount) ⇒ Gio::Volume
Returns a #GVolume or nil if mount is not associated with a volume. The returned object should be unreffed with g_object_unref() when no longer needed.
#guess_content_type(mount, force_rescan, cancellable, callback, user_data) ⇒ nil
#guess_content_type_finish(mount, result) ⇒ Array<String>
Returns an array of content types or nil on error. Caller should free this array with g_strfreev() when done with it.
#guess_content_type_sync(mount, force_rescan, cancellable) ⇒ Array<String>
Returns an array of content types or nil on error. Caller should free this array with g_strfreev() when done with it.
#icon ⇒ Gio::Icon
Gets the icon for mount.
#is_shadowed ⇒ Boolean
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 #GMount 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 GVolume::Monitor implementation would create two
#GVolume 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
GVolume::Monitor implementation would create two #GMount 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 #GVolume is set.
#name ⇒ String
Gets the name of mount.
#pre_unmount(mount) ⇒ nil
#remount(mount, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
#remount_finish(mount, result) ⇒ Boolean
Returns true if the mount was successfully remounted. false otherwise.
#root ⇒ Gio::File
Gets the root directory on mount.
#shadow ⇒ nil
Increments the shadow count on mount. Usually used by GVolume::Monitor implementations when creating a shadow mount for mount, see g_mount_is_shadowed() for more information. The caller will need to emit the #GMount::changed signal on mount manually.
#sort_key ⇒ String
Gets the sort key for mount, if any.
#symbolic_icon ⇒ Gio::Icon
Gets the symbolic icon for mount.
#unmount(mount, flags, cancellable, callback, user_data) ⇒ nil
#unmount_finish(mount, result) ⇒ Boolean
Returns true if the mount was successfully unmounted. false otherwise.
#unmount_with_operation(mount, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
#unmount_with_operation_finish(mount, result) ⇒ Boolean
Returns true if the mount was successfully unmounted. false otherwise.
#unmounted(mount) ⇒ nil
#unshadow ⇒ nil
Decrements the shadow count on mount. Usually used by GVolume::Monitor implementations when destroying a shadow mount for mount, see g_mount_is_shadowed() for more information. The caller will need to emit the #GMount::changed signal on mount manually.
#uuid ⇒ String
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 nil if there is no UUID available.
#volume ⇒ Gio::Volume
Gets the volume for the mount.