{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Interfaces.Drive
(
Drive(..) ,
IsDrive ,
toDrive ,
#if defined(ENABLE_OVERLOADING)
ResolveDriveMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
DriveCanEjectMethodInfo ,
#endif
driveCanEject ,
#if defined(ENABLE_OVERLOADING)
DriveCanPollForMediaMethodInfo ,
#endif
driveCanPollForMedia ,
#if defined(ENABLE_OVERLOADING)
DriveCanStartMethodInfo ,
#endif
driveCanStart ,
#if defined(ENABLE_OVERLOADING)
DriveCanStartDegradedMethodInfo ,
#endif
driveCanStartDegraded ,
#if defined(ENABLE_OVERLOADING)
DriveCanStopMethodInfo ,
#endif
driveCanStop ,
#if defined(ENABLE_OVERLOADING)
DriveEjectMethodInfo ,
#endif
driveEject ,
#if defined(ENABLE_OVERLOADING)
DriveEjectFinishMethodInfo ,
#endif
driveEjectFinish ,
#if defined(ENABLE_OVERLOADING)
DriveEjectWithOperationMethodInfo ,
#endif
driveEjectWithOperation ,
#if defined(ENABLE_OVERLOADING)
DriveEjectWithOperationFinishMethodInfo ,
#endif
driveEjectWithOperationFinish ,
#if defined(ENABLE_OVERLOADING)
DriveEnumerateIdentifiersMethodInfo ,
#endif
driveEnumerateIdentifiers ,
#if defined(ENABLE_OVERLOADING)
DriveGetIconMethodInfo ,
#endif
driveGetIcon ,
#if defined(ENABLE_OVERLOADING)
DriveGetIdentifierMethodInfo ,
#endif
driveGetIdentifier ,
#if defined(ENABLE_OVERLOADING)
DriveGetNameMethodInfo ,
#endif
driveGetName ,
#if defined(ENABLE_OVERLOADING)
DriveGetSortKeyMethodInfo ,
#endif
driveGetSortKey ,
#if defined(ENABLE_OVERLOADING)
DriveGetStartStopTypeMethodInfo ,
#endif
driveGetStartStopType ,
#if defined(ENABLE_OVERLOADING)
DriveGetSymbolicIconMethodInfo ,
#endif
driveGetSymbolicIcon ,
#if defined(ENABLE_OVERLOADING)
DriveGetVolumesMethodInfo ,
#endif
driveGetVolumes ,
#if defined(ENABLE_OVERLOADING)
DriveHasMediaMethodInfo ,
#endif
driveHasMedia ,
#if defined(ENABLE_OVERLOADING)
DriveHasVolumesMethodInfo ,
#endif
driveHasVolumes ,
#if defined(ENABLE_OVERLOADING)
DriveIsMediaCheckAutomaticMethodInfo ,
#endif
driveIsMediaCheckAutomatic ,
#if defined(ENABLE_OVERLOADING)
DriveIsMediaRemovableMethodInfo ,
#endif
driveIsMediaRemovable ,
#if defined(ENABLE_OVERLOADING)
DriveIsRemovableMethodInfo ,
#endif
driveIsRemovable ,
#if defined(ENABLE_OVERLOADING)
DrivePollForMediaMethodInfo ,
#endif
drivePollForMedia ,
#if defined(ENABLE_OVERLOADING)
DrivePollForMediaFinishMethodInfo ,
#endif
drivePollForMediaFinish ,
#if defined(ENABLE_OVERLOADING)
DriveStartMethodInfo ,
#endif
driveStart ,
#if defined(ENABLE_OVERLOADING)
DriveStartFinishMethodInfo ,
#endif
driveStartFinish ,
#if defined(ENABLE_OVERLOADING)
DriveStopMethodInfo ,
#endif
driveStop ,
#if defined(ENABLE_OVERLOADING)
DriveStopFinishMethodInfo ,
#endif
driveStopFinish ,
C_DriveChangedCallback ,
DriveChangedCallback ,
#if defined(ENABLE_OVERLOADING)
DriveChangedSignalInfo ,
#endif
afterDriveChanged ,
genClosure_DriveChanged ,
mk_DriveChangedCallback ,
noDriveChangedCallback ,
onDriveChanged ,
wrap_DriveChangedCallback ,
C_DriveDisconnectedCallback ,
DriveDisconnectedCallback ,
#if defined(ENABLE_OVERLOADING)
DriveDisconnectedSignalInfo ,
#endif
afterDriveDisconnected ,
genClosure_DriveDisconnected ,
mk_DriveDisconnectedCallback ,
noDriveDisconnectedCallback ,
onDriveDisconnected ,
wrap_DriveDisconnectedCallback ,
C_DriveEjectButtonCallback ,
DriveEjectButtonCallback ,
#if defined(ENABLE_OVERLOADING)
DriveEjectButtonSignalInfo ,
#endif
afterDriveEjectButton ,
genClosure_DriveEjectButton ,
mk_DriveEjectButtonCallback ,
noDriveEjectButtonCallback ,
onDriveEjectButton ,
wrap_DriveEjectButtonCallback ,
C_DriveStopButtonCallback ,
DriveStopButtonCallback ,
#if defined(ENABLE_OVERLOADING)
DriveStopButtonSignalInfo ,
#endif
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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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 GHC.OverloadedLabels as OL
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
newtype Drive = Drive (SP.ManagedPtr Drive)
deriving (Drive -> Drive -> Bool
(Drive -> Drive -> Bool) -> (Drive -> Drive -> Bool) -> Eq Drive
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Drive -> Drive -> Bool
$c/= :: Drive -> Drive -> Bool
== :: Drive -> Drive -> Bool
$c== :: Drive -> Drive -> Bool
Eq)
instance SP.ManagedPtrNewtype Drive where
toManagedPtr :: Drive -> ManagedPtr Drive
toManagedPtr (Drive ManagedPtr Drive
p) = ManagedPtr Drive
p
foreign import ccall "g_drive_get_type"
c_g_drive_get_type :: IO B.Types.GType
instance B.Types.TypedObject Drive where
glibType :: IO GType
glibType = IO GType
c_g_drive_get_type
instance B.Types.GObject Drive
instance B.GValue.IsGValue Drive where
toGValue :: Drive -> IO GValue
toGValue Drive
o = do
GType
gtype <- IO GType
c_g_drive_get_type
Drive -> (Ptr Drive -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Drive
o (GType -> (GValue -> Ptr Drive -> IO ()) -> Ptr Drive -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Drive -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO Drive
fromGValue GValue
gv = do
Ptr Drive
ptr <- GValue -> IO (Ptr Drive)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Drive)
(ManagedPtr Drive -> Drive) -> Ptr Drive -> IO Drive
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Drive -> Drive
Drive Ptr Drive
ptr
class (SP.GObject o, O.IsDescendantOf Drive o) => IsDrive o
instance (SP.GObject o, O.IsDescendantOf Drive o) => IsDrive o
instance O.HasParentTypes Drive
type instance O.ParentTypes Drive = '[GObject.Object.Object]
toDrive :: (MonadIO m, IsDrive o) => o -> m Drive
toDrive :: o -> m Drive
toDrive = IO Drive -> m Drive
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Drive -> m Drive) -> (o -> IO Drive) -> o -> m Drive
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Drive -> Drive) -> o -> IO Drive
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Drive -> Drive
Drive
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Drive
type instance O.AttributeList Drive = DriveAttributeList
type DriveAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
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 "getv" o = GObject.Object.ObjectGetvMethodInfo
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 "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 "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveDriveMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDriveMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDriveMethod t Drive, O.MethodInfo info Drive p) => OL.IsLabel t (Drive -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
foreign import ccall "g_drive_can_eject" g_drive_can_eject ::
Ptr Drive ->
IO CInt
driveCanEject ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveCanEject :: a -> m Bool
driveCanEject a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_can_eject Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveCanEjectMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanEjectMethodInfo a signature where
overloadedMethod = driveCanEject
#endif
foreign import ccall "g_drive_can_poll_for_media" g_drive_can_poll_for_media ::
Ptr Drive ->
IO CInt
driveCanPollForMedia ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveCanPollForMedia :: a -> m Bool
driveCanPollForMedia a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_can_poll_for_media Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveCanPollForMediaMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanPollForMediaMethodInfo a signature where
overloadedMethod = driveCanPollForMedia
#endif
foreign import ccall "g_drive_can_start" g_drive_can_start ::
Ptr Drive ->
IO CInt
driveCanStart ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveCanStart :: a -> m Bool
driveCanStart a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_can_start Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveCanStartMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanStartMethodInfo a signature where
overloadedMethod = driveCanStart
#endif
foreign import ccall "g_drive_can_start_degraded" g_drive_can_start_degraded ::
Ptr Drive ->
IO CInt
driveCanStartDegraded ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveCanStartDegraded :: a -> m Bool
driveCanStartDegraded a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_can_start_degraded Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveCanStartDegradedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanStartDegradedMethodInfo a signature where
overloadedMethod = driveCanStartDegraded
#endif
foreign import ccall "g_drive_can_stop" g_drive_can_stop ::
Ptr Drive ->
IO CInt
driveCanStop ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveCanStop :: a -> m Bool
driveCanStop a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_can_stop Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveCanStopMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveCanStopMethodInfo a signature where
overloadedMethod = driveCanStop
#endif
foreign import ccall "g_drive_eject" g_drive_eject ::
Ptr Drive ->
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
{-# DEPRECATED driveEject ["(Since version 2.22)","Use 'GI.Gio.Interfaces.Drive.driveEjectWithOperation' instead."] #-}
driveEject ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.Cancellable.IsCancellable b) =>
a
-> [Gio.Flags.MountUnmountFlags]
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
driveEject :: a
-> [MountUnmountFlags]
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
driveEject a
drive [MountUnmountFlags]
flags Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
let flags' :: CUInt
flags' = [MountUnmountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountUnmountFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr Drive
-> CUInt
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_drive_eject Ptr Drive
drive' CUInt
flags' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
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
#endif
foreign import ccall "g_drive_eject_finish" g_drive_eject_finish ::
Ptr Drive ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
{-# DEPRECATED driveEjectFinish ["(Since version 2.22)","Use 'GI.Gio.Interfaces.Drive.driveEjectWithOperationFinish' instead."] #-}
driveEjectFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
driveEjectFinish :: a -> b -> m ()
driveEjectFinish a
drive b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Drive -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_drive_eject_finish Ptr Drive
drive' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data DriveEjectFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DriveEjectFinishMethodInfo a signature where
overloadedMethod = driveEjectFinish
#endif
foreign import ccall "g_drive_eject_with_operation" g_drive_eject_with_operation ::
Ptr Drive ->
CUInt ->
Ptr Gio.MountOperation.MountOperation ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
driveEjectWithOperation ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
-> [Gio.Flags.MountUnmountFlags]
-> Maybe (b)
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
driveEjectWithOperation :: a
-> [MountUnmountFlags]
-> Maybe b
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
driveEjectWithOperation a
drive [MountUnmountFlags]
flags Maybe b
mountOperation Maybe c
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
let flags' :: CUInt
flags' = [MountUnmountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountUnmountFlags]
flags
Ptr MountOperation
maybeMountOperation <- case Maybe b
mountOperation of
Maybe b
Nothing -> Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
forall a. Ptr a
nullPtr
Just b
jMountOperation -> do
Ptr MountOperation
jMountOperation' <- b -> IO (Ptr MountOperation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jMountOperation
Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
jMountOperation'
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr Drive
-> CUInt
-> Ptr MountOperation
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_drive_eject_with_operation Ptr Drive
drive' CUInt
flags' Ptr MountOperation
maybeMountOperation Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
mountOperation b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
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
#endif
foreign import ccall "g_drive_eject_with_operation_finish" g_drive_eject_with_operation_finish ::
Ptr Drive ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
driveEjectWithOperationFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
driveEjectWithOperationFinish :: a -> b -> m ()
driveEjectWithOperationFinish a
drive b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Drive -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_drive_eject_with_operation_finish Ptr Drive
drive' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data DriveEjectWithOperationFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DriveEjectWithOperationFinishMethodInfo a signature where
overloadedMethod = driveEjectWithOperationFinish
#endif
foreign import ccall "g_drive_enumerate_identifiers" g_drive_enumerate_identifiers ::
Ptr Drive ->
IO (Ptr CString)
driveEnumerateIdentifiers ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m [T.Text]
driveEnumerateIdentifiers :: a -> m [Text]
driveEnumerateIdentifiers a
drive = IO [Text] -> m [Text]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr CString
result <- Ptr Drive -> IO (Ptr CString)
g_drive_enumerate_identifiers Ptr Drive
drive'
Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"driveEnumerateIdentifiers" Ptr CString
result
[Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
(CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
[Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'
#if defined(ENABLE_OVERLOADING)
data DriveEnumerateIdentifiersMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsDrive a) => O.MethodInfo DriveEnumerateIdentifiersMethodInfo a signature where
overloadedMethod = driveEnumerateIdentifiers
#endif
foreign import ccall "g_drive_get_icon" g_drive_get_icon ::
Ptr Drive ->
IO (Ptr Gio.Icon.Icon)
driveGetIcon ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Gio.Icon.Icon
driveGetIcon :: a -> m Icon
driveGetIcon a
drive = IO Icon -> m Icon
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Icon -> m Icon) -> IO Icon -> m Icon
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr Icon
result <- Ptr Drive -> IO (Ptr Icon)
g_drive_get_icon Ptr Drive
drive'
Text -> Ptr Icon -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"driveGetIcon" Ptr Icon
result
Icon
result' <- ((ManagedPtr Icon -> Icon) -> Ptr Icon -> IO Icon
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Icon -> Icon
Gio.Icon.Icon) Ptr Icon
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Icon -> IO Icon
forall (m :: * -> *) a. Monad m => a -> m a
return Icon
result'
#if defined(ENABLE_OVERLOADING)
data DriveGetIconMethodInfo
instance (signature ~ (m Gio.Icon.Icon), MonadIO m, IsDrive a) => O.MethodInfo DriveGetIconMethodInfo a signature where
overloadedMethod = driveGetIcon
#endif
foreign import ccall "g_drive_get_identifier" g_drive_get_identifier ::
Ptr Drive ->
CString ->
IO CString
driveGetIdentifier ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> T.Text
-> m (Maybe T.Text)
driveGetIdentifier :: a -> Text -> m (Maybe Text)
driveGetIdentifier a
drive Text
kind = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CString
kind' <- Text -> IO CString
textToCString Text
kind
CString
result <- Ptr Drive -> CString -> IO CString
g_drive_get_identifier Ptr Drive
drive' CString
kind'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
kind'
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data DriveGetIdentifierMethodInfo
instance (signature ~ (T.Text -> m (Maybe T.Text)), MonadIO m, IsDrive a) => O.MethodInfo DriveGetIdentifierMethodInfo a signature where
overloadedMethod = driveGetIdentifier
#endif
foreign import ccall "g_drive_get_name" g_drive_get_name ::
Ptr Drive ->
IO CString
driveGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m T.Text
driveGetName :: a -> m Text
driveGetName a
drive = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CString
result <- Ptr Drive -> IO CString
g_drive_get_name Ptr Drive
drive'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"driveGetName" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data DriveGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDrive a) => O.MethodInfo DriveGetNameMethodInfo a signature where
overloadedMethod = driveGetName
#endif
foreign import ccall "g_drive_get_sort_key" g_drive_get_sort_key ::
Ptr Drive ->
IO CString
driveGetSortKey ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m (Maybe T.Text)
driveGetSortKey :: a -> m (Maybe Text)
driveGetSortKey a
drive = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CString
result <- Ptr Drive -> IO CString
g_drive_get_sort_key Ptr Drive
drive'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data DriveGetSortKeyMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsDrive a) => O.MethodInfo DriveGetSortKeyMethodInfo a signature where
overloadedMethod = driveGetSortKey
#endif
foreign import ccall "g_drive_get_start_stop_type" g_drive_get_start_stop_type ::
Ptr Drive ->
IO CUInt
driveGetStartStopType ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Gio.Enums.DriveStartStopType
driveGetStartStopType :: a -> m DriveStartStopType
driveGetStartStopType a
drive = IO DriveStartStopType -> m DriveStartStopType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DriveStartStopType -> m DriveStartStopType)
-> IO DriveStartStopType -> m DriveStartStopType
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CUInt
result <- Ptr Drive -> IO CUInt
g_drive_get_start_stop_type Ptr Drive
drive'
let result' :: DriveStartStopType
result' = (Int -> DriveStartStopType
forall a. Enum a => Int -> a
toEnum (Int -> DriveStartStopType)
-> (CUInt -> Int) -> CUInt -> DriveStartStopType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
DriveStartStopType -> IO DriveStartStopType
forall (m :: * -> *) a. Monad m => a -> m a
return DriveStartStopType
result'
#if defined(ENABLE_OVERLOADING)
data DriveGetStartStopTypeMethodInfo
instance (signature ~ (m Gio.Enums.DriveStartStopType), MonadIO m, IsDrive a) => O.MethodInfo DriveGetStartStopTypeMethodInfo a signature where
overloadedMethod = driveGetStartStopType
#endif
foreign import ccall "g_drive_get_symbolic_icon" g_drive_get_symbolic_icon ::
Ptr Drive ->
IO (Ptr Gio.Icon.Icon)
driveGetSymbolicIcon ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Gio.Icon.Icon
driveGetSymbolicIcon :: a -> m Icon
driveGetSymbolicIcon a
drive = IO Icon -> m Icon
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Icon -> m Icon) -> IO Icon -> m Icon
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr Icon
result <- Ptr Drive -> IO (Ptr Icon)
g_drive_get_symbolic_icon Ptr Drive
drive'
Text -> Ptr Icon -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"driveGetSymbolicIcon" Ptr Icon
result
Icon
result' <- ((ManagedPtr Icon -> Icon) -> Ptr Icon -> IO Icon
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Icon -> Icon
Gio.Icon.Icon) Ptr Icon
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Icon -> IO Icon
forall (m :: * -> *) a. Monad m => a -> m a
return Icon
result'
#if defined(ENABLE_OVERLOADING)
data DriveGetSymbolicIconMethodInfo
instance (signature ~ (m Gio.Icon.Icon), MonadIO m, IsDrive a) => O.MethodInfo DriveGetSymbolicIconMethodInfo a signature where
overloadedMethod = driveGetSymbolicIcon
#endif
foreign import ccall "g_drive_get_volumes" g_drive_get_volumes ::
Ptr Drive ->
IO (Ptr (GList (Ptr Gio.Volume.Volume)))
driveGetVolumes ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m [Gio.Volume.Volume]
driveGetVolumes :: a -> m [Volume]
driveGetVolumes a
drive = IO [Volume] -> m [Volume]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Volume] -> m [Volume]) -> IO [Volume] -> m [Volume]
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr (GList (Ptr Volume))
result <- Ptr Drive -> IO (Ptr (GList (Ptr Volume)))
g_drive_get_volumes Ptr Drive
drive'
[Ptr Volume]
result' <- Ptr (GList (Ptr Volume)) -> IO [Ptr Volume]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr Volume))
result
[Volume]
result'' <- (Ptr Volume -> IO Volume) -> [Ptr Volume] -> IO [Volume]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr Volume -> Volume) -> Ptr Volume -> IO Volume
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Volume -> Volume
Gio.Volume.Volume) [Ptr Volume]
result'
Ptr (GList (Ptr Volume)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr Volume))
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
[Volume] -> IO [Volume]
forall (m :: * -> *) a. Monad m => a -> m a
return [Volume]
result''
#if defined(ENABLE_OVERLOADING)
data DriveGetVolumesMethodInfo
instance (signature ~ (m [Gio.Volume.Volume]), MonadIO m, IsDrive a) => O.MethodInfo DriveGetVolumesMethodInfo a signature where
overloadedMethod = driveGetVolumes
#endif
foreign import ccall "g_drive_has_media" g_drive_has_media ::
Ptr Drive ->
IO CInt
driveHasMedia ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveHasMedia :: a -> m Bool
driveHasMedia a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_has_media Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveHasMediaMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveHasMediaMethodInfo a signature where
overloadedMethod = driveHasMedia
#endif
foreign import ccall "g_drive_has_volumes" g_drive_has_volumes ::
Ptr Drive ->
IO CInt
driveHasVolumes ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveHasVolumes :: a -> m Bool
driveHasVolumes a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_has_volumes Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveHasVolumesMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveHasVolumesMethodInfo a signature where
overloadedMethod = driveHasVolumes
#endif
foreign import ccall "g_drive_is_media_check_automatic" g_drive_is_media_check_automatic ::
Ptr Drive ->
IO CInt
driveIsMediaCheckAutomatic ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveIsMediaCheckAutomatic :: a -> m Bool
driveIsMediaCheckAutomatic a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_is_media_check_automatic Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveIsMediaCheckAutomaticMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveIsMediaCheckAutomaticMethodInfo a signature where
overloadedMethod = driveIsMediaCheckAutomatic
#endif
foreign import ccall "g_drive_is_media_removable" g_drive_is_media_removable ::
Ptr Drive ->
IO CInt
driveIsMediaRemovable ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveIsMediaRemovable :: a -> m Bool
driveIsMediaRemovable a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_is_media_removable Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveIsMediaRemovableMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveIsMediaRemovableMethodInfo a signature where
overloadedMethod = driveIsMediaRemovable
#endif
foreign import ccall "g_drive_is_removable" g_drive_is_removable ::
Ptr Drive ->
IO CInt
driveIsRemovable ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a) =>
a
-> m Bool
driveIsRemovable :: a -> m Bool
driveIsRemovable a
drive = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
CInt
result <- Ptr Drive -> IO CInt
g_drive_is_removable Ptr Drive
drive'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data DriveIsRemovableMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrive a) => O.MethodInfo DriveIsRemovableMethodInfo a signature where
overloadedMethod = driveIsRemovable
#endif
foreign import ccall "g_drive_poll_for_media" g_drive_poll_for_media ::
Ptr Drive ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
drivePollForMedia ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
drivePollForMedia :: a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
drivePollForMedia a
drive Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr Drive
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_drive_poll_for_media Ptr Drive
drive' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
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
#endif
foreign import ccall "g_drive_poll_for_media_finish" g_drive_poll_for_media_finish ::
Ptr Drive ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
drivePollForMediaFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
drivePollForMediaFinish :: a -> b -> m ()
drivePollForMediaFinish a
drive b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Drive -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_drive_poll_for_media_finish Ptr Drive
drive' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data DrivePollForMediaFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DrivePollForMediaFinishMethodInfo a signature where
overloadedMethod = drivePollForMediaFinish
#endif
foreign import ccall "g_drive_start" g_drive_start ::
Ptr Drive ->
CUInt ->
Ptr Gio.MountOperation.MountOperation ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
driveStart ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
-> [Gio.Flags.DriveStartFlags]
-> Maybe (b)
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
driveStart :: a
-> [DriveStartFlags]
-> Maybe b
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
driveStart a
drive [DriveStartFlags]
flags Maybe b
mountOperation Maybe c
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
let flags' :: CUInt
flags' = [DriveStartFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [DriveStartFlags]
flags
Ptr MountOperation
maybeMountOperation <- case Maybe b
mountOperation of
Maybe b
Nothing -> Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
forall a. Ptr a
nullPtr
Just b
jMountOperation -> do
Ptr MountOperation
jMountOperation' <- b -> IO (Ptr MountOperation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jMountOperation
Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
jMountOperation'
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr Drive
-> CUInt
-> Ptr MountOperation
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_drive_start Ptr Drive
drive' CUInt
flags' Ptr MountOperation
maybeMountOperation Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
mountOperation b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
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
#endif
foreign import ccall "g_drive_start_finish" g_drive_start_finish ::
Ptr Drive ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
driveStartFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
driveStartFinish :: a -> b -> m ()
driveStartFinish a
drive b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Drive -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_drive_start_finish Ptr Drive
drive' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data DriveStartFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DriveStartFinishMethodInfo a signature where
overloadedMethod = driveStartFinish
#endif
foreign import ccall "g_drive_stop" g_drive_stop ::
Ptr Drive ->
CUInt ->
Ptr Gio.MountOperation.MountOperation ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
driveStop ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
-> [Gio.Flags.MountUnmountFlags]
-> Maybe (b)
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
driveStop :: a
-> [MountUnmountFlags]
-> Maybe b
-> Maybe c
-> Maybe AsyncReadyCallback
-> m ()
driveStop a
drive [MountUnmountFlags]
flags Maybe b
mountOperation Maybe c
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
let flags' :: CUInt
flags' = [MountUnmountFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [MountUnmountFlags]
flags
Ptr MountOperation
maybeMountOperation <- case Maybe b
mountOperation of
Maybe b
Nothing -> Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
forall a. Ptr a
nullPtr
Just b
jMountOperation -> do
Ptr MountOperation
jMountOperation' <- b -> IO (Ptr MountOperation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jMountOperation
Ptr MountOperation -> IO (Ptr MountOperation)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MountOperation
jMountOperation'
Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr Drive
-> CUInt
-> Ptr MountOperation
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_drive_stop Ptr Drive
drive' CUInt
flags' Ptr MountOperation
maybeMountOperation Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
mountOperation b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
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
#endif
foreign import ccall "g_drive_stop_finish" g_drive_stop_finish ::
Ptr Drive ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
driveStopFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
driveStopFinish :: a -> b -> m ()
driveStopFinish a
drive b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Drive
drive' <- a -> IO (Ptr Drive)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
drive
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Drive -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_drive_stop_finish Ptr Drive
drive' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
drive
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data DriveStopFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDrive a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo DriveStopFinishMethodInfo a signature where
overloadedMethod = driveStopFinish
#endif
type DriveChangedCallback =
IO ()
noDriveChangedCallback :: Maybe DriveChangedCallback
noDriveChangedCallback :: Maybe (IO ())
noDriveChangedCallback = Maybe (IO ())
forall a. Maybe a
Nothing
type C_DriveChangedCallback =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_DriveChangedCallback :: C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
genClosure_DriveChanged :: MonadIO m => DriveChangedCallback -> m (GClosure C_DriveChangedCallback)
genClosure_DriveChanged :: IO () -> m (GClosure C_DriveChangedCallback)
genClosure_DriveChanged IO ()
cb = IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback))
-> IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveChangedCallback IO ()
cb
C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveChangedCallback C_DriveChangedCallback
cb' IO (FunPtr C_DriveChangedCallback)
-> (FunPtr C_DriveChangedCallback
-> IO (GClosure C_DriveChangedCallback))
-> IO (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DriveChangedCallback
-> IO (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_DriveChangedCallback ::
DriveChangedCallback ->
C_DriveChangedCallback
wrap_DriveChangedCallback :: IO () -> C_DriveChangedCallback
wrap_DriveChangedCallback IO ()
_cb Ptr ()
_ Ptr ()
_ = do
IO ()
_cb
onDriveChanged :: (IsDrive a, MonadIO m) => a -> DriveChangedCallback -> m SignalHandlerId
onDriveChanged :: a -> IO () -> m SignalHandlerId
onDriveChanged a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveChangedCallback IO ()
cb
FunPtr C_DriveChangedCallback
cb'' <- C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveChangedCallback C_DriveChangedCallback
cb'
a
-> Text
-> FunPtr C_DriveChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"changed" FunPtr C_DriveChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterDriveChanged :: (IsDrive a, MonadIO m) => a -> DriveChangedCallback -> m SignalHandlerId
afterDriveChanged :: a -> IO () -> m SignalHandlerId
afterDriveChanged a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveChangedCallback IO ()
cb
FunPtr C_DriveChangedCallback
cb'' <- C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveChangedCallback C_DriveChangedCallback
cb'
a
-> Text
-> FunPtr C_DriveChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"changed" FunPtr C_DriveChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
data DriveChangedSignalInfo
instance SignalInfo DriveChangedSignalInfo where
type HaskellCallbackType DriveChangedSignalInfo = DriveChangedCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_DriveChangedCallback cb
cb'' <- mk_DriveChangedCallback cb'
connectSignalFunPtr obj "changed" cb'' connectMode detail
#endif
type DriveDisconnectedCallback =
IO ()
noDriveDisconnectedCallback :: Maybe DriveDisconnectedCallback
noDriveDisconnectedCallback :: Maybe (IO ())
noDriveDisconnectedCallback = Maybe (IO ())
forall a. Maybe a
Nothing
type C_DriveDisconnectedCallback =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_DriveDisconnectedCallback :: C_DriveDisconnectedCallback -> IO (FunPtr C_DriveDisconnectedCallback)
genClosure_DriveDisconnected :: MonadIO m => DriveDisconnectedCallback -> m (GClosure C_DriveDisconnectedCallback)
genClosure_DriveDisconnected :: IO () -> m (GClosure C_DriveChangedCallback)
genClosure_DriveDisconnected IO ()
cb = IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback))
-> IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveDisconnectedCallback IO ()
cb
C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveDisconnectedCallback C_DriveChangedCallback
cb' IO (FunPtr C_DriveChangedCallback)
-> (FunPtr C_DriveChangedCallback
-> IO (GClosure C_DriveChangedCallback))
-> IO (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DriveChangedCallback
-> IO (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_DriveDisconnectedCallback ::
DriveDisconnectedCallback ->
C_DriveDisconnectedCallback
wrap_DriveDisconnectedCallback :: IO () -> C_DriveChangedCallback
wrap_DriveDisconnectedCallback IO ()
_cb Ptr ()
_ Ptr ()
_ = do
IO ()
_cb
onDriveDisconnected :: (IsDrive a, MonadIO m) => a -> DriveDisconnectedCallback -> m SignalHandlerId
onDriveDisconnected :: a -> IO () -> m SignalHandlerId
onDriveDisconnected a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveDisconnectedCallback IO ()
cb
FunPtr C_DriveChangedCallback
cb'' <- C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveDisconnectedCallback C_DriveChangedCallback
cb'
a
-> Text
-> FunPtr C_DriveChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"disconnected" FunPtr C_DriveChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterDriveDisconnected :: (IsDrive a, MonadIO m) => a -> DriveDisconnectedCallback -> m SignalHandlerId
afterDriveDisconnected :: a -> IO () -> m SignalHandlerId
afterDriveDisconnected a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveDisconnectedCallback IO ()
cb
FunPtr C_DriveChangedCallback
cb'' <- C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveDisconnectedCallback C_DriveChangedCallback
cb'
a
-> Text
-> FunPtr C_DriveChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"disconnected" FunPtr C_DriveChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
data DriveDisconnectedSignalInfo
instance SignalInfo DriveDisconnectedSignalInfo where
type HaskellCallbackType DriveDisconnectedSignalInfo = DriveDisconnectedCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_DriveDisconnectedCallback cb
cb'' <- mk_DriveDisconnectedCallback cb'
connectSignalFunPtr obj "disconnected" cb'' connectMode detail
#endif
type DriveEjectButtonCallback =
IO ()
noDriveEjectButtonCallback :: Maybe DriveEjectButtonCallback
noDriveEjectButtonCallback :: Maybe (IO ())
noDriveEjectButtonCallback = Maybe (IO ())
forall a. Maybe a
Nothing
type C_DriveEjectButtonCallback =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_DriveEjectButtonCallback :: C_DriveEjectButtonCallback -> IO (FunPtr C_DriveEjectButtonCallback)
genClosure_DriveEjectButton :: MonadIO m => DriveEjectButtonCallback -> m (GClosure C_DriveEjectButtonCallback)
genClosure_DriveEjectButton :: IO () -> m (GClosure C_DriveChangedCallback)
genClosure_DriveEjectButton IO ()
cb = IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback))
-> IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveEjectButtonCallback IO ()
cb
C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveEjectButtonCallback C_DriveChangedCallback
cb' IO (FunPtr C_DriveChangedCallback)
-> (FunPtr C_DriveChangedCallback
-> IO (GClosure C_DriveChangedCallback))
-> IO (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DriveChangedCallback
-> IO (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_DriveEjectButtonCallback ::
DriveEjectButtonCallback ->
C_DriveEjectButtonCallback
wrap_DriveEjectButtonCallback :: IO () -> C_DriveChangedCallback
wrap_DriveEjectButtonCallback IO ()
_cb Ptr ()
_ Ptr ()
_ = do
IO ()
_cb
onDriveEjectButton :: (IsDrive a, MonadIO m) => a -> DriveEjectButtonCallback -> m SignalHandlerId
onDriveEjectButton :: a -> IO () -> m SignalHandlerId
onDriveEjectButton a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveEjectButtonCallback IO ()
cb
FunPtr C_DriveChangedCallback
cb'' <- C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveEjectButtonCallback C_DriveChangedCallback
cb'
a
-> Text
-> FunPtr C_DriveChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"eject-button" FunPtr C_DriveChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterDriveEjectButton :: (IsDrive a, MonadIO m) => a -> DriveEjectButtonCallback -> m SignalHandlerId
afterDriveEjectButton :: a -> IO () -> m SignalHandlerId
afterDriveEjectButton a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveEjectButtonCallback IO ()
cb
FunPtr C_DriveChangedCallback
cb'' <- C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveEjectButtonCallback C_DriveChangedCallback
cb'
a
-> Text
-> FunPtr C_DriveChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"eject-button" FunPtr C_DriveChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
data DriveEjectButtonSignalInfo
instance SignalInfo DriveEjectButtonSignalInfo where
type HaskellCallbackType DriveEjectButtonSignalInfo = DriveEjectButtonCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_DriveEjectButtonCallback cb
cb'' <- mk_DriveEjectButtonCallback cb'
connectSignalFunPtr obj "eject-button" cb'' connectMode detail
#endif
type DriveStopButtonCallback =
IO ()
noDriveStopButtonCallback :: Maybe DriveStopButtonCallback
noDriveStopButtonCallback :: Maybe (IO ())
noDriveStopButtonCallback = Maybe (IO ())
forall a. Maybe a
Nothing
type C_DriveStopButtonCallback =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_DriveStopButtonCallback :: C_DriveStopButtonCallback -> IO (FunPtr C_DriveStopButtonCallback)
genClosure_DriveStopButton :: MonadIO m => DriveStopButtonCallback -> m (GClosure C_DriveStopButtonCallback)
genClosure_DriveStopButton :: IO () -> m (GClosure C_DriveChangedCallback)
genClosure_DriveStopButton IO ()
cb = IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback))
-> IO (GClosure C_DriveChangedCallback)
-> m (GClosure C_DriveChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveStopButtonCallback IO ()
cb
C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveStopButtonCallback C_DriveChangedCallback
cb' IO (FunPtr C_DriveChangedCallback)
-> (FunPtr C_DriveChangedCallback
-> IO (GClosure C_DriveChangedCallback))
-> IO (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DriveChangedCallback
-> IO (GClosure C_DriveChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_DriveStopButtonCallback ::
DriveStopButtonCallback ->
C_DriveStopButtonCallback
wrap_DriveStopButtonCallback :: IO () -> C_DriveChangedCallback
wrap_DriveStopButtonCallback IO ()
_cb Ptr ()
_ Ptr ()
_ = do
IO ()
_cb
onDriveStopButton :: (IsDrive a, MonadIO m) => a -> DriveStopButtonCallback -> m SignalHandlerId
onDriveStopButton :: a -> IO () -> m SignalHandlerId
onDriveStopButton a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveStopButtonCallback IO ()
cb
FunPtr C_DriveChangedCallback
cb'' <- C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveStopButtonCallback C_DriveChangedCallback
cb'
a
-> Text
-> FunPtr C_DriveChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"stop-button" FunPtr C_DriveChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterDriveStopButton :: (IsDrive a, MonadIO m) => a -> DriveStopButtonCallback -> m SignalHandlerId
afterDriveStopButton :: a -> IO () -> m SignalHandlerId
afterDriveStopButton a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_DriveChangedCallback
cb' = IO () -> C_DriveChangedCallback
wrap_DriveStopButtonCallback IO ()
cb
FunPtr C_DriveChangedCallback
cb'' <- C_DriveChangedCallback -> IO (FunPtr C_DriveChangedCallback)
mk_DriveStopButtonCallback C_DriveChangedCallback
cb'
a
-> Text
-> FunPtr C_DriveChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"stop-button" FunPtr C_DriveChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
data DriveStopButtonSignalInfo
instance SignalInfo DriveStopButtonSignalInfo where
type HaskellCallbackType DriveStopButtonSignalInfo = DriveStopButtonCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_DriveStopButtonCallback cb
cb'' <- mk_DriveStopButtonCallback cb'
connectSignalFunPtr obj "stop-button" cb'' connectMode detail
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Drive = DriveSignalList
type DriveSignalList = ('[ '("changed", DriveChangedSignalInfo), '("disconnected", DriveDisconnectedSignalInfo), '("ejectButton", DriveEjectButtonSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("stopButton", DriveStopButtonSignalInfo)] :: [(Symbol, *)])
#endif