module Gio::Drive

Overview

GDrive represents a piece of hardware connected to the machine. It’s generally only created for removable hardware or hardware with removable media. For example, an optical disc drive, or a USB flash drive.

GDrive is a container class for Gio::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 Gio::Drive#start_stop_type.

For porting from GnomeVFS note that there is no equivalent of GDrive in that API.

Defined in:

lib/gi-crystal/src/auto/gio-2.0/drive.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.cast(obj : GObject::Object) : self #

Cast a GObject::Object to self, throws a TypeCastError if the cast can't be made.


Class Method Detail

def self.cast?(obj : GObject::Object) : self | Nil #

def self.g_type : UInt64 #

Instance Method Detail

def can_eject : Bool #

def can_poll_for_media : Bool #

def can_start : Bool #

def can_start_degraded : Bool #

def can_stop : Bool #

def changed_signal #

def disconnected_signal #

def eject(flags : Gio::MountUnmountFlags, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil #

DEPRECATED


def eject_button_signal #

def eject_finish(result : Gio::AsyncResult) : Bool #

DEPRECATED


def eject_with_operation(flags : Gio::MountUnmountFlags, mount_operation : Gio::MountOperation | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil #

def eject_with_operation_finish(result : Gio::AsyncResult) : Bool #

def enumerate_identifiers : Enumerable(String) #

def has_media : Bool #

def has_volumes : Bool #

def icon : Gio::Icon #

def identifier(kind : String) : String | Nil #

def is_media_check_automatic : Bool #

def is_media_removable : Bool #

def is_removable : Bool #

def name : String #

def poll_for_media(cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil #

def poll_for_media_finish(result : Gio::AsyncResult) : Bool #

def sort_key : String | Nil #

def start(flags : Gio::DriveStartFlags, mount_operation : Gio::MountOperation | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil #

def start_finish(result : Gio::AsyncResult) : Bool #

def start_stop_type : Gio::DriveStartStopType #

def stop(flags : Gio::MountUnmountFlags, mount_operation : Gio::MountOperation | Nil, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil #

def stop_button_signal #

def stop_finish(result : Gio::AsyncResult) : Bool #

def symbolic_icon : Gio::Icon #

abstract def to_unsafe #

def volumes : GLib::List #