gio-0.12.4: Binding to the GIO.

Portabilityportable (depends on GHC)
Stabilityalpha
Maintainergtk2hs-devel@lists.sourceforge.net
Safe HaskellNone

System.GIO.Volumes.Drive

Contents

Description

 

Synopsis

Details

Drive - this represent a piece of hardware connected to the machine. It's generally only created for removable hardware or hardware with removable media.

Drive is a container class for Volume objects that stem from the same piece of media. As such, Drive abstracts a drive with (or without) removable media and provides operations for querying whether media is available, determing whether media change is automatically detected and ejecting the media.

If the Drive 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.

Drive 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 Drive may vary according to implementation. To choose the correct verbs in e.g. a file manager, use driveGetStartStopType.

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

Types

newtype Drive

Constructors

Drive (ForeignPtr Drive) 

class GObjectClass o => DriveClass o

Instances

Enums,

Methods

driveGetName

Arguments

:: DriveClass drive 
=> drive 
-> IO String

returns the name for the given drive.

Gets the name of drive.

driveGetIcon

Arguments

:: DriveClass drive 
=> drive 
-> IO Icon

returns a Icon.

Gets the icon for drive.

driveHasVolumes

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if the drive contains volumes, False otherwise.

Check if drive has any mountable volumes.

driveGetVolumes :: DriveClass drive => drive -> IO [Volume]

Get a list of mountable volumes for drive.

driveCanEject

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if the drive can be ejected.

Checks if drive can be eject.

driveGetStartStopType

Arguments

:: DriveClass drive 
=> drive 
-> IO DriveStartStopType

returns A value from the DriveStartStopType enumeration.

Gets a hint about how a drive can be started/stopped.

driveCanStart

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if the drive can be started, False otherwise.

Checks if a drive can be started.

driveCanStartDegraded

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if the drive can be started degraded, False otherwise.

Checks if a drive can be started degraded.

driveCanStop

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if the drive can be stoped, False otherwise.

Checks if a drive can be stoped.

driveCanPollForMedia :: DriveClass drive => drive -> IO Bool

Checks if a drive can be polled for media changes.

drivePollForMedia :: DriveClass drive => drive -> Maybe Cancellable -> AsyncReadyCallback -> IO ()

Asynchronously polls drive to see if media has been inserted or removed.

When the operation is finished, callback will be called. You can then call drivePollForMediaFinish to obtain the result of the operation.

driveHasMedia

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if drive has media, False otherwise.

Checks if the drive has media. Note that the OS may not be polling the drive for media changes; see driveIsMediaCheckAutomatic for more details.

driveIsMediaCheckAutomatic

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if the drive is capabable of automatically detecting media changes, False otherwise.

Checks if drive is capabable of automatically detecting media changes.

driveIsMediaRemovable

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if drive supports removable media, False otherwise.

Checks if the drive supports removable media.

driveEjectWithOperation

Arguments

:: DriveClass drive 
=> drive 
-> [MountUnmountFlags]

flags flags affecting the unmount if required for eject

-> Maybe MountOperation

mountOperation a MountOperation or Nothing to avoid user interaction.

-> Maybe Cancellable

cancellable optional Cancellable object, Nothing to ignore.

-> AsyncReadyCallback

callback a AsyncReadyCallback

-> IO () 

Ejects a drive. This is an asynchronous operation, and is finished by calling driveEjectWithOperationFinish with the drive and AsyncResult data returned in the callback.

driveEjectWithOperationFinish

Arguments

:: DriveClass drive 
=> drive 
-> AsyncResult

result a AsyncResult.

-> IO () 

Finishes ejecting a drive. If any errors occurred during the operation, error will be set to contain the errors and False will be returned.

Throws a GError if an error occurs.

driveStart

Arguments

:: DriveClass drive 
=> drive 
-> [DriveStartFlags]

flags flags affecting the start operation.

-> Maybe MountOperation

mountOperation a MountOperation or Nothing to avoid user interaction.

-> Maybe Cancellable

cancellable optional Cancellable object, Nothing to ignore.

-> AsyncReadyCallback

callback a AsyncReadyCallback

-> IO () 

Asynchronously starts a drive.

When the operation is finished, callback will be called. You can then call driveStartFinish to obtain the result of the operation.

driveStartFinish

Arguments

:: DriveClass drive 
=> drive 
-> AsyncResult

result a AsyncResult.

-> IO () 

Finishes starting a drive.

Throws a GError if an error occurs.

driveStopFinish

Arguments

:: DriveClass drive 
=> drive 
-> AsyncResult

result a AsyncResult.

-> IO () 

Finishes stoping a drive.

Throws a GError if an error occurs.

driveEnumerateIdentifiers :: DriveClass drive => drive -> IO [String]

Gets the kinds of identifiers that drive has. Use driveGetIdentifer to obtain the identifiers themselves.

driveGetIdentifier

Arguments

:: DriveClass drive 
=> drive 
-> String

kind the kind of identifier to return

-> IO String 

Gets the identifier of the given kind for drive. See the introduction for more information about drive identifiers.

Signals

driveChanged :: DriveClass drive => Signal drive (Drive -> IO ())

Emitted when a drive changes.

driveDisconnected :: DriveClass drive => Signal drive (Drive -> IO ())

Emitted when a drive changes.

driveEjectButton :: DriveClass drive => Signal drive (Drive -> IO ())

Emitted when the eject button is pressed on drive.

driveStopButton :: DriveClass drive => Signal drive (Drive -> IO ())

Emitted when the stop button is pressed on drive.