{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

'GI.Gio.Interfaces.Drive.Drive' - this represent a piece of hardware connected to the machine.
It\'s generally only created for removable hardware or hardware with
removable media.

'GI.Gio.Interfaces.Drive.Drive' is a container class for 'GI.Gio.Interfaces.Volume.Volume' objects that stem from
the same piece of media. As such, 'GI.Gio.Interfaces.Drive.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 'GI.Gio.Interfaces.Drive.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.

'GI.Gio.Interfaces.Drive.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 'GI.Gio.Interfaces.Drive.Drive' may vary
according to implementation. To choose the correct verbs in e.g. a
file manager, use 'GI.Gio.Interfaces.Drive.driveGetStartStopType'.

For porting from GnomeVFS note that there is no equivalent of
'GI.Gio.Interfaces.Drive.Drive' in that API.
-}

module GI.Gio.Interfaces.Drive
    ( 

-- * Exported types
    Drive(..)                               ,
    noDrive                                 ,
    IsDrive                                 ,
    toDrive                                 ,


 -- * Methods
-- ** canEject #method:canEject#
    DriveCanEjectMethodInfo                 ,
    driveCanEject                           ,


-- ** canPollForMedia #method:canPollForMedia#
    DriveCanPollForMediaMethodInfo          ,
    driveCanPollForMedia                    ,


-- ** canStart #method:canStart#
    DriveCanStartMethodInfo                 ,
    driveCanStart                           ,


-- ** canStartDegraded #method:canStartDegraded#
    DriveCanStartDegradedMethodInfo         ,
    driveCanStartDegraded                   ,


-- ** canStop #method:canStop#
    DriveCanStopMethodInfo                  ,
    driveCanStop                            ,


-- ** eject #method:eject#
    DriveEjectMethodInfo                    ,
    driveEject                              ,


-- ** ejectFinish #method:ejectFinish#
    DriveEjectFinishMethodInfo              ,
    driveEjectFinish                        ,


-- ** ejectWithOperation #method:ejectWithOperation#
    DriveEjectWithOperationMethodInfo       ,
    driveEjectWithOperation                 ,


-- ** ejectWithOperationFinish #method:ejectWithOperationFinish#
    DriveEjectWithOperationFinishMethodInfo ,
    driveEjectWithOperationFinish           ,


-- ** enumerateIdentifiers #method:enumerateIdentifiers#
    DriveEnumerateIdentifiersMethodInfo     ,
    driveEnumerateIdentifiers               ,


-- ** getIcon #method:getIcon#
    DriveGetIconMethodInfo                  ,
    driveGetIcon                            ,


-- ** getIdentifier #method:getIdentifier#
    DriveGetIdentifierMethodInfo            ,
    driveGetIdentifier                      ,


-- ** getName #method:getName#
    DriveGetNameMethodInfo                  ,
    driveGetName                            ,


-- ** getSortKey #method:getSortKey#
    DriveGetSortKeyMethodInfo               ,
    driveGetSortKey                         ,


-- ** getStartStopType #method:getStartStopType#
    DriveGetStartStopTypeMethodInfo         ,
    driveGetStartStopType                   ,


-- ** getSymbolicIcon #method:getSymbolicIcon#
    DriveGetSymbolicIconMethodInfo          ,
    driveGetSymbolicIcon                    ,


-- ** getVolumes #method:getVolumes#
    DriveGetVolumesMethodInfo               ,
    driveGetVolumes                         ,


-- ** hasMedia #method:hasMedia#
    DriveHasMediaMethodInfo                 ,
    driveHasMedia                           ,


-- ** hasVolumes #method:hasVolumes#
    DriveHasVolumesMethodInfo               ,
    driveHasVolumes                         ,


-- ** isMediaCheckAutomatic #method:isMediaCheckAutomatic#
    DriveIsMediaCheckAutomaticMethodInfo    ,
    driveIsMediaCheckAutomatic              ,


-- ** isMediaRemovable #method:isMediaRemovable#
    DriveIsMediaRemovableMethodInfo         ,
    driveIsMediaRemovable                   ,


-- ** isRemovable #method:isRemovable#
    DriveIsRemovableMethodInfo              ,
    driveIsRemovable                        ,


-- ** pollForMedia #method:pollForMedia#
    DrivePollForMediaMethodInfo             ,
    drivePollForMedia                       ,


-- ** pollForMediaFinish #method:pollForMediaFinish#
    DrivePollForMediaFinishMethodInfo       ,
    drivePollForMediaFinish                 ,


-- ** start #method:start#
    DriveStartMethodInfo                    ,
    driveStart                              ,


-- ** startFinish #method:startFinish#
    DriveStartFinishMethodInfo              ,
    driveStartFinish                        ,


-- ** stop #method:stop#
    DriveStopMethodInfo                     ,
    driveStop                               ,


-- ** stopFinish #method:stopFinish#
    DriveStopFinishMethodInfo               ,
    driveStopFinish                         ,




 -- * Signals
-- ** changed #signal:changed#
    C_DriveChangedCallback                  ,
    DriveChangedCallback                    ,
    DriveChangedSignalInfo                  ,
    afterDriveChanged                       ,
    genClosure_DriveChanged                 ,
    mk_DriveChangedCallback                 ,
    noDriveChangedCallback                  ,
    onDriveChanged                          ,
    wrap_DriveChangedCallback               ,


-- ** disconnected #signal:disconnected#
    C_DriveDisconnectedCallback             ,
    DriveDisconnectedCallback               ,
    DriveDisconnectedSignalInfo             ,
    afterDriveDisconnected                  ,
    genClosure_DriveDisconnected            ,
    mk_DriveDisconnectedCallback            ,
    noDriveDisconnectedCallback             ,
    onDriveDisconnected                     ,
    wrap_DriveDisconnectedCallback          ,


-- ** ejectButton #signal:ejectButton#
    C_DriveEjectButtonCallback              ,
    DriveEjectButtonCallback                ,
    DriveEjectButtonSignalInfo              ,
    afterDriveEjectButton                   ,
    genClosure_DriveEjectButton             ,
    mk_DriveEjectButtonCallback             ,
    noDriveEjectButtonCallback              ,
    onDriveEjectButton                      ,
    wrap_DriveEjectButtonCallback           ,


-- ** stopButton #signal:stopButton#
    C_DriveStopButtonCallback               ,
    DriveStopButtonCallback                 ,
    DriveStopButtonSignalInfo               ,
    afterDriveStopButton                    ,
    genClosure_DriveStopButton              ,
    mk_DriveStopButtonCallback              ,
    noDriveStopButtonCallback               ,
    onDriveStopButton                       ,
    wrap_DriveStopButtonCallback            ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Volume as Gio.Volume
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.MountOperation as Gio.MountOperation

-- interface Drive 
newtype Drive = Drive (ManagedPtr Drive)
noDrive :: Maybe Drive
noDrive = Nothing

-- signal Drive::changed
type DriveChangedCallback =
    IO ()

noDriveChangedCallback :: Maybe DriveChangedCallback
noDriveChangedCallback = Nothing

type C_DriveChangedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_DriveChangedCallback :: C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)

genClosure_DriveChanged :: DriveChangedCallback -> IO Closure
genClosure_DriveChanged cb = do
    let cb' = wrap_DriveChangedCallback cb
    mk_DriveChangedCallback cb' >>= newCClosure


wrap_DriveChangedCallback ::
    DriveChangedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_DriveChangedCallback _cb _ _ = do
    _cb 


onDriveChanged :: (IsDrive a, MonadIO m) => a -> DriveChangedCallback -> m SignalHandlerId
onDriveChanged obj cb = liftIO $ do
    let cb' = wrap_DriveChangedCallback cb
    cb'' <- mk_DriveChangedCallback cb'
    connectSignalFunPtr obj "changed" cb'' SignalConnectBefore

afterDriveChanged :: (IsDrive a, MonadIO m) => a -> DriveChangedCallback -> m SignalHandlerId
afterDriveChanged obj cb = liftIO $ do
    let cb' = wrap_DriveChangedCallback cb
    cb'' <- mk_DriveChangedCallback cb'
    connectSignalFunPtr obj "changed" cb'' SignalConnectAfter


-- signal Drive::disconnected
type DriveDisconnectedCallback =
    IO ()

noDriveDisconnectedCallback :: Maybe DriveDisconnectedCallback
noDriveDisconnectedCallback = Nothing

type C_DriveDisconnectedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_DriveDisconnectedCallback :: C_DriveDisconnectedCallback -> IO (FunPtr C_DriveDisconnectedCallback)

genClosure_DriveDisconnected :: DriveDisconnectedCallback -> IO Closure
genClosure_DriveDisconnected cb = do
    let cb' = wrap_DriveDisconnectedCallback cb
    mk_DriveDisconnectedCallback cb' >>= newCClosure


wrap_DriveDisconnectedCallback ::
    DriveDisconnectedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_DriveDisconnectedCallback _cb _ _ = do
    _cb 


onDriveDisconnected :: (IsDrive a, MonadIO m) => a -> DriveDisconnectedCallback -> m SignalHandlerId
onDriveDisconnected obj cb = liftIO $ do
    let cb' = wrap_DriveDisconnectedCallback cb
    cb'' <- mk_DriveDisconnectedCallback cb'
    connectSignalFunPtr obj "disconnected" cb'' SignalConnectBefore

afterDriveDisconnected :: (IsDrive a, MonadIO m) => a -> DriveDisconnectedCallback -> m SignalHandlerId
afterDriveDisconnected obj cb = liftIO $ do
    let cb' = wrap_DriveDisconnectedCallback cb
    cb'' <- mk_DriveDisconnectedCallback cb'
    connectSignalFunPtr obj "disconnected" cb'' SignalConnectAfter


-- signal Drive::eject-button
type DriveEjectButtonCallback =
    IO ()

noDriveEjectButtonCallback :: Maybe DriveEjectButtonCallback
noDriveEjectButtonCallback = Nothing

type C_DriveEjectButtonCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_DriveEjectButtonCallback :: C_DriveEjectButtonCallback -> IO (FunPtr C_DriveEjectButtonCallback)

genClosure_DriveEjectButton :: DriveEjectButtonCallback -> IO Closure
genClosure_DriveEjectButton cb = do
    let cb' = wrap_DriveEjectButtonCallback cb
    mk_DriveEjectButtonCallback cb' >>= newCClosure


wrap_DriveEjectButtonCallback ::
    DriveEjectButtonCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_DriveEjectButtonCallback _cb _ _ = do
    _cb 


onDriveEjectButton :: (IsDrive a, MonadIO m) => a -> DriveEjectButtonCallback -> m SignalHandlerId
onDriveEjectButton obj cb = liftIO $ do
    let cb' = wrap_DriveEjectButtonCallback cb
    cb'' <- mk_DriveEjectButtonCallback cb'
    connectSignalFunPtr obj "eject-button" cb'' SignalConnectBefore

afterDriveEjectButton :: (IsDrive a, MonadIO m) => a -> DriveEjectButtonCallback -> m SignalHandlerId
afterDriveEjectButton obj cb = liftIO $ do
    let cb' = wrap_DriveEjectButtonCallback cb
    cb'' <- mk_DriveEjectButtonCallback cb'
    connectSignalFunPtr obj "eject-button" cb'' SignalConnectAfter


-- signal Drive::stop-button
type DriveStopButtonCallback =
    IO ()

noDriveStopButtonCallback :: Maybe DriveStopButtonCallback
noDriveStopButtonCallback = Nothing

type C_DriveStopButtonCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_DriveStopButtonCallback :: C_DriveStopButtonCallback -> IO (FunPtr C_DriveStopButtonCallback)

genClosure_DriveStopButton :: DriveStopButtonCallback -> IO Closure
genClosure_DriveStopButton cb = do
    let cb' = wrap_DriveStopButtonCallback cb
    mk_DriveStopButtonCallback cb' >>= newCClosure


wrap_DriveStopButtonCallback ::
    DriveStopButtonCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_DriveStopButtonCallback _cb _ _ = do
    _cb 


onDriveStopButton :: (IsDrive a, MonadIO m) => a -> DriveStopButtonCallback -> m SignalHandlerId
onDriveStopButton obj cb = liftIO $ do
    let cb' = wrap_DriveStopButtonCallback cb
    cb'' <- mk_DriveStopButtonCallback cb'
    connectSignalFunPtr obj "stop-button" cb'' SignalConnectBefore

afterDriveStopButton :: (IsDrive a, MonadIO m) => a -> DriveStopButtonCallback -> m SignalHandlerId
afterDriveStopButton obj cb = liftIO $ do
    let cb' = wrap_DriveStopButtonCallback cb
    cb'' <- mk_DriveStopButtonCallback cb'
    connectSignalFunPtr obj "stop-button" cb'' SignalConnectAfter


data DriveChangedSignalInfo
instance SignalInfo DriveChangedSignalInfo where
    type HaskellCallbackType DriveChangedSignalInfo = DriveChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DriveChangedCallback cb
        cb'' <- mk_DriveChangedCallback cb'
        connectSignalFunPtr obj "changed" cb'' connectMode

data DriveDisconnectedSignalInfo
instance SignalInfo DriveDisconnectedSignalInfo where
    type HaskellCallbackType DriveDisconnectedSignalInfo = DriveDisconnectedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DriveDisconnectedCallback cb
        cb'' <- mk_DriveDisconnectedCallback cb'
        connectSignalFunPtr obj "disconnected" cb'' connectMode

data DriveEjectButtonSignalInfo
instance SignalInfo DriveEjectButtonSignalInfo where
    type HaskellCallbackType DriveEjectButtonSignalInfo = DriveEjectButtonCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DriveEjectButtonCallback cb
        cb'' <- mk_DriveEjectButtonCallback cb'
        connectSignalFunPtr obj "eject-button" cb'' connectMode

data DriveStopButtonSignalInfo
instance SignalInfo DriveStopButtonSignalInfo where
    type HaskellCallbackType DriveStopButtonSignalInfo = DriveStopButtonCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DriveStopButtonCallback cb
        cb'' <- mk_DriveStopButtonCallback cb'
        connectSignalFunPtr obj "stop-button" cb'' connectMode

type instance O.SignalList Drive = DriveSignalList
type DriveSignalList = ('[ '("changed", DriveChangedSignalInfo), '("disconnected", DriveDisconnectedSignalInfo), '("ejectButton", DriveEjectButtonSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("stopButton", DriveStopButtonSignalInfo)] :: [(Symbol, *)])

foreign import ccall "g_drive_get_type"
    c_g_drive_get_type :: IO GType

instance GObject Drive where
    gobjectType _ = c_g_drive_get_type
    

class GObject o => IsDrive o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Drive a) =>
    IsDrive a
#endif
instance IsDrive Drive
instance GObject.Object.IsObject Drive

toDrive :: IsDrive o => o -> IO Drive
toDrive = unsafeCastTo Drive

instance O.HasAttributeList Drive
type instance O.AttributeList Drive = DriveAttributeList
type DriveAttributeList = ('[ ] :: [(Symbol, *)])

type family ResolveDriveMethod (t :: Symbol) (o :: *) :: * where
    ResolveDriveMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDriveMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDriveMethod "canEject" o = DriveCanEjectMethodInfo
    ResolveDriveMethod "canPollForMedia" o = DriveCanPollForMediaMethodInfo
    ResolveDriveMethod "canStart" o = DriveCanStartMethodInfo
    ResolveDriveMethod "canStartDegraded" o = DriveCanStartDegradedMethodInfo
    ResolveDriveMethod "canStop" o = DriveCanStopMethodInfo
    ResolveDriveMethod "eject" o = DriveEjectMethodInfo
    ResolveDriveMethod "ejectFinish" o = DriveEjectFinishMethodInfo
    ResolveDriveMethod "ejectWithOperation" o = DriveEjectWithOperationMethodInfo
    ResolveDriveMethod "ejectWithOperationFinish" o = DriveEjectWithOperationFinishMethodInfo
    ResolveDriveMethod "enumerateIdentifiers" o = DriveEnumerateIdentifiersMethodInfo
    ResolveDriveMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDriveMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDriveMethod "hasMedia" o = DriveHasMediaMethodInfo
    ResolveDriveMethod "hasVolumes" o = DriveHasVolumesMethodInfo
    ResolveDriveMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDriveMethod "isMediaCheckAutomatic" o = DriveIsMediaCheckAutomaticMethodInfo
    ResolveDriveMethod "isMediaRemovable" o = DriveIsMediaRemovableMethodInfo
    ResolveDriveMethod "isRemovable" o = DriveIsRemovableMethodInfo
    ResolveDriveMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDriveMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDriveMethod "pollForMedia" o = DrivePollForMediaMethodInfo
    ResolveDriveMethod "pollForMediaFinish" o = DrivePollForMediaFinishMethodInfo
    ResolveDriveMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDriveMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDriveMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDriveMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveDriveMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDriveMethod "start" o = DriveStartMethodInfo
    ResolveDriveMethod "startFinish" o = DriveStartFinishMethodInfo
    ResolveDriveMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDriveMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDriveMethod "stop" o = DriveStopMethodInfo
    ResolveDriveMethod "stopFinish" o = DriveStopFinishMethodInfo
    ResolveDriveMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDriveMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDriveMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDriveMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDriveMethod "getIcon" o = DriveGetIconMethodInfo
    ResolveDriveMethod "getIdentifier" o = DriveGetIdentifierMethodInfo
    ResolveDriveMethod "getName" o = DriveGetNameMethodInfo
    ResolveDriveMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDriveMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDriveMethod "getSortKey" o = DriveGetSortKeyMethodInfo
    ResolveDriveMethod "getStartStopType" o = DriveGetStartStopTypeMethodInfo
    ResolveDriveMethod "getSymbolicIcon" o = DriveGetSymbolicIconMethodInfo
    ResolveDriveMethod "getVolumes" o = DriveGetVolumesMethodInfo
    ResolveDriveMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDriveMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDriveMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDriveMethod t Drive, O.MethodInfo info Drive p) => O.IsLabelProxy t (Drive -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDriveMethod t Drive, O.MethodInfo info Drive p) => O.IsLabel t (Drive -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- method Drive::can_eject
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_can_eject" g_drive_can_eject :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Checks if a drive can be ejected.
-}
driveCanEject ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the /@drive@/ can be ejected, 'False' otherwise. -}
driveCanEject drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_can_eject drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveCanEjectMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanEjectMethodInfo a signature where
    overloadedMethod _ = driveCanEject

-- method Drive::can_poll_for_media
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_can_poll_for_media" g_drive_can_poll_for_media :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Checks if a drive can be polled for media changes.
-}
driveCanPollForMedia ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the /@drive@/ can be polled for media changes,
    'False' otherwise. -}
driveCanPollForMedia drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_can_poll_for_media drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveCanPollForMediaMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanPollForMediaMethodInfo a signature where
    overloadedMethod _ = driveCanPollForMedia

-- method Drive::can_start
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_can_start" g_drive_can_start :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Checks if a drive can be started.

@since 2.22
-}
driveCanStart ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the /@drive@/ can be started, 'False' otherwise. -}
driveCanStart drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_can_start drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveCanStartMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanStartMethodInfo a signature where
    overloadedMethod _ = driveCanStart

-- method Drive::can_start_degraded
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_can_start_degraded" g_drive_can_start_degraded :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Checks if a drive can be started degraded.

@since 2.22
-}
driveCanStartDegraded ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the /@drive@/ can be started degraded, 'False' otherwise. -}
driveCanStartDegraded drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_can_start_degraded drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveCanStartDegradedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanStartDegradedMethodInfo a signature where
    overloadedMethod _ = driveCanStartDegraded

-- method Drive::can_stop
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_can_stop" g_drive_can_stop :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Checks if a drive can be stopped.

@since 2.22
-}
driveCanStop ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the /@drive@/ can be stopped, 'False' otherwise. -}
driveCanStop drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_can_stop drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveCanStopMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanStopMethodInfo a signature where
    overloadedMethod _ = driveCanStop

-- method Drive::eject
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags affecting the unmount if required for eject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data to pass to @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_eject" g_drive_eject :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{-# DEPRECATED driveEject ["(Since version 2.22)","Use 'GI.Gio.Interfaces.Drive.driveEjectWithOperation' instead."] #-}
{- |
Asynchronously ejects a drive.

When the operation is finished, /@callback@/ will be called.
You can then call 'GI.Gio.Interfaces.Drive.driveEjectFinish' to obtain the
result of the operation.
-}
driveEject ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> [Gio.Flags.MountUnmountFlags]
    {- ^ /@flags@/: flags affecting the unmount if required for eject -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
    -> m ()
driveEject drive flags cancellable callback = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    let flags' = gflagsToWord flags
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    g_drive_eject drive' flags' maybeCancellable maybeCallback userData
    touchManagedPtr drive
    whenJust cancellable touchManagedPtr
    return ()

data DriveEjectMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsDrive a, Gio.Cancellable.IsCancellable b) => O.MethodInfo DriveEjectMethodInfo a signature where
    overloadedMethod _ = driveEject

-- method Drive::eject_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_drive_eject_finish" g_drive_eject_finish :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{-# DEPRECATED driveEjectFinish ["(Since version 2.22)","Use 'GI.Gio.Interfaces.Drive.driveEjectWithOperationFinish' instead."] #-}
{- |
Finishes ejecting a drive.
-}
driveEjectFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
driveEjectFinish drive result_ = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ g_drive_eject_finish drive' result_'
        touchManagedPtr drive
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

data DriveEjectFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DriveEjectFinishMethodInfo a signature where
    overloadedMethod _ = driveEjectFinish

-- method Drive::eject_with_operation
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags affecting the unmount if required for eject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mount_operation", argType = TInterface (Name {namespace = "Gio", name = "MountOperation"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GMountOperation or %NULL to avoid\n    user interaction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_eject_with_operation" g_drive_eject_with_operation :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"})
    Ptr Gio.MountOperation.MountOperation -> -- mount_operation : TInterface (Name {namespace = "Gio", name = "MountOperation"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Ejects a drive. This is an asynchronous operation, and is
finished by calling 'GI.Gio.Interfaces.Drive.driveEjectWithOperationFinish' with the /@drive@/
and 'GI.Gio.Interfaces.AsyncResult.AsyncResult' data returned in the /@callback@/.

@since 2.22
-}
driveEjectWithOperation ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> [Gio.Flags.MountUnmountFlags]
    {- ^ /@flags@/: flags affecting the unmount if required for eject -}
    -> Maybe (b)
    {- ^ /@mountOperation@/: a 'GI.Gio.Objects.MountOperation.MountOperation' or 'Nothing' to avoid
    user interaction. -}
    -> Maybe (c)
    {- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
    -> m ()
driveEjectWithOperation drive flags mountOperation cancellable callback = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    let flags' = gflagsToWord flags
    maybeMountOperation <- case mountOperation of
        Nothing -> return nullPtr
        Just jMountOperation -> do
            jMountOperation' <- unsafeManagedPtrCastPtr jMountOperation
            return jMountOperation'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    g_drive_eject_with_operation drive' flags' maybeMountOperation maybeCancellable maybeCallback userData
    touchManagedPtr drive
    whenJust mountOperation touchManagedPtr
    whenJust cancellable touchManagedPtr
    return ()

data DriveEjectWithOperationMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsDrive a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo DriveEjectWithOperationMethodInfo a signature where
    overloadedMethod _ = driveEjectWithOperation

-- method Drive::eject_with_operation_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_drive_eject_with_operation_finish" g_drive_eject_with_operation_finish :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
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
-}
driveEjectWithOperationFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
driveEjectWithOperationFinish drive result_ = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ g_drive_eject_with_operation_finish drive' result_'
        touchManagedPtr drive
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

data DriveEjectWithOperationFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DriveEjectWithOperationFinishMethodInfo a signature where
    overloadedMethod _ = driveEjectWithOperationFinish

-- method Drive::enumerate_identifiers
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_enumerate_identifiers" g_drive_enumerate_identifiers :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO (Ptr CString)

{- |
Gets the kinds of identifiers that /@drive@/ has.
Use 'GI.Gio.Interfaces.Drive.driveGetIdentifier' to obtain the identifiers
themselves.
-}
driveEnumerateIdentifiers ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive' -}
    -> m [T.Text]
    {- ^ __Returns:__ a 'Nothing'-terminated
    array of strings containing kinds of identifiers. Use 'GI.GLib.Functions.strfreev'
    to free. -}
driveEnumerateIdentifiers drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_enumerate_identifiers drive'
    checkUnexpectedReturnNULL "driveEnumerateIdentifiers" result
    result' <- unpackZeroTerminatedUTF8CArray result
    mapZeroTerminatedCArray freeMem result
    freeMem result
    touchManagedPtr drive
    return result'

data DriveEnumerateIdentifiersMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsDrive a) => O.MethodInfo DriveEnumerateIdentifiersMethodInfo a signature where
    overloadedMethod _ = driveEnumerateIdentifiers

-- method Drive::get_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "Icon"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_get_icon" g_drive_get_icon :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO (Ptr Gio.Icon.Icon)

{- |
Gets the icon for /@drive@/.
-}
driveGetIcon ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Gio.Icon.Icon
    {- ^ __Returns:__ 'GI.Gio.Interfaces.Icon.Icon' for the /@drive@/.
   Free the returned object with 'GI.GObject.Objects.Object.objectUnref'. -}
driveGetIcon drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_get_icon drive'
    checkUnexpectedReturnNULL "driveGetIcon" result
    result' <- (wrapObject Gio.Icon.Icon) result
    touchManagedPtr drive
    return result'

data DriveGetIconMethodInfo
instance (signature ~ (m Gio.Icon.Icon), MonadIO m, IsDrive a) => O.MethodInfo DriveGetIconMethodInfo a signature where
    overloadedMethod _ = driveGetIcon

-- method Drive::get_identifier
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "kind", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the kind of identifier to return", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_get_identifier" g_drive_get_identifier :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    CString ->                              -- kind : TBasicType TUTF8
    IO CString

{- |
Gets the identifier of the given kind for /@drive@/.
-}
driveGetIdentifier ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive' -}
    -> T.Text
    {- ^ /@kind@/: the kind of identifier to return -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string containing the
    requested identfier, or 'Nothing' if the 'GI.Gio.Interfaces.Drive.Drive'
    doesn\'t have this kind of identifier. -}
driveGetIdentifier drive kind = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    kind' <- textToCString kind
    result <- g_drive_get_identifier drive' kind'
    checkUnexpectedReturnNULL "driveGetIdentifier" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr drive
    freeMem kind'
    return result'

data DriveGetIdentifierMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m, IsDrive a) => O.MethodInfo DriveGetIdentifierMethodInfo a signature where
    overloadedMethod _ = driveGetIdentifier

-- method Drive::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_get_name" g_drive_get_name :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CString

{- |
Gets the name of /@drive@/.
-}
driveGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m T.Text
    {- ^ __Returns:__ a string containing /@drive@/\'s name. The returned
    string should be freed when no longer needed. -}
driveGetName drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_get_name drive'
    checkUnexpectedReturnNULL "driveGetName" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr drive
    return result'

data DriveGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDrive a) => O.MethodInfo DriveGetNameMethodInfo a signature where
    overloadedMethod _ = driveGetName

-- method Drive::get_sort_key
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_get_sort_key" g_drive_get_sort_key :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CString

{- |
Gets the sort key for /@drive@/, if any.

@since 2.32
-}
driveGetSortKey ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: A 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m T.Text
    {- ^ __Returns:__ Sorting key for /@drive@/ or 'Nothing' if no such key is available. -}
driveGetSortKey drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_get_sort_key drive'
    checkUnexpectedReturnNULL "driveGetSortKey" result
    result' <- cstringToText result
    touchManagedPtr drive
    return result'

data DriveGetSortKeyMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDrive a) => O.MethodInfo DriveGetSortKeyMethodInfo a signature where
    overloadedMethod _ = driveGetSortKey

-- method Drive::get_start_stop_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "DriveStartStopType"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_get_start_stop_type" g_drive_get_start_stop_type :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CUInt

{- |
Gets a hint about how a drive can be started\/stopped.

@since 2.22
-}
driveGetStartStopType ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Gio.Enums.DriveStartStopType
    {- ^ __Returns:__ A value from the 'GI.Gio.Enums.DriveStartStopType' enumeration. -}
driveGetStartStopType drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_get_start_stop_type drive'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr drive
    return result'

data DriveGetStartStopTypeMethodInfo
instance (signature ~ (m Gio.Enums.DriveStartStopType), MonadIO m, IsDrive a) => O.MethodInfo DriveGetStartStopTypeMethodInfo a signature where
    overloadedMethod _ = driveGetStartStopType

-- method Drive::get_symbolic_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "Icon"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_get_symbolic_icon" g_drive_get_symbolic_icon :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO (Ptr Gio.Icon.Icon)

{- |
Gets the icon for /@drive@/.

@since 2.34
-}
driveGetSymbolicIcon ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Gio.Icon.Icon
    {- ^ __Returns:__ symbolic 'GI.Gio.Interfaces.Icon.Icon' for the /@drive@/.
   Free the returned object with 'GI.GObject.Objects.Object.objectUnref'. -}
driveGetSymbolicIcon drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_get_symbolic_icon drive'
    checkUnexpectedReturnNULL "driveGetSymbolicIcon" result
    result' <- (wrapObject Gio.Icon.Icon) result
    touchManagedPtr drive
    return result'

data DriveGetSymbolicIconMethodInfo
instance (signature ~ (m Gio.Icon.Icon), MonadIO m, IsDrive a) => O.MethodInfo DriveGetSymbolicIconMethodInfo a signature where
    overloadedMethod _ = driveGetSymbolicIcon

-- method Drive::get_volumes
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gio", name = "Volume"})))
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_get_volumes" g_drive_get_volumes :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO (Ptr (GList (Ptr Gio.Volume.Volume)))

{- |
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 'GI.GObject.Objects.Object.objectUnref'.
-}
driveGetVolumes ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m [Gio.Volume.Volume]
    {- ^ __Returns:__ 'GI.GLib.Structs.List.List' containing any 'GI.Gio.Interfaces.Volume.Volume' objects on the given /@drive@/. -}
driveGetVolumes drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_get_volumes drive'
    result' <- unpackGList result
    result'' <- mapM (wrapObject Gio.Volume.Volume) result'
    g_list_free result
    touchManagedPtr drive
    return result''

data DriveGetVolumesMethodInfo
instance (signature ~ (m [Gio.Volume.Volume]), MonadIO m, IsDrive a) => O.MethodInfo DriveGetVolumesMethodInfo a signature where
    overloadedMethod _ = driveGetVolumes

-- method Drive::has_media
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_has_media" g_drive_has_media :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Checks if the /@drive@/ has media. Note that the OS may not be polling
the drive for media changes; see 'GI.Gio.Interfaces.Drive.driveIsMediaCheckAutomatic'
for more details.
-}
driveHasMedia ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@drive@/ has media, 'False' otherwise. -}
driveHasMedia drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_has_media drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveHasMediaMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveHasMediaMethodInfo a signature where
    overloadedMethod _ = driveHasMedia

-- method Drive::has_volumes
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_has_volumes" g_drive_has_volumes :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Check if /@drive@/ has any mountable volumes.
-}
driveHasVolumes ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the /@drive@/ contains volumes, 'False' otherwise. -}
driveHasVolumes drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_has_volumes drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveHasVolumesMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveHasVolumesMethodInfo a signature where
    overloadedMethod _ = driveHasVolumes

-- method Drive::is_media_check_automatic
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_is_media_check_automatic" g_drive_is_media_check_automatic :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Checks if /@drive@/ is capabable of automatically detecting media changes.
-}
driveIsMediaCheckAutomatic ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the /@drive@/ is capabable of automatically detecting
    media changes, 'False' otherwise. -}
driveIsMediaCheckAutomatic drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_is_media_check_automatic drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveIsMediaCheckAutomaticMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveIsMediaCheckAutomaticMethodInfo a signature where
    overloadedMethod _ = driveIsMediaCheckAutomatic

-- method Drive::is_media_removable
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_is_media_removable" g_drive_is_media_removable :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Checks if the /@drive@/ supports removable media.
-}
driveIsMediaRemovable ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@drive@/ supports removable media, 'False' otherwise. -}
driveIsMediaRemovable drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_is_media_removable drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveIsMediaRemovableMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveIsMediaRemovableMethodInfo a signature where
    overloadedMethod _ = driveIsMediaRemovable

-- method Drive::is_removable
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_is_removable" g_drive_is_removable :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    IO CInt

{- |
Checks if the 'GI.Gio.Interfaces.Drive.Drive' and\/or its media is considered removable by the user.
See 'GI.Gio.Interfaces.Drive.driveIsMediaRemovable'.

@since 2.50
-}
driveIsRemovable ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@drive@/ and\/or its media is considered removable, 'False' otherwise. -}
driveIsRemovable drive = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result <- g_drive_is_removable drive'
    let result' = (/= 0) result
    touchManagedPtr drive
    return result'

data DriveIsRemovableMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveIsRemovableMethodInfo a signature where
    overloadedMethod _ = driveIsRemovable

-- method Drive::poll_for_media
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data to pass to @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_poll_for_media" g_drive_poll_for_media :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
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 'GI.Gio.Interfaces.Drive.drivePollForMediaFinish' to obtain the
result of the operation.
-}
drivePollForMedia ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
    -> m ()
drivePollForMedia drive cancellable callback = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    g_drive_poll_for_media drive' maybeCancellable maybeCallback userData
    touchManagedPtr drive
    whenJust cancellable touchManagedPtr
    return ()

data DrivePollForMediaMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsDrive a, Gio.Cancellable.IsCancellable b) => O.MethodInfo DrivePollForMediaMethodInfo a signature where
    overloadedMethod _ = drivePollForMedia

-- method Drive::poll_for_media_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_drive_poll_for_media_finish" g_drive_poll_for_media_finish :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Finishes an operation started with 'GI.Gio.Interfaces.Drive.drivePollForMedia' on a drive.
-}
drivePollForMediaFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
drivePollForMediaFinish drive result_ = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ g_drive_poll_for_media_finish drive' result_'
        touchManagedPtr drive
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

data DrivePollForMediaFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DrivePollForMediaFinishMethodInfo a signature where
    overloadedMethod _ = drivePollForMediaFinish

-- method Drive::start
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "DriveStartFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags affecting the start operation.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mount_operation", argType = TInterface (Name {namespace = "Gio", name = "MountOperation"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GMountOperation or %NULL to avoid\n    user interaction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data to pass to @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_start" g_drive_start :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "DriveStartFlags"})
    Ptr Gio.MountOperation.MountOperation -> -- mount_operation : TInterface (Name {namespace = "Gio", name = "MountOperation"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Asynchronously starts a drive.

When the operation is finished, /@callback@/ will be called.
You can then call 'GI.Gio.Interfaces.Drive.driveStartFinish' to obtain the
result of the operation.

@since 2.22
-}
driveStart ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> [Gio.Flags.DriveStartFlags]
    {- ^ /@flags@/: flags affecting the start operation. -}
    -> Maybe (b)
    {- ^ /@mountOperation@/: a 'GI.Gio.Objects.MountOperation.MountOperation' or 'Nothing' to avoid
    user interaction. -}
    -> Maybe (c)
    {- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
    -> m ()
driveStart drive flags mountOperation cancellable callback = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    let flags' = gflagsToWord flags
    maybeMountOperation <- case mountOperation of
        Nothing -> return nullPtr
        Just jMountOperation -> do
            jMountOperation' <- unsafeManagedPtrCastPtr jMountOperation
            return jMountOperation'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    g_drive_start drive' flags' maybeMountOperation maybeCancellable maybeCallback userData
    touchManagedPtr drive
    whenJust mountOperation touchManagedPtr
    whenJust cancellable touchManagedPtr
    return ()

data DriveStartMethodInfo
instance (signature ~ ([Gio.Flags.DriveStartFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsDrive a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo DriveStartMethodInfo a signature where
    overloadedMethod _ = driveStart

-- method Drive::start_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_drive_start_finish" g_drive_start_finish :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Finishes starting a drive.

@since 2.22
-}
driveStartFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
driveStartFinish drive result_ = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ g_drive_start_finish drive' result_'
        touchManagedPtr drive
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

data DriveStartFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DriveStartFinishMethodInfo a signature where
    overloadedMethod _ = driveStartFinish

-- method Drive::stop
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags affecting the unmount if required for stopping.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mount_operation", argType = TInterface (Name {namespace = "Gio", name = "MountOperation"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GMountOperation or %NULL to avoid\n    user interaction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data to pass to @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_drive_stop" g_drive_stop :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"})
    Ptr Gio.MountOperation.MountOperation -> -- mount_operation : TInterface (Name {namespace = "Gio", name = "MountOperation"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Asynchronously stops a drive.

When the operation is finished, /@callback@/ will be called.
You can then call 'GI.Gio.Interfaces.Drive.driveStopFinish' to obtain the
result of the operation.

@since 2.22
-}
driveStop ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> [Gio.Flags.MountUnmountFlags]
    {- ^ /@flags@/: flags affecting the unmount if required for stopping. -}
    -> Maybe (b)
    {- ^ /@mountOperation@/: a 'GI.Gio.Objects.MountOperation.MountOperation' or 'Nothing' to avoid
    user interaction. -}
    -> Maybe (c)
    {- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
    -> m ()
driveStop drive flags mountOperation cancellable callback = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    let flags' = gflagsToWord flags
    maybeMountOperation <- case mountOperation of
        Nothing -> return nullPtr
        Just jMountOperation -> do
            jMountOperation' <- unsafeManagedPtrCastPtr jMountOperation
            return jMountOperation'
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let userData = nullPtr
    g_drive_stop drive' flags' maybeMountOperation maybeCancellable maybeCallback userData
    touchManagedPtr drive
    whenJust mountOperation touchManagedPtr
    whenJust cancellable touchManagedPtr
    return ()

data DriveStopMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsDrive a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo DriveStopMethodInfo a signature where
    overloadedMethod _ = driveStop

-- method Drive::stop_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drive", argType = TInterface (Name {namespace = "Gio", name = "Drive"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDrive.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_drive_stop_finish" g_drive_stop_finish :: 
    Ptr Drive ->                            -- drive : TInterface (Name {namespace = "Gio", name = "Drive"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Finishes stopping a drive.

@since 2.22
-}
driveStopFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@drive@/: a 'GI.Gio.Interfaces.Drive.Drive'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
driveStopFinish drive result_ = liftIO $ do
    drive' <- unsafeManagedPtrCastPtr drive
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ g_drive_stop_finish drive' result_'
        touchManagedPtr drive
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

data DriveStopFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DriveStopFinishMethodInfo a signature where
    overloadedMethod _ = driveStopFinish