Module: Gio::Drive
- Defined in:
- (unknown)
Overview
#GDrive - this represent 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 #GVolume 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 potententially 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 g_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) ⇒ TrueClass
True if the drive can be ejected, false otherwise.
-
#can_poll_for_media(drive) ⇒ TrueClass
True if the drive can be polled for media changes, false otherwise.
-
#can_start(drive) ⇒ TrueClass
True if the drive can be started, false otherwise.
-
#can_start_degraded(drive) ⇒ TrueClass
True if the drive can be started degraded, false otherwise.
-
#can_stop(drive) ⇒ TrueClass
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) ⇒ TrueClass
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) ⇒ TrueClass
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
#GList containing any #GVolume objects on the given drive.
-
#has_media(drive) ⇒ TrueClass
True if drive has media, false otherwise.
-
#has_volumes(drive) ⇒ TrueClass
True if the drive contains volumes, false otherwise.
-
#icon ⇒ Gio::Icon
Gets the icon for drive.
-
#is_media_check_automatic(drive) ⇒ TrueClass
True if the drive is capabable of automatically detecting media changes, false otherwise.
-
#is_media_removable(drive) ⇒ TrueClass
True if drive supports removable media, false otherwise.
-
#is_removable(drive) ⇒ TrueClass
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) ⇒ TrueClass
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) ⇒ TrueClass
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) ⇒ TrueClass
True if the drive has been stopped successfully, false otherwise.
-
#symbolic_icon ⇒ Gio::Icon
Gets the icon for drive.
-
#volumes ⇒ GLib::List
Get a list of mountable volumes for drive.
Instance Method Details
#can_eject(drive) ⇒ TrueClass
Returns true if the drive can be ejected, false otherwise.
#can_poll_for_media(drive) ⇒ TrueClass
Returns true if the drive can be polled for media changes, false otherwise.
#can_start(drive) ⇒ TrueClass
Returns true if the drive can be started, false otherwise.
#can_start_degraded(drive) ⇒ TrueClass
Returns true if the drive can be started degraded, false otherwise.
#can_stop(drive) ⇒ TrueClass
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) ⇒ TrueClass
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) ⇒ TrueClass
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
Returns #GList containing any #GVolume objects on the given drive.
#has_media(drive) ⇒ TrueClass
Returns true if drive has media, false otherwise.
#has_volumes(drive) ⇒ TrueClass
Returns true if the drive contains volumes, false otherwise.
#icon ⇒ Gio::Icon
Gets the icon for drive.
#is_media_check_automatic(drive) ⇒ TrueClass
Returns true if the drive is capabable of automatically detecting media changes, false otherwise.
#is_media_removable(drive) ⇒ TrueClass
Returns true if drive supports removable media, false otherwise.
#is_removable(drive) ⇒ TrueClass
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) ⇒ TrueClass
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) ⇒ TrueClass
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) ⇒ TrueClass
Returns true if the drive has been stopped successfully, false otherwise.
#symbolic_icon ⇒ Gio::Icon
Gets the icon for drive.
#volumes ⇒ GLib::List
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().