gio-0.13.1.1: Binding to GIO

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

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

driveGetName Source

Arguments

:: (DriveClass drive, GlibString string) 
=> drive 
-> IO string

returns the name for the given drive.

Gets the name of drive.

driveGetIcon Source

Arguments

:: DriveClass drive 
=> drive 
-> IO Icon

returns a Icon.

Gets the icon for drive.

driveHasVolumes Source

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.

driveCanEject Source

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if the drive can be ejected.

Checks if drive can be eject.

driveGetStartStopType Source

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 Source

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

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

Checks if a drive can be started.

driveCanStartDegraded Source

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 Source

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 Source

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.

driveHasMedia Source

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 Source

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 Source

Arguments

:: DriveClass drive 
=> drive 
-> IO Bool

returns True if drive supports removable media, False otherwise.

Checks if the drive supports removable media.

driveEjectWithOperation Source

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 Source

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 Source

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 Source

Arguments

:: DriveClass drive 
=> drive 
-> AsyncResult

result a AsyncResult.

-> IO () 

Finishes starting a drive.

Throws a GError if an error occurs.

driveStopFinish Source

Arguments

:: DriveClass drive 
=> drive 
-> AsyncResult

result a AsyncResult.

-> IO () 

Finishes stoping a drive.

Throws a GError if an error occurs.

driveEnumerateIdentifiers :: (DriveClass drive, GlibString string) => drive -> IO [string] Source

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

driveGetIdentifier Source

Arguments

:: (DriveClass drive, GlibString string) 
=> 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.