gi-gio-2.0.12: Gio bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Interfaces.Drive

Contents

Description

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, determining 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.

Synopsis

Exported types

newtype Drive Source #

Constructors

Drive (ManagedPtr Drive) 

Instances

GObject Drive Source # 

Methods

gobjectType :: Drive -> IO GType #

IsObject Drive Source # 
IsDrive Drive Source # 
((~) * info (ResolveDriveMethod t Drive), MethodInfo * info Drive p) => IsLabel t (Drive -> p) Source # 

Methods

fromLabel :: Proxy# Symbol t -> Drive -> p #

((~) * info (ResolveDriveMethod t Drive), MethodInfo * info Drive p) => IsLabelProxy t (Drive -> p) Source # 

Methods

fromLabelProxy :: Proxy Symbol t -> Drive -> p #

HasAttributeList * Drive Source # 
type AttributeList Drive Source # 
type SignalList Drive Source # 

Methods

canEject

data DriveCanEjectMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsDrive a) => MethodInfo * DriveCanEjectMethodInfo a signature Source # 

driveCanEject Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Bool

Returns: True if the drive can be ejected, False otherwise.

Checks if a drive can be ejected.

canPollForMedia

driveCanPollForMedia Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Bool

Returns: True if the drive can be polled for media changes, False otherwise.

Checks if a drive can be polled for media changes.

canStart

data DriveCanStartMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsDrive a) => MethodInfo * DriveCanStartMethodInfo a signature Source # 

driveCanStart Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Bool

Returns: True if the drive can be started, False otherwise.

Checks if a drive can be started.

Since: 2.22

canStartDegraded

driveCanStartDegraded Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Bool

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

Checks if a drive can be started degraded.

Since: 2.22

canStop

data DriveCanStopMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsDrive a) => MethodInfo * DriveCanStopMethodInfo a signature Source # 

driveCanStop Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Bool

Returns: True if the drive can be stopped, False otherwise.

Checks if a drive can be stopped.

Since: 2.22

eject

data DriveEjectMethodInfo Source #

Instances

((~) * signature ([MountUnmountFlags] -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsDrive a, IsCancellable b) => MethodInfo * DriveEjectMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy DriveEjectMethodInfo a -> signature -> s #

driveEject Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsCancellable b) 
=> a

drive: a Drive.

-> [MountUnmountFlags]

flags: flags affecting the unmount if required for eject

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

-> m () 

Deprecated: (Since version 2.22)Use driveEjectWithOperation instead.

Asynchronously ejects a drive.

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

ejectFinish

data DriveEjectFinishMethodInfo Source #

Instances

((~) * signature (b -> m ()), MonadIO m, IsDrive a, IsAsyncResult b) => MethodInfo * DriveEjectFinishMethodInfo a signature Source # 

driveEjectFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsAsyncResult b) 
=> a

drive: a Drive.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

Deprecated: (Since version 2.22)Use driveEjectWithOperationFinish instead.

Finishes ejecting a drive.

ejectWithOperation

driveEjectWithOperation Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsMountOperation b, IsCancellable c) 
=> a

drive: a Drive.

-> [MountUnmountFlags]

flags: flags affecting the unmount if required for eject

-> Maybe b

mountOperation: a MountOperation or Nothing to avoid user interaction.

-> Maybe c

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

-> m () 

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

Since: 2.22

ejectWithOperationFinish

driveEjectWithOperationFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsAsyncResult b) 
=> a

drive: a Drive.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

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

Since: 2.22

enumerateIdentifiers

driveEnumerateIdentifiers Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive

-> m [Text]

Returns: a Nothing-terminated array of strings containing kinds of identifiers. Use strfreev to free.

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

getIcon

data DriveGetIconMethodInfo Source #

Instances

((~) * signature (m Icon), MonadIO m, IsDrive a) => MethodInfo * DriveGetIconMethodInfo a signature Source # 

driveGetIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Icon

Returns: Icon for the drive. Free the returned object with objectUnref.

Gets the icon for drive.

getIdentifier

driveGetIdentifier Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive

-> Text

kind: the kind of identifier to return

-> m Text

Returns: a newly allocated string containing the requested identfier, or Nothing if the Drive doesn't have this kind of identifier.

Gets the identifier of the given kind for drive.

getName

data DriveGetNameMethodInfo Source #

Instances

((~) * signature (m Text), MonadIO m, IsDrive a) => MethodInfo * DriveGetNameMethodInfo a signature Source # 

driveGetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Text

Returns: a string containing drive's name. The returned string should be freed when no longer needed.

Gets the name of drive.

getSortKey

data DriveGetSortKeyMethodInfo Source #

Instances

((~) * signature (m Text), MonadIO m, IsDrive a) => MethodInfo * DriveGetSortKeyMethodInfo a signature Source # 

driveGetSortKey Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: A Drive.

-> m Text

Returns: Sorting key for drive or Nothing if no such key is available.

Gets the sort key for drive, if any.

Since: 2.32

getStartStopType

driveGetStartStopType Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m DriveStartStopType

Returns: A value from the DriveStartStopType enumeration.

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

Since: 2.22

getSymbolicIcon

driveGetSymbolicIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Icon

Returns: symbolic Icon for the drive. Free the returned object with objectUnref.

Gets the icon for drive.

Since: 2.34

getVolumes

data DriveGetVolumesMethodInfo Source #

Instances

((~) * signature (m [Volume]), MonadIO m, IsDrive a) => MethodInfo * DriveGetVolumesMethodInfo a signature Source # 

driveGetVolumes Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m [Volume]

Returns: List containing any Volume objects on the given drive.

Get a list of mountable volumes for drive.

The returned list should be freed with g_list_free(), after its elements have been unreffed with objectUnref.

hasMedia

data DriveHasMediaMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsDrive a) => MethodInfo * DriveHasMediaMethodInfo a signature Source # 

driveHasMedia Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m 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.

hasVolumes

data DriveHasVolumesMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsDrive a) => MethodInfo * DriveHasVolumesMethodInfo a signature Source # 

driveHasVolumes Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Bool

Returns: True if the drive contains volumes, False otherwise.

Check if drive has any mountable volumes.

isMediaCheckAutomatic

driveIsMediaCheckAutomatic Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m 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.

isMediaRemovable

driveIsMediaRemovable Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Bool

Returns: True if drive supports removable media, False otherwise.

Checks if the drive supports removable media.

isRemovable

data DriveIsRemovableMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsDrive a) => MethodInfo * DriveIsRemovableMethodInfo a signature Source # 

driveIsRemovable Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a) 
=> a

drive: a Drive.

-> m Bool

Returns: True if drive and/or its media is considered removable, False otherwise.

Checks if the Drive and/or its media is considered removable by the user. See driveIsMediaRemovable.

Since: 2.50

pollForMedia

drivePollForMedia Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsCancellable b) 
=> a

drive: a Drive.

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

-> m () 

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.

pollForMediaFinish

drivePollForMediaFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsAsyncResult b) 
=> a

drive: a Drive.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

Finishes an operation started with drivePollForMedia on a drive.

start

driveStart Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsMountOperation b, IsCancellable c) 
=> a

drive: a Drive.

-> [DriveStartFlags]

flags: flags affecting the start operation.

-> Maybe b

mountOperation: a MountOperation or Nothing to avoid user interaction.

-> Maybe c

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

-> m () 

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.

Since: 2.22

startFinish

data DriveStartFinishMethodInfo Source #

Instances

((~) * signature (b -> m ()), MonadIO m, IsDrive a, IsAsyncResult b) => MethodInfo * DriveStartFinishMethodInfo a signature Source # 

driveStartFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsAsyncResult b) 
=> a

drive: a Drive.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

Finishes starting a drive.

Since: 2.22

stop

driveStop Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsMountOperation b, IsCancellable c) 
=> a

drive: a Drive.

-> [MountUnmountFlags]

flags: flags affecting the unmount if required for stopping.

-> Maybe b

mountOperation: a MountOperation or Nothing to avoid user interaction.

-> Maybe c

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

-> m () 

Asynchronously stops a drive.

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

Since: 2.22

stopFinish

data DriveStopFinishMethodInfo Source #

Instances

((~) * signature (b -> m ()), MonadIO m, IsDrive a, IsAsyncResult b) => MethodInfo * DriveStopFinishMethodInfo a signature Source # 

driveStopFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrive a, IsAsyncResult b) 
=> a

drive: a Drive.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

Finishes stopping a drive.

Since: 2.22

Signals

changed

type C_DriveChangedCallback = Ptr () -> Ptr () -> IO () Source #

disconnected

ejectButton

stopButton

type C_DriveStopButtonCallback = Ptr () -> Ptr () -> IO () Source #