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

Enums,

Methods

driveGetNameSource

Arguments

:: DriveClass drive 
=> drive 
-> IO String

returns the name for the given drive.

Gets the name of drive.

driveGetIconSource

Arguments

:: DriveClass drive 
=> drive 
-> IO Icon

returns a Icon.

Gets the icon for drive.

driveHasVolumesSource

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]Source

Get a list of mountable volumes for drive.

driveCanEjectSource

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if the drive can be ejected.

Checks if drive can be eject.

driveGetStartStopTypeSource

Arguments

:: DriveClass drive 
=> drive 
-> IO DriveStartStopType

returns A value from the DriveStartStopType enumeration.

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

driveCanStartSource

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

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

Checks if a drive can be started.

driveCanStartDegradedSource

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.

driveCanStopSource

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 BoolSource

Checks if a drive can be polled for media changes.

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

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.

driveHasMediaSource

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.

driveIsMediaCheckAutomaticSource

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.

driveIsMediaRemovableSource

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if drive supports removable media, False otherwise.

Checks if the drive supports removable media.

driveEjectWithOperationSource

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.

driveEjectWithOperationFinishSource

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.

driveStartSource

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.

driveStartFinishSource

Arguments

:: DriveClass drive 
=> drive 
-> AsyncResult

result a AsyncResult.

-> IO () 

Finishes starting a drive.

Throws a GError if an error occurs.

driveStopFinishSource

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]Source

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

driveGetIdentifierSource

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 ())Source

Emitted when a drive changes.

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

Emitted when a drive changes.

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

Emitted when the eject button is pressed on drive.

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

Emitted when the stop button is pressed on drive.