{-# LINE 2 "./System/GIO/Volumes/Drive.chs" #-}-- GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*----- Author : Andy Stewart-- Created: 30-Apirl-2010---- Copyright (c) 2010 Andy Stewart---- This library is free software: you can redistribute it and/or-- modify it under the terms of the GNU Lesser General Public License-- as published by the Free Software Foundation, either version 3 of-- the License, or (at your option) any later version.---- This library is distributed in the hope that it will be useful,-- but WITHOUT ANY WARRANTY; without even the implied warranty of-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU-- Lesser General Public License for more details.---- You should have received a copy of the GNU Lesser General Public-- License along with this program. If not, see-- <http:---- GIO, the C library which this Haskell library depends on, is-- available under LGPL Version 2. The documentation included with-- this library is based on the original GIO documentation.---- | Maintainer : gtk2hs-devel@lists.sourceforge.net-- Stability : alpha-- Portability : portable (depends on GHC)moduleSystem.GIO.Volumes.Drive(-- * 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.-- * TypesDrive(..),DriveClass,-- * Enums,DriveStartStopType(..),DriveStartFlags(..),-- * MethodsdriveGetName,driveGetIcon,driveHasVolumes,driveGetVolumes,driveCanEject,driveGetStartStopType,driveCanStart,driveCanStartDegraded,driveCanStop,driveCanPollForMedia,drivePollForMedia,driveHasMedia,driveIsMediaCheckAutomatic,driveIsMediaRemovable,driveEjectWithOperation,driveEjectWithOperationFinish,driveStart,driveStartFinish,driveStopFinish,driveEnumerateIdentifiers,driveGetIdentifier,-- * SignalsdriveChanged,driveDisconnected,driveEjectButton,driveStopButton,)whereimportControl.MonadimportData.Maybe(fromMaybe)importSystem.GIO.EnumsimportSystem.Glib.AttributesimportSystem.Glib.FFIimportSystem.Glib.FlagsimportSystem.Glib.GErrorimportSystem.Glib.GListimportSystem.Glib.GObjectimportSystem.Glib.PropertiesimportSystem.Glib.SignalsimportSystem.Glib.UTFStringimportSystem.GIO.Async.AsyncResult{-# LINE 111 "./System/GIO/Volumes/Drive.chs" #-}importSystem.GIO.Signals{-# LINE 112 "./System/GIO/Volumes/Drive.chs" #-}importSystem.GIO.Types{-# LINE 113 "./System/GIO/Volumes/Drive.chs" #-}{-# LINE 115 "./System/GIO/Volumes/Drive.chs" #-}---------------------- Methods-- | Gets the name of drive.driveGetName::DriveClassdrive=>drive->IOString-- ^ returns the name for the given drive.driveGetNamedrive=(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_get_nameargPtr1)(toDrivedrive)>>=readUTFString-- | Gets the icon for drive.driveGetIcon::DriveClassdrive=>drive->IOIcon-- ^ returns a 'Icon'.driveGetIcondrive=wrapNewGObjectmkIcon$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_get_iconargPtr1)(toDrivedrive)-- | Check if drive has any mountable volumes.driveHasVolumes::DriveClassdrive=>drive->IOBool-- ^ returns 'True' if the drive contains volumes, 'False' otherwise.driveHasVolumesdrive=liftMtoBool$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_has_volumesargPtr1)(toDrivedrive)-- | Get a list of mountable volumes for drive.driveGetVolumes::DriveClassdrive=>drive->IO[Volume]driveGetVolumesdrive=doglistPtr<-(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_get_volumesargPtr1)(toDrivedrive)volumePtrs<-fromGListglistPtrmapM(wrapNewGObjectmkVolume.return)volumePtrs-- | Checks if drive can be eject.driveCanEject::DriveClassdrive=>drive->IOBool-- ^ returns 'True' if the drive can be ejected.driveCanEjectdrive=liftMtoBool$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_can_ejectargPtr1)(toDrivedrive)-- | Gets a hint about how a drive can be started/stopped.driveGetStartStopType::DriveClassdrive=>drive->IODriveStartStopType-- ^ returns A value from the 'DriveStartStopType' enumeration.driveGetStartStopTypedrive=liftM(toEnum.fromIntegral)$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_get_start_stop_typeargPtr1)(toDrivedrive)-- | Checks if a drive can be started.driveCanStart::DriveClassdrive=>drive->IOBool-- ^ returns 'True' if the drive can be started, 'False' otherwise.driveCanStartdrive=liftMtoBool$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_can_startargPtr1)(toDrivedrive)-- | Checks if a drive can be started degraded.driveCanStartDegraded::DriveClassdrive=>drive->IOBool-- ^ returns 'True' if the drive can be started degraded, 'False' otherwise.driveCanStartDegradeddrive=liftMtoBool$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_can_start_degradedargPtr1)(toDrivedrive)-- | Checks if a drive can be stoped.driveCanStop::DriveClassdrive=>drive->IOBool-- ^ returns 'True' if the drive can be stoped, 'False' otherwise.driveCanStopdrive=liftMtoBool$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_can_stopargPtr1)(toDrivedrive)-- | Checks if a drive can be polled for media changes.driveCanPollForMedia::DriveClassdrive=>drive->IOBooldriveCanPollForMediadrive=liftMtoBool$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_can_poll_for_mediaargPtr1)(toDrivedrive)-- | 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.drivePollForMedia::DriveClassdrive=>drive->MaybeCancellable->AsyncReadyCallback->IO()drivePollForMediadrivecancellablecallback=docCallback<-marshalAsyncReadyCallbackcallback(\(Drivearg1)(Cancellablearg2)arg3arg4->withForeignPtrarg1$\argPtr1->withForeignPtrarg2$\argPtr2->g_drive_poll_for_mediaargPtr1argPtr2arg3arg4){-# LINE 202 "./System/GIO/Volumes/Drive.chs" #-}(toDrivedrive)(fromMaybe(CancellablenullForeignPtr)cancellable)cCallback(castFunPtrToPtrcCallback)-- | Finishes an operation started with 'drivePollForMedia' on a drive.---- Throws a 'GError' if an error occurs.drivePollForMediaFinish::DriveClassdrive=>drive->AsyncResult-- ^ @result@ a 'AsyncResult'.->IO()drivePollForMediaFinishdriveresult=propagateGError(\gErrorPtr->do(\(Drivearg1)(AsyncResultarg2)arg3->withForeignPtrarg1$\argPtr1->withForeignPtrarg2$\argPtr2->g_drive_poll_for_media_finishargPtr1argPtr2arg3){-# LINE 216 "./System/GIO/Volumes/Drive.chs" #-}(toDrivedrive)resultgErrorPtrreturn())-- | Checks if the drive has media. Note that the OS may not be polling the drive for media changes; see-- 'driveIsMediaCheckAutomatic' for more details.driveHasMedia::DriveClassdrive=>drive->IOBool-- ^ returns 'True' if drive has media, 'False' otherwise.driveHasMediadrive=liftMtoBool$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_has_mediaargPtr1)(toDrivedrive)-- | Checks if drive is capabable of automatically detecting media changes.driveIsMediaCheckAutomatic::DriveClassdrive=>drive->IOBool-- ^ returns 'True' if the drive is capabable of automatically detecting media changes, 'False' otherwise.driveIsMediaCheckAutomaticdrive=liftMtoBool$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_is_media_check_automaticargPtr1)(toDrivedrive)-- | Checks if the drive supports removable media.driveIsMediaRemovable::DriveClassdrive=>drive->IOBool-- ^ returns 'True' if drive supports removable media, 'False' otherwise.driveIsMediaRemovabledrive=liftMtoBool$(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_is_media_removableargPtr1)(toDrivedrive)-- | Ejects a drive. This is an asynchronous operation, and is finished by calling-- 'driveEjectWithOperationFinish' with the drive and 'AsyncResult' data returned in the callback.driveEjectWithOperation::DriveClassdrive=>drive->[MountUnmountFlags]-- ^ @flags@ flags affecting the unmount if required for eject->MaybeMountOperation-- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction.->MaybeCancellable-- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.->AsyncReadyCallback-- ^ @callback@ a 'AsyncReadyCallback'->IO()driveEjectWithOperationdriveflagsmountOperationcancellablecallback=docCallback<-marshalAsyncReadyCallbackcallback(\(Drivearg1)arg2(MountOperationarg3)(Cancellablearg4)arg5arg6->withForeignPtrarg1$\argPtr1->withForeignPtrarg3$\argPtr3->withForeignPtrarg4$\argPtr4->g_drive_eject_with_operationargPtr1arg2argPtr3argPtr4arg5arg6){-# LINE 256 "./System/GIO/Volumes/Drive.chs" #-}(toDrivedrive)((fromIntegral.fromFlags)flags)(fromMaybe(MountOperationnullForeignPtr)mountOperation)(fromMaybe(CancellablenullForeignPtr)cancellable)cCallback(castFunPtrToPtrcCallback)-- | 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.driveEjectWithOperationFinish::DriveClassdrive=>drive->AsyncResult-- ^ @result@ a 'AsyncResult'.->IO()driveEjectWithOperationFinishdriveresult=propagateGError(\gErrorPtr->do(\(Drivearg1)(AsyncResultarg2)arg3->withForeignPtrarg1$\argPtr1->withForeignPtrarg2$\argPtr2->g_drive_eject_with_operation_finishargPtr1argPtr2arg3){-# LINE 274 "./System/GIO/Volumes/Drive.chs" #-}(toDrivedrive)resultgErrorPtrreturn())-- | 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.driveStart::DriveClassdrive=>drive->[DriveStartFlags]-- ^ @flags@ flags affecting the start operation.->MaybeMountOperation-- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction.->MaybeCancellable-- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.->AsyncReadyCallback-- ^ @callback@ a 'AsyncReadyCallback'->IO()driveStartdriveflagsmountOperationcancellablecallback=docCallback<-marshalAsyncReadyCallbackcallback(\(Drivearg1)arg2(MountOperationarg3)(Cancellablearg4)arg5arg6->withForeignPtrarg1$\argPtr1->withForeignPtrarg3$\argPtr3->withForeignPtrarg4$\argPtr4->g_drive_startargPtr1arg2argPtr3argPtr4arg5arg6){-# LINE 293 "./System/GIO/Volumes/Drive.chs" #-}(toDrivedrive)((fromIntegral.fromFlags)flags)(fromMaybe(MountOperationnullForeignPtr)mountOperation)(fromMaybe(CancellablenullForeignPtr)cancellable)cCallback(castFunPtrToPtrcCallback)-- | Finishes starting a drive.---- Throws a 'GError' if an error occurs.driveStartFinish::DriveClassdrive=>drive->AsyncResult-- ^ @result@ a 'AsyncResult'.->IO()driveStartFinishdriveresult=propagateGError(\gErrorPtr->do(\(Drivearg1)(AsyncResultarg2)arg3->withForeignPtrarg1$\argPtr1->withForeignPtrarg2$\argPtr2->g_drive_start_finishargPtr1argPtr2arg3){-# LINE 310 "./System/GIO/Volumes/Drive.chs" #-}(toDrivedrive)resultgErrorPtrreturn())-- | 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.driveStop::DriveClassdrive=>drive->[MountUnmountFlags]-- ^ @flags@ flags affecting the stop operation.->MaybeMountOperation-- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction.->MaybeCancellable-- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.->AsyncReadyCallback-- ^ @callback@ a 'AsyncReadyCallback'->IO()driveStopdriveflagsmountOperationcancellablecallback=docCallback<-marshalAsyncReadyCallbackcallback(\(Drivearg1)arg2(MountOperationarg3)(Cancellablearg4)arg5arg6->withForeignPtrarg1$\argPtr1->withForeignPtrarg3$\argPtr3->withForeignPtrarg4$\argPtr4->g_drive_stopargPtr1arg2argPtr3argPtr4arg5arg6){-# LINE 329 "./System/GIO/Volumes/Drive.chs" #-}(toDrivedrive)((fromIntegral.fromFlags)flags)(fromMaybe(MountOperationnullForeignPtr)mountOperation)(fromMaybe(CancellablenullForeignPtr)cancellable)cCallback(castFunPtrToPtrcCallback)-- | Finishes stoping a drive.---- Throws a 'GError' if an error occurs.driveStopFinish::DriveClassdrive=>drive->AsyncResult-- ^ @result@ a 'AsyncResult'.->IO()driveStopFinishdriveresult=propagateGError(\gErrorPtr->do(\(Drivearg1)(AsyncResultarg2)arg3->withForeignPtrarg1$\argPtr1->withForeignPtrarg2$\argPtr2->g_drive_stop_finishargPtr1argPtr2arg3){-# LINE 346 "./System/GIO/Volumes/Drive.chs" #-}(toDrivedrive)resultgErrorPtrreturn())-- | Gets the kinds of identifiers that drive has. Use 'driveGetIdentifer' to obtain the-- identifiers themselves.driveEnumerateIdentifiers::DriveClassdrive=>drive->IO[String]driveEnumerateIdentifiersdrive=(\(Drivearg1)->withForeignPtrarg1$\argPtr1->g_drive_enumerate_identifiersargPtr1)(toDrivedrive)>>=readUTFStringArray0-- | Gets the identifier of the given kind for drive. See the introduction for more information about-- drive identifiers.driveGetIdentifier::DriveClassdrive=>drive->String-- ^ @kind@ the kind of identifier to return->IOStringdriveGetIdentifierdrivekind=withUTFStringkind$\kindPtr->(\(Drivearg1)arg2->withForeignPtrarg1$\argPtr1->g_drive_get_identifierargPtr1arg2)(toDrivedrive)kindPtr>>=readUTFString---------------------- Signals-- | Emitted when a drive changes.driveChanged::DriveClassdrive=>Signaldrive(Drive->IO())driveChanged=Signal(connect_OBJECT__NONE"drive-changed")-- | Emitted when a drive changes.driveDisconnected::DriveClassdrive=>Signaldrive(Drive->IO())driveDisconnected=Signal(connect_OBJECT__NONE"drive-disconnected")-- | Emitted when the eject button is pressed on drive.driveEjectButton::DriveClassdrive=>Signaldrive(Drive->IO())driveEjectButton=Signal(connect_OBJECT__NONE"drive-eject-button")-- | Emitted when the stop button is pressed on drive.driveStopButton::DriveClassdrive=>Signaldrive(Drive->IO())driveStopButton=Signal(connect_OBJECT__NONE"drive-stop-button")foreignimportccallsafe"g_drive_get_name"g_drive_get_name::((PtrDrive)->(IO(PtrCChar)))foreignimportccallsafe"g_drive_get_icon"g_drive_get_icon::((PtrDrive)->(IO(PtrIcon)))foreignimportccallsafe"g_drive_has_volumes"g_drive_has_volumes::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_get_volumes"g_drive_get_volumes::((PtrDrive)->(IO(Ptr())))foreignimportccallsafe"g_drive_can_eject"g_drive_can_eject::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_get_start_stop_type"g_drive_get_start_stop_type::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_can_start"g_drive_can_start::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_can_start_degraded"g_drive_can_start_degraded::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_can_stop"g_drive_can_stop::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_can_poll_for_media"g_drive_can_poll_for_media::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_poll_for_media"g_drive_poll_for_media::((PtrDrive)->((PtrCancellable)->((FunPtr((Ptr())->((PtrAsyncResult)->((Ptr())->(IO())))))->((Ptr())->(IO())))))foreignimportccallsafe"g_drive_poll_for_media_finish"g_drive_poll_for_media_finish::((PtrDrive)->((PtrAsyncResult)->((Ptr(Ptr()))->(IOCInt))))foreignimportccallsafe"g_drive_has_media"g_drive_has_media::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_is_media_check_automatic"g_drive_is_media_check_automatic::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_is_media_removable"g_drive_is_media_removable::((PtrDrive)->(IOCInt))foreignimportccallsafe"g_drive_eject_with_operation"g_drive_eject_with_operation::((PtrDrive)->(CInt->((PtrMountOperation)->((PtrCancellable)->((FunPtr((Ptr())->((PtrAsyncResult)->((Ptr())->(IO())))))->((Ptr())->(IO())))))))foreignimportccallsafe"g_drive_eject_with_operation_finish"g_drive_eject_with_operation_finish::((PtrDrive)->((PtrAsyncResult)->((Ptr(Ptr()))->(IOCInt))))foreignimportccallsafe"g_drive_start"g_drive_start::((PtrDrive)->(CInt->((PtrMountOperation)->((PtrCancellable)->((FunPtr((Ptr())->((PtrAsyncResult)->((Ptr())->(IO())))))->((Ptr())->(IO())))))))foreignimportccallsafe"g_drive_start_finish"g_drive_start_finish::((PtrDrive)->((PtrAsyncResult)->((Ptr(Ptr()))->(IOCInt))))foreignimportccallsafe"g_drive_stop"g_drive_stop::((PtrDrive)->(CInt->((PtrMountOperation)->((PtrCancellable)->((FunPtr((Ptr())->((PtrAsyncResult)->((Ptr())->(IO())))))->((Ptr())->(IO())))))))foreignimportccallsafe"g_drive_stop_finish"g_drive_stop_finish::((PtrDrive)->((PtrAsyncResult)->((Ptr(Ptr()))->(IOCInt))))foreignimportccallsafe"g_drive_enumerate_identifiers"g_drive_enumerate_identifiers::((PtrDrive)->(IO(Ptr(PtrCChar))))foreignimportccallsafe"g_drive_get_identifier"g_drive_get_identifier::((PtrDrive)->((PtrCChar)->(IO(PtrCChar))))