Module: Gio::Drive
- Defined in:
- (unknown)
Overview
GDrive represents a piece of hardware connected to the machine.
It’s generally only created for removable hardware or hardware with
removable media.
GDrive is a container class for [ifaceGio.Volume] objects that stem from
the same piece of media. As such, GDrive abstracts a drive with
(or without) removable media and provides operations for querying
whether media is available, determining whether media change is
automatically detected and ejecting the media.
If the GDrive reports that media isn’t automatically detected, one
can poll for media; typically one should not do this periodically
as a poll for media operation is potentially expensive and may
spin up the drive creating noise.
GDrive supports starting and stopping drives with authentication
support for the former. This can be used to support a diverse set
of use cases including connecting/disconnecting iSCSI devices,
powering down external disk enclosures and starting/stopping
multi-disk devices such as RAID devices. Note that the actual
semantics and side-effects of starting/stopping a GDrive may vary
according to implementation. To choose the correct verbs in e.g. a
file manager, use [methodGio.Drive.get_start_stop_type].
For porting from GnomeVFS note that there is no
equivalent of GDrive in that API.
Instance Method Summary collapse
-
#can_eject(drive) ⇒ Boolean
True if the drive can be ejected, false otherwise.
-
#can_poll_for_media(drive) ⇒ Boolean
True if the drive can be polled for media changes, false otherwise.
-
#can_start(drive) ⇒ Boolean
True if the drive can be started, false otherwise.
-
#can_start_degraded(drive) ⇒ Boolean
True if the drive can be started degraded, false otherwise.
-
#can_stop(drive) ⇒ Boolean
True if the drive can be stopped, false otherwise.
- #changed(drive) ⇒ nil
- #disconnected(drive) ⇒ nil
- #eject(drive, flags, cancellable, callback, user_data) ⇒ nil
- #eject_button(drive) ⇒ nil
-
#eject_finish(drive, result) ⇒ Boolean
True if the drive has been ejected successfully, false otherwise.
- #eject_with_operation(drive, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
-
#eject_with_operation_finish(drive, result) ⇒ Boolean
True if the drive was successfully ejected.
-
#enumerate_identifiers(drive) ⇒ Array<String>
A nil-terminated array of strings containing kinds of identifiers.
-
#get_icon(drive) ⇒ Gio::Icon
#GIcon for the drive.
-
#get_identifier(drive, kind) ⇒ String
A newly allocated string containing the requested identifier, or nil if the #GDrive doesn't have this kind of identifier.
-
#get_name(drive) ⇒ String
A string containing drive's name.
-
#get_sort_key(drive) ⇒ String
Sorting key for drive or nil if no such key is available.
-
#get_start_stop_type(drive) ⇒ Gio::DriveStartStopType
A value from the GDrive::StartStopType enumeration.
-
#get_symbolic_icon(drive) ⇒ Gio::Icon
Symbolic #GIcon for the drive.
-
#get_volumes(drive) ⇒ GLib::List<Gio::Volume>
#GList containing any #GVolume objects on the given drive.
-
#has_media(drive) ⇒ Boolean
True if drive has media, false otherwise.
-
#has_volumes(drive) ⇒ Boolean
True if the drive contains volumes, false otherwise.
-
#icon ⇒ Gio::Icon
Gets the icon for drive.
-
#is_media_check_automatic(drive) ⇒ Boolean
True if the drive is capable of automatically detecting media changes, false otherwise.
-
#is_media_removable(drive) ⇒ Boolean
True if drive supports removable media, false otherwise.
-
#is_removable(drive) ⇒ Boolean
True if drive and/or its media is considered removable, false otherwise.
-
#name ⇒ String
Gets the name of drive.
- #poll_for_media(drive, cancellable, callback, user_data) ⇒ nil
-
#poll_for_media_finish(drive, result) ⇒ Boolean
True if the drive has been poll_for_mediaed successfully, false otherwise.
-
#sort_key ⇒ String
Gets the sort key for drive, if any.
- #start(drive, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
-
#start_finish(drive, result) ⇒ Boolean
True if the drive has been started successfully, false otherwise.
-
#start_stop_type ⇒ Gio::DriveStartStopType
Gets a hint about how a drive can be started/stopped.
- #stop(drive, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
- #stop_button(drive) ⇒ nil
-
#stop_finish(drive, result) ⇒ Boolean
True if the drive has been stopped successfully, false otherwise.
-
#symbolic_icon ⇒ Gio::Icon
Gets the icon for drive.
-
#volumes ⇒ GLib::List<Gio::Volume>
Get a list of mountable volumes for drive.
Instance Method Details
#can_eject(drive) ⇒ Boolean
Returns true if the drive can be ejected, false otherwise.
#can_poll_for_media(drive) ⇒ Boolean
Returns true if the drive can be polled for media changes, false otherwise.
#can_start(drive) ⇒ Boolean
Returns true if the drive can be started, false otherwise.
#can_start_degraded(drive) ⇒ Boolean
Returns true if the drive can be started degraded, false otherwise.
#can_stop(drive) ⇒ Boolean
Returns true if the drive can be stopped, false otherwise.
#changed(drive) ⇒ nil
#disconnected(drive) ⇒ nil
#eject(drive, flags, cancellable, callback, user_data) ⇒ nil
#eject_button(drive) ⇒ nil
#eject_finish(drive, result) ⇒ Boolean
Returns true if the drive has been ejected successfully, false otherwise.
#eject_with_operation(drive, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
#eject_with_operation_finish(drive, result) ⇒ Boolean
Returns true if the drive was successfully ejected. false otherwise.
#enumerate_identifiers(drive) ⇒ Array<String>
Returns a nil-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free.
#get_icon(drive) ⇒ Gio::Icon
Returns #GIcon for the drive. Free the returned object with g_object_unref().
#get_identifier(drive, kind) ⇒ String
Returns a newly allocated string containing the requested identifier, or nil if the #GDrive doesn't have this kind of identifier.
#get_name(drive) ⇒ String
Returns a string containing drive's name. The returned string should be freed when no longer needed.
#get_sort_key(drive) ⇒ String
Returns Sorting key for drive or nil if no such key is available.
#get_start_stop_type(drive) ⇒ Gio::DriveStartStopType
Returns A value from the GDrive::StartStopType enumeration.
#get_symbolic_icon(drive) ⇒ Gio::Icon
Returns symbolic #GIcon for the drive. Free the returned object with g_object_unref().
#get_volumes(drive) ⇒ GLib::List<Gio::Volume>
Returns #GList containing any #GVolume objects on the given drive.
#has_media(drive) ⇒ Boolean
Returns true if drive has media, false otherwise.
#has_volumes(drive) ⇒ Boolean
Returns true if the drive contains volumes, false otherwise.
#icon ⇒ Gio::Icon
Gets the icon for drive.
#is_media_check_automatic(drive) ⇒ Boolean
Returns true if the drive is capable of automatically detecting media changes, false otherwise.
#is_media_removable(drive) ⇒ Boolean
Returns true if drive supports removable media, false otherwise.
#is_removable(drive) ⇒ Boolean
Returns true if drive and/or its media is considered removable, false otherwise.
#name ⇒ String
Gets the name of drive.
#poll_for_media(drive, cancellable, callback, user_data) ⇒ nil
#poll_for_media_finish(drive, result) ⇒ Boolean
Returns true if the drive has been poll_for_mediaed successfully, false otherwise.
#sort_key ⇒ String
Gets the sort key for drive, if any.
#start(drive, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
#start_finish(drive, result) ⇒ Boolean
Returns true if the drive has been started successfully, false otherwise.
#start_stop_type ⇒ Gio::DriveStartStopType
Gets a hint about how a drive can be started/stopped.
#stop(drive, flags, mount_operation, cancellable, callback, user_data) ⇒ nil
#stop_button(drive) ⇒ nil
#stop_finish(drive, result) ⇒ Boolean
Returns true if the drive has been stopped successfully, false otherwise.
#symbolic_icon ⇒ Gio::Icon
Gets the icon for drive.
#volumes ⇒ GLib::List<Gio::Volume>
Get a list of mountable volumes for drive.
The returned list should be freed with g_list_free(), after its elements have been unreffed with g_object_unref().