Maintainer | gtk2hs-devel@lists.sourceforge.net |
---|---|
Stability | alpha |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
- newtype Drive = Drive (ForeignPtr Drive)
- class GObjectClass o => DriveClass o
- data DriveStartStopType
- data DriveStartFlags = DriveStartNone
- driveGetName :: (DriveClass drive, GlibString string) => drive -> IO string
- driveGetIcon :: DriveClass drive => drive -> IO Icon
- driveHasVolumes :: DriveClass drive => drive -> IO Bool
- driveGetVolumes :: DriveClass drive => drive -> IO [Volume]
- driveCanEject :: DriveClass drive => drive -> IO Bool
- driveGetStartStopType :: DriveClass drive => drive -> IO DriveStartStopType
- driveCanStart :: DriveClass drive => drive -> IO Bool
- driveCanStartDegraded :: DriveClass drive => drive -> IO Bool
- driveCanStop :: DriveClass drive => drive -> IO Bool
- driveCanPollForMedia :: DriveClass drive => drive -> IO Bool
- drivePollForMedia :: DriveClass drive => drive -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- driveHasMedia :: DriveClass drive => drive -> IO Bool
- driveIsMediaCheckAutomatic :: DriveClass drive => drive -> IO Bool
- driveIsMediaRemovable :: DriveClass drive => drive -> IO Bool
- driveEjectWithOperation :: DriveClass drive => drive -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- driveEjectWithOperationFinish :: DriveClass drive => drive -> AsyncResult -> IO ()
- driveStart :: DriveClass drive => drive -> [DriveStartFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- driveStartFinish :: DriveClass drive => drive -> AsyncResult -> IO ()
- driveStopFinish :: DriveClass drive => drive -> AsyncResult -> IO ()
- driveEnumerateIdentifiers :: (DriveClass drive, GlibString string) => drive -> IO [string]
- driveGetIdentifier :: (DriveClass drive, GlibString string) => drive -> string -> IO string
- driveChanged :: DriveClass drive => Signal drive (Drive -> IO ())
- driveDisconnected :: DriveClass drive => Signal drive (Drive -> IO ())
- driveEjectButton :: DriveClass drive => Signal drive (Drive -> IO ())
- driveStopButton :: DriveClass drive => Signal drive (Drive -> IO ())
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
class GObjectClass o => DriveClass o Source #
Enums,
data DriveStartStopType Source #
Enumeration describing how a drive can be started/stopped.
data DriveStartFlags Source #
Flags used when starting a drive.
Methods
:: (DriveClass drive, GlibString string) | |
=> drive | |
-> IO string | returns the name for the given drive. |
Gets the name of drive.
:: DriveClass drive | |
=> drive | |
-> IO Bool | returns |
Check if drive has any mountable volumes.
driveGetVolumes :: DriveClass drive => drive -> IO [Volume] Source #
Get a list of mountable volumes for drive.
:: DriveClass drive | |
=> drive | |
-> IO Bool | returns |
Checks if drive can be eject.
driveGetStartStopType Source #
:: DriveClass drive | |
=> drive | |
-> IO DriveStartStopType | returns A value from the |
Gets a hint about how a drive can be started/stopped.
:: DriveClass drive | |
=> drive | |
-> IO Bool |
Checks if a drive can be started.
driveCanStartDegraded Source #
:: DriveClass drive | |
=> drive | |
-> IO Bool | returns |
Checks if a drive can be started degraded.
:: DriveClass drive | |
=> drive | |
-> IO Bool |
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.
:: DriveClass drive | |
=> drive | |
-> IO Bool |
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 #
:: DriveClass drive | |
=> drive | |
-> IO Bool | returns |
Checks if drive is capabable of automatically detecting media changes.
driveIsMediaRemovable Source #
:: DriveClass drive | |
=> drive | |
-> IO Bool | returns |
Checks if the drive supports removable media.
driveEjectWithOperation Source #
:: DriveClass drive | |
=> drive | |
-> [MountUnmountFlags] |
|
-> Maybe MountOperation |
|
-> Maybe Cancellable |
|
-> 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 #
:: DriveClass drive | |
=> drive | |
-> AsyncResult |
|
-> IO () |
:: DriveClass drive | |
=> drive | |
-> [DriveStartFlags] |
|
-> Maybe MountOperation |
|
-> Maybe Cancellable |
|
-> 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.
:: DriveClass drive | |
=> drive | |
-> AsyncResult |
|
-> IO () |
Finishes starting a drive.
Throws a GError
if an error occurs.
:: DriveClass drive | |
=> drive | |
-> 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.
:: (DriveClass drive, GlibString string) | |
=> drive | |
-> string |
|
-> 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.