gi-gio-0.2.44.12: GI/Gio/Interfaces/Drive.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}
module GI.Gio.Interfaces.Drive
(
-- * Exported types
Drive(..) ,
noDrive ,
DriveK ,
toDrive ,
-- * Methods
-- ** driveCanEject
driveCanEject ,
-- ** driveCanPollForMedia
driveCanPollForMedia ,
-- ** driveCanStart
driveCanStart ,
-- ** driveCanStartDegraded
driveCanStartDegraded ,
-- ** driveCanStop
driveCanStop ,
-- ** driveEject
driveEject ,
-- ** driveEjectFinish
driveEjectFinish ,
-- ** driveEjectWithOperation
driveEjectWithOperation ,
-- ** driveEjectWithOperationFinish
driveEjectWithOperationFinish ,
-- ** driveEnumerateIdentifiers
driveEnumerateIdentifiers ,
-- ** driveGetIcon
driveGetIcon ,
-- ** driveGetIdentifier
driveGetIdentifier ,
-- ** driveGetName
driveGetName ,
-- ** driveGetSortKey
driveGetSortKey ,
-- ** driveGetStartStopType
driveGetStartStopType ,
-- ** driveGetSymbolicIcon
driveGetSymbolicIcon ,
-- ** driveGetVolumes
driveGetVolumes ,
-- ** driveHasMedia
driveHasMedia ,
-- ** driveHasVolumes
driveHasVolumes ,
-- ** driveIsMediaCheckAutomatic
driveIsMediaCheckAutomatic ,
-- ** driveIsMediaRemovable
driveIsMediaRemovable ,
-- ** drivePollForMedia
drivePollForMedia ,
-- ** drivePollForMediaFinish
drivePollForMediaFinish ,
-- ** driveStart
driveStart ,
-- ** driveStartFinish
driveStartFinish ,
-- ** driveStop
driveStop ,
-- ** driveStopFinish
driveStopFinish ,
-- * Signals
-- ** Changed
DriveChangedCallback ,
DriveChangedCallbackC ,
DriveChangedSignalInfo ,
afterDriveChanged ,
driveChangedCallbackWrapper ,
driveChangedClosure ,
mkDriveChangedCallback ,
noDriveChangedCallback ,
onDriveChanged ,
-- ** Disconnected
DriveDisconnectedCallback ,
DriveDisconnectedCallbackC ,
DriveDisconnectedSignalInfo ,
afterDriveDisconnected ,
driveDisconnectedCallbackWrapper ,
driveDisconnectedClosure ,
mkDriveDisconnectedCallback ,
noDriveDisconnectedCallback ,
onDriveDisconnected ,
-- ** EjectButton
DriveEjectButtonCallback ,
DriveEjectButtonCallbackC ,
DriveEjectButtonSignalInfo ,
afterDriveEjectButton ,
driveEjectButtonCallbackWrapper ,
driveEjectButtonClosure ,
mkDriveEjectButtonCallback ,
noDriveEjectButtonCallback ,
onDriveEjectButton ,
-- ** StopButton
DriveStopButtonCallback ,
DriveStopButtonCallbackC ,
DriveStopButtonSignalInfo ,
afterDriveStopButton ,
driveStopButtonCallbackWrapper ,
driveStopButtonClosure ,
mkDriveStopButtonCallback ,
noDriveStopButtonCallback ,
onDriveStopButton ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject
-- interface Drive
newtype Drive = Drive (ForeignPtr Drive)
noDrive :: Maybe Drive
noDrive = Nothing
-- signal Drive::changed
type DriveChangedCallback =
IO ()
noDriveChangedCallback :: Maybe DriveChangedCallback
noDriveChangedCallback = Nothing
type DriveChangedCallbackC =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
foreign import ccall "wrapper"
mkDriveChangedCallback :: DriveChangedCallbackC -> IO (FunPtr DriveChangedCallbackC)
driveChangedClosure :: DriveChangedCallback -> IO Closure
driveChangedClosure cb = newCClosure =<< mkDriveChangedCallback wrapped
where wrapped = driveChangedCallbackWrapper cb
driveChangedCallbackWrapper ::
DriveChangedCallback ->
Ptr () ->
Ptr () ->
IO ()
driveChangedCallbackWrapper _cb _ _ = do
_cb
onDriveChanged :: (GObject a, MonadIO m) => a -> DriveChangedCallback -> m SignalHandlerId
onDriveChanged obj cb = liftIO $ connectDriveChanged obj cb SignalConnectBefore
afterDriveChanged :: (GObject a, MonadIO m) => a -> DriveChangedCallback -> m SignalHandlerId
afterDriveChanged obj cb = connectDriveChanged obj cb SignalConnectAfter
connectDriveChanged :: (GObject a, MonadIO m) =>
a -> DriveChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectDriveChanged obj cb after = liftIO $ do
cb' <- mkDriveChangedCallback (driveChangedCallbackWrapper cb)
connectSignalFunPtr obj "changed" cb' after
-- signal Drive::disconnected
type DriveDisconnectedCallback =
IO ()
noDriveDisconnectedCallback :: Maybe DriveDisconnectedCallback
noDriveDisconnectedCallback = Nothing
type DriveDisconnectedCallbackC =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
foreign import ccall "wrapper"
mkDriveDisconnectedCallback :: DriveDisconnectedCallbackC -> IO (FunPtr DriveDisconnectedCallbackC)
driveDisconnectedClosure :: DriveDisconnectedCallback -> IO Closure
driveDisconnectedClosure cb = newCClosure =<< mkDriveDisconnectedCallback wrapped
where wrapped = driveDisconnectedCallbackWrapper cb
driveDisconnectedCallbackWrapper ::
DriveDisconnectedCallback ->
Ptr () ->
Ptr () ->
IO ()
driveDisconnectedCallbackWrapper _cb _ _ = do
_cb
onDriveDisconnected :: (GObject a, MonadIO m) => a -> DriveDisconnectedCallback -> m SignalHandlerId
onDriveDisconnected obj cb = liftIO $ connectDriveDisconnected obj cb SignalConnectBefore
afterDriveDisconnected :: (GObject a, MonadIO m) => a -> DriveDisconnectedCallback -> m SignalHandlerId
afterDriveDisconnected obj cb = connectDriveDisconnected obj cb SignalConnectAfter
connectDriveDisconnected :: (GObject a, MonadIO m) =>
a -> DriveDisconnectedCallback -> SignalConnectMode -> m SignalHandlerId
connectDriveDisconnected obj cb after = liftIO $ do
cb' <- mkDriveDisconnectedCallback (driveDisconnectedCallbackWrapper cb)
connectSignalFunPtr obj "disconnected" cb' after
-- signal Drive::eject-button
type DriveEjectButtonCallback =
IO ()
noDriveEjectButtonCallback :: Maybe DriveEjectButtonCallback
noDriveEjectButtonCallback = Nothing
type DriveEjectButtonCallbackC =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
foreign import ccall "wrapper"
mkDriveEjectButtonCallback :: DriveEjectButtonCallbackC -> IO (FunPtr DriveEjectButtonCallbackC)
driveEjectButtonClosure :: DriveEjectButtonCallback -> IO Closure
driveEjectButtonClosure cb = newCClosure =<< mkDriveEjectButtonCallback wrapped
where wrapped = driveEjectButtonCallbackWrapper cb
driveEjectButtonCallbackWrapper ::
DriveEjectButtonCallback ->
Ptr () ->
Ptr () ->
IO ()
driveEjectButtonCallbackWrapper _cb _ _ = do
_cb
onDriveEjectButton :: (GObject a, MonadIO m) => a -> DriveEjectButtonCallback -> m SignalHandlerId
onDriveEjectButton obj cb = liftIO $ connectDriveEjectButton obj cb SignalConnectBefore
afterDriveEjectButton :: (GObject a, MonadIO m) => a -> DriveEjectButtonCallback -> m SignalHandlerId
afterDriveEjectButton obj cb = connectDriveEjectButton obj cb SignalConnectAfter
connectDriveEjectButton :: (GObject a, MonadIO m) =>
a -> DriveEjectButtonCallback -> SignalConnectMode -> m SignalHandlerId
connectDriveEjectButton obj cb after = liftIO $ do
cb' <- mkDriveEjectButtonCallback (driveEjectButtonCallbackWrapper cb)
connectSignalFunPtr obj "eject-button" cb' after
-- signal Drive::stop-button
type DriveStopButtonCallback =
IO ()
noDriveStopButtonCallback :: Maybe DriveStopButtonCallback
noDriveStopButtonCallback = Nothing
type DriveStopButtonCallbackC =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
foreign import ccall "wrapper"
mkDriveStopButtonCallback :: DriveStopButtonCallbackC -> IO (FunPtr DriveStopButtonCallbackC)
driveStopButtonClosure :: DriveStopButtonCallback -> IO Closure
driveStopButtonClosure cb = newCClosure =<< mkDriveStopButtonCallback wrapped
where wrapped = driveStopButtonCallbackWrapper cb
driveStopButtonCallbackWrapper ::
DriveStopButtonCallback ->
Ptr () ->
Ptr () ->
IO ()
driveStopButtonCallbackWrapper _cb _ _ = do
_cb
onDriveStopButton :: (GObject a, MonadIO m) => a -> DriveStopButtonCallback -> m SignalHandlerId
onDriveStopButton obj cb = liftIO $ connectDriveStopButton obj cb SignalConnectBefore
afterDriveStopButton :: (GObject a, MonadIO m) => a -> DriveStopButtonCallback -> m SignalHandlerId
afterDriveStopButton obj cb = connectDriveStopButton obj cb SignalConnectAfter
connectDriveStopButton :: (GObject a, MonadIO m) =>
a -> DriveStopButtonCallback -> SignalConnectMode -> m SignalHandlerId
connectDriveStopButton obj cb after = liftIO $ do
cb' <- mkDriveStopButtonCallback (driveStopButtonCallbackWrapper cb)
connectSignalFunPtr obj "stop-button" cb' after
type instance AttributeList Drive = DriveAttributeList
type DriveAttributeList = ('[ ] :: [(Symbol, *)])
data DriveChangedSignalInfo
instance SignalInfo DriveChangedSignalInfo where
type HaskellCallbackType DriveChangedSignalInfo = DriveChangedCallback
connectSignal _ = connectDriveChanged
data DriveDisconnectedSignalInfo
instance SignalInfo DriveDisconnectedSignalInfo where
type HaskellCallbackType DriveDisconnectedSignalInfo = DriveDisconnectedCallback
connectSignal _ = connectDriveDisconnected
data DriveEjectButtonSignalInfo
instance SignalInfo DriveEjectButtonSignalInfo where
type HaskellCallbackType DriveEjectButtonSignalInfo = DriveEjectButtonCallback
connectSignal _ = connectDriveEjectButton
data DriveStopButtonSignalInfo
instance SignalInfo DriveStopButtonSignalInfo where
type HaskellCallbackType DriveStopButtonSignalInfo = DriveStopButtonCallback
connectSignal _ = connectDriveStopButton
type instance SignalList Drive = DriveSignalList
type DriveSignalList = ('[ '("changed", DriveChangedSignalInfo), '("disconnected", DriveDisconnectedSignalInfo), '("eject-button", DriveEjectButtonSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("stop-button", DriveStopButtonSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "g_drive_get_type"
c_g_drive_get_type :: IO GType
type instance ParentTypes Drive = DriveParentTypes
type DriveParentTypes = '[GObject.Object]
instance GObject Drive where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_drive_get_type
class GObject o => DriveK o
instance (GObject o, IsDescendantOf Drive o) => DriveK o
toDrive :: DriveK o => o -> IO Drive
toDrive = unsafeCastTo Drive
-- method Drive::can_eject
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_can_eject" g_drive_can_eject ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CInt
driveCanEject ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Bool
driveCanEject _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_can_eject _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Drive::can_poll_for_media
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_can_poll_for_media" g_drive_can_poll_for_media ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CInt
driveCanPollForMedia ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Bool
driveCanPollForMedia _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_can_poll_for_media _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Drive::can_start
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_can_start" g_drive_can_start ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CInt
driveCanStart ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Bool
driveCanStart _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_can_start _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Drive::can_start_degraded
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_can_start_degraded" g_drive_can_start_degraded ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CInt
driveCanStartDegraded ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Bool
driveCanStartDegraded _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_can_start_degraded _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Drive::can_stop
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_can_stop" g_drive_can_stop ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CInt
driveCanStop ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Bool
driveCanStop _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_can_stop _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Drive::eject
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "MountUnmountFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "MountUnmountFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_eject" g_drive_eject ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
CUInt -> -- flags : TInterface "Gio" "MountUnmountFlags"
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback"
Ptr () -> -- user_data : TBasicType TVoid
IO ()
{-# DEPRECATED driveEject ["(Since version 2.22)","Use g_drive_eject_with_operation() instead."]#-}
driveEject ::
(MonadIO m, DriveK a, CancellableK b) =>
a -> -- _obj
[MountUnmountFlags] -> -- flags
Maybe (b) -> -- cancellable
Maybe (AsyncReadyCallback) -> -- callback
m ()
driveEject _obj flags cancellable callback = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let flags' = gflagsToWord flags
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
poke ptrcallback jCallback'
return jCallback'
let user_data = nullPtr
g_drive_eject _obj' flags' maybeCancellable maybeCallback user_data
touchManagedPtr _obj
whenJust cancellable touchManagedPtr
return ()
-- method Drive::eject_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False
foreign import ccall "g_drive_eject_finish" g_drive_eject_finish ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult"
Ptr (Ptr GError) -> -- error
IO CInt
{-# DEPRECATED driveEjectFinish ["(Since version 2.22)","Use g_drive_eject_with_operation_finish() instead."]#-}
driveEjectFinish ::
(MonadIO m, DriveK a, AsyncResultK b) =>
a -> -- _obj
b -> -- result
m ()
driveEjectFinish _obj result_ = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let result_' = unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_drive_eject_finish _obj' result_'
touchManagedPtr _obj
touchManagedPtr result_
return ()
) (do
return ()
)
-- method Drive::eject_with_operation
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "MountUnmountFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mount_operation", argType = TInterface "Gio" "MountOperation", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "MountUnmountFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mount_operation", argType = TInterface "Gio" "MountOperation", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_eject_with_operation" g_drive_eject_with_operation ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
CUInt -> -- flags : TInterface "Gio" "MountUnmountFlags"
Ptr MountOperation -> -- mount_operation : TInterface "Gio" "MountOperation"
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback"
Ptr () -> -- user_data : TBasicType TVoid
IO ()
driveEjectWithOperation ::
(MonadIO m, DriveK a, MountOperationK b, CancellableK c) =>
a -> -- _obj
[MountUnmountFlags] -> -- flags
Maybe (b) -> -- mount_operation
Maybe (c) -> -- cancellable
Maybe (AsyncReadyCallback) -> -- callback
m ()
driveEjectWithOperation _obj flags mount_operation cancellable callback = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let flags' = gflagsToWord flags
maybeMount_operation <- case mount_operation of
Nothing -> return nullPtr
Just jMount_operation -> do
let jMount_operation' = unsafeManagedPtrCastPtr jMount_operation
return jMount_operation'
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
poke ptrcallback jCallback'
return jCallback'
let user_data = nullPtr
g_drive_eject_with_operation _obj' flags' maybeMount_operation maybeCancellable maybeCallback user_data
touchManagedPtr _obj
whenJust mount_operation touchManagedPtr
whenJust cancellable touchManagedPtr
return ()
-- method Drive::eject_with_operation_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False
foreign import ccall "g_drive_eject_with_operation_finish" g_drive_eject_with_operation_finish ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult"
Ptr (Ptr GError) -> -- error
IO CInt
driveEjectWithOperationFinish ::
(MonadIO m, DriveK a, AsyncResultK b) =>
a -> -- _obj
b -> -- result
m ()
driveEjectWithOperationFinish _obj result_ = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let result_' = unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_drive_eject_with_operation_finish _obj' result_'
touchManagedPtr _obj
touchManagedPtr result_
return ()
) (do
return ()
)
-- method Drive::enumerate_identifiers
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray True (-1) (-1) (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_enumerate_identifiers" g_drive_enumerate_identifiers ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO (Ptr CString)
driveEnumerateIdentifiers ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m [T.Text]
driveEnumerateIdentifiers _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_enumerate_identifiers _obj'
checkUnexpectedReturnNULL "g_drive_enumerate_identifiers" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr _obj
return result'
-- method Drive::get_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "Icon"
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_get_icon" g_drive_get_icon ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO (Ptr Icon)
driveGetIcon ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Icon
driveGetIcon _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_get_icon _obj'
checkUnexpectedReturnNULL "g_drive_get_icon" result
result' <- (wrapObject Icon) result
touchManagedPtr _obj
return result'
-- method Drive::get_identifier
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "kind", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "kind", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_get_identifier" g_drive_get_identifier ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
CString -> -- kind : TBasicType TUTF8
IO CString
driveGetIdentifier ::
(MonadIO m, DriveK a) =>
a -> -- _obj
T.Text -> -- kind
m T.Text
driveGetIdentifier _obj kind = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
kind' <- textToCString kind
result <- g_drive_get_identifier _obj' kind'
checkUnexpectedReturnNULL "g_drive_get_identifier" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
freeMem kind'
return result'
-- method Drive::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_get_name" g_drive_get_name ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CString
driveGetName ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m T.Text
driveGetName _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_get_name _obj'
checkUnexpectedReturnNULL "g_drive_get_name" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
return result'
-- method Drive::get_sort_key
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_get_sort_key" g_drive_get_sort_key ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CString
driveGetSortKey ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m T.Text
driveGetSortKey _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_get_sort_key _obj'
checkUnexpectedReturnNULL "g_drive_get_sort_key" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
-- method Drive::get_start_stop_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "DriveStartStopType"
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_get_start_stop_type" g_drive_get_start_stop_type ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CUInt
driveGetStartStopType ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m DriveStartStopType
driveGetStartStopType _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_get_start_stop_type _obj'
let result' = (toEnum . fromIntegral) result
touchManagedPtr _obj
return result'
-- method Drive::get_symbolic_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "Icon"
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_get_symbolic_icon" g_drive_get_symbolic_icon ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO (Ptr Icon)
driveGetSymbolicIcon ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Icon
driveGetSymbolicIcon _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_get_symbolic_icon _obj'
checkUnexpectedReturnNULL "g_drive_get_symbolic_icon" result
result' <- (wrapObject Icon) result
touchManagedPtr _obj
return result'
-- method Drive::get_volumes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Gio" "Volume")
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_get_volumes" g_drive_get_volumes ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO (Ptr (GList (Ptr Volume)))
driveGetVolumes ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m [Volume]
driveGetVolumes _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_get_volumes _obj'
checkUnexpectedReturnNULL "g_drive_get_volumes" result
result' <- unpackGList result
result'' <- mapM (wrapObject Volume) result'
g_list_free result
touchManagedPtr _obj
return result''
-- method Drive::has_media
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_has_media" g_drive_has_media ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CInt
driveHasMedia ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Bool
driveHasMedia _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_has_media _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Drive::has_volumes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_has_volumes" g_drive_has_volumes ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CInt
driveHasVolumes ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Bool
driveHasVolumes _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_has_volumes _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Drive::is_media_check_automatic
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_is_media_check_automatic" g_drive_is_media_check_automatic ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CInt
driveIsMediaCheckAutomatic ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Bool
driveIsMediaCheckAutomatic _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_is_media_check_automatic _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Drive::is_media_removable
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_is_media_removable" g_drive_is_media_removable ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
IO CInt
driveIsMediaRemovable ::
(MonadIO m, DriveK a) =>
a -> -- _obj
m Bool
driveIsMediaRemovable _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_drive_is_media_removable _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Drive::poll_for_media
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_poll_for_media" g_drive_poll_for_media ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback"
Ptr () -> -- user_data : TBasicType TVoid
IO ()
drivePollForMedia ::
(MonadIO m, DriveK a, CancellableK b) =>
a -> -- _obj
Maybe (b) -> -- cancellable
Maybe (AsyncReadyCallback) -> -- callback
m ()
drivePollForMedia _obj cancellable callback = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
poke ptrcallback jCallback'
return jCallback'
let user_data = nullPtr
g_drive_poll_for_media _obj' maybeCancellable maybeCallback user_data
touchManagedPtr _obj
whenJust cancellable touchManagedPtr
return ()
-- method Drive::poll_for_media_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False
foreign import ccall "g_drive_poll_for_media_finish" g_drive_poll_for_media_finish ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult"
Ptr (Ptr GError) -> -- error
IO CInt
drivePollForMediaFinish ::
(MonadIO m, DriveK a, AsyncResultK b) =>
a -> -- _obj
b -> -- result
m ()
drivePollForMediaFinish _obj result_ = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let result_' = unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_drive_poll_for_media_finish _obj' result_'
touchManagedPtr _obj
touchManagedPtr result_
return ()
) (do
return ()
)
-- method Drive::start
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DriveStartFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mount_operation", argType = TInterface "Gio" "MountOperation", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "DriveStartFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mount_operation", argType = TInterface "Gio" "MountOperation", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_start" g_drive_start ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
CUInt -> -- flags : TInterface "Gio" "DriveStartFlags"
Ptr MountOperation -> -- mount_operation : TInterface "Gio" "MountOperation"
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback"
Ptr () -> -- user_data : TBasicType TVoid
IO ()
driveStart ::
(MonadIO m, DriveK a, MountOperationK b, CancellableK c) =>
a -> -- _obj
[DriveStartFlags] -> -- flags
Maybe (b) -> -- mount_operation
Maybe (c) -> -- cancellable
Maybe (AsyncReadyCallback) -> -- callback
m ()
driveStart _obj flags mount_operation cancellable callback = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let flags' = gflagsToWord flags
maybeMount_operation <- case mount_operation of
Nothing -> return nullPtr
Just jMount_operation -> do
let jMount_operation' = unsafeManagedPtrCastPtr jMount_operation
return jMount_operation'
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
poke ptrcallback jCallback'
return jCallback'
let user_data = nullPtr
g_drive_start _obj' flags' maybeMount_operation maybeCancellable maybeCallback user_data
touchManagedPtr _obj
whenJust mount_operation touchManagedPtr
whenJust cancellable touchManagedPtr
return ()
-- method Drive::start_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False
foreign import ccall "g_drive_start_finish" g_drive_start_finish ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult"
Ptr (Ptr GError) -> -- error
IO CInt
driveStartFinish ::
(MonadIO m, DriveK a, AsyncResultK b) =>
a -> -- _obj
b -> -- result
m ()
driveStartFinish _obj result_ = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let result_' = unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_drive_start_finish _obj' result_'
touchManagedPtr _obj
touchManagedPtr result_
return ()
) (do
return ()
)
-- method Drive::stop
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "MountUnmountFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mount_operation", argType = TInterface "Gio" "MountOperation", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "MountUnmountFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mount_operation", argType = TInterface "Gio" "MountOperation", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_drive_stop" g_drive_stop ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
CUInt -> -- flags : TInterface "Gio" "MountUnmountFlags"
Ptr MountOperation -> -- mount_operation : TInterface "Gio" "MountOperation"
Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable"
FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback"
Ptr () -> -- user_data : TBasicType TVoid
IO ()
driveStop ::
(MonadIO m, DriveK a, MountOperationK b, CancellableK c) =>
a -> -- _obj
[MountUnmountFlags] -> -- flags
Maybe (b) -> -- mount_operation
Maybe (c) -> -- cancellable
Maybe (AsyncReadyCallback) -> -- callback
m ()
driveStop _obj flags mount_operation cancellable callback = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let flags' = gflagsToWord flags
maybeMount_operation <- case mount_operation of
Nothing -> return nullPtr
Just jMount_operation -> do
let jMount_operation' = unsafeManagedPtrCastPtr jMount_operation
return jMount_operation'
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
let jCancellable' = unsafeManagedPtrCastPtr jCancellable
return jCancellable'
ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC))
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback)
poke ptrcallback jCallback'
return jCallback'
let user_data = nullPtr
g_drive_stop _obj' flags' maybeMount_operation maybeCancellable maybeCallback user_data
touchManagedPtr _obj
whenJust mount_operation touchManagedPtr
whenJust cancellable touchManagedPtr
return ()
-- method Drive::stop_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Drive", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False
foreign import ccall "g_drive_stop_finish" g_drive_stop_finish ::
Ptr Drive -> -- _obj : TInterface "Gio" "Drive"
Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult"
Ptr (Ptr GError) -> -- error
IO CInt
driveStopFinish ::
(MonadIO m, DriveK a, AsyncResultK b) =>
a -> -- _obj
b -> -- result
m ()
driveStopFinish _obj result_ = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let result_' = unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_drive_stop_finish _obj' result_'
touchManagedPtr _obj
touchManagedPtr result_
return ()
) (do
return ()
)