#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GLib.Structs.SourceFuncs
(
SourceFuncs(..) ,
newZeroSourceFuncs ,
noSourceFuncs ,
clearSourceFuncsCheck ,
getSourceFuncsCheck ,
setSourceFuncsCheck ,
#if ENABLE_OVERLOADING
sourceFuncs_check ,
#endif
clearSourceFuncsFinalize ,
getSourceFuncsFinalize ,
setSourceFuncsFinalize ,
#if ENABLE_OVERLOADING
sourceFuncs_finalize ,
#endif
clearSourceFuncsPrepare ,
getSourceFuncsPrepare ,
setSourceFuncsPrepare ,
#if ENABLE_OVERLOADING
sourceFuncs_prepare ,
#endif
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GI.GLib.Callbacks as GLib.Callbacks
newtype SourceFuncs = SourceFuncs (ManagedPtr SourceFuncs)
instance WrappedPtr SourceFuncs where
wrappedPtrCalloc = callocBytes 48
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 48 >=> wrapPtr SourceFuncs)
wrappedPtrFree = Just ptr_to_g_free
newZeroSourceFuncs :: MonadIO m => m SourceFuncs
newZeroSourceFuncs = liftIO $ wrappedPtrCalloc >>= wrapPtr SourceFuncs
instance tag ~ 'AttrSet => Constructible SourceFuncs tag where
new _ attrs = do
o <- newZeroSourceFuncs
GI.Attributes.set o attrs
return o
noSourceFuncs :: Maybe SourceFuncs
noSourceFuncs = Nothing
getSourceFuncsPrepare :: MonadIO m => SourceFuncs -> m (Maybe GLib.Callbacks.SourceFuncsPrepareFieldCallback)
getSourceFuncsPrepare s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback)
result <- SP.convertFunPtrIfNonNull val $ \val' -> do
let val'' = GLib.Callbacks.dynamic_SourceFuncsPrepareFieldCallback val'
return val''
return result
setSourceFuncsPrepare :: MonadIO m => SourceFuncs -> FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback -> m ()
setSourceFuncsPrepare s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback)
clearSourceFuncsPrepare :: MonadIO m => SourceFuncs -> m ()
clearSourceFuncsPrepare s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (FP.nullFunPtr :: FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback)
#if ENABLE_OVERLOADING
data SourceFuncsPrepareFieldInfo
instance AttrInfo SourceFuncsPrepareFieldInfo where
type AttrAllowedOps SourceFuncsPrepareFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint SourceFuncsPrepareFieldInfo = (~) (FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback)
type AttrBaseTypeConstraint SourceFuncsPrepareFieldInfo = (~) SourceFuncs
type AttrGetType SourceFuncsPrepareFieldInfo = Maybe GLib.Callbacks.SourceFuncsPrepareFieldCallback
type AttrLabel SourceFuncsPrepareFieldInfo = "prepare"
type AttrOrigin SourceFuncsPrepareFieldInfo = SourceFuncs
attrGet _ = getSourceFuncsPrepare
attrSet _ = setSourceFuncsPrepare
attrConstruct = undefined
attrClear _ = clearSourceFuncsPrepare
sourceFuncs_prepare :: AttrLabelProxy "prepare"
sourceFuncs_prepare = AttrLabelProxy
#endif
getSourceFuncsCheck :: MonadIO m => SourceFuncs -> m (Maybe GLib.Callbacks.SourceFuncsCheckFieldCallback)
getSourceFuncsCheck s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback)
result <- SP.convertFunPtrIfNonNull val $ \val' -> do
let val'' = GLib.Callbacks.dynamic_SourceFuncsCheckFieldCallback val'
return val''
return result
setSourceFuncsCheck :: MonadIO m => SourceFuncs -> FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback -> m ()
setSourceFuncsCheck s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback)
clearSourceFuncsCheck :: MonadIO m => SourceFuncs -> m ()
clearSourceFuncsCheck s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullFunPtr :: FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback)
#if ENABLE_OVERLOADING
data SourceFuncsCheckFieldInfo
instance AttrInfo SourceFuncsCheckFieldInfo where
type AttrAllowedOps SourceFuncsCheckFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint SourceFuncsCheckFieldInfo = (~) (FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback)
type AttrBaseTypeConstraint SourceFuncsCheckFieldInfo = (~) SourceFuncs
type AttrGetType SourceFuncsCheckFieldInfo = Maybe GLib.Callbacks.SourceFuncsCheckFieldCallback
type AttrLabel SourceFuncsCheckFieldInfo = "check"
type AttrOrigin SourceFuncsCheckFieldInfo = SourceFuncs
attrGet _ = getSourceFuncsCheck
attrSet _ = setSourceFuncsCheck
attrConstruct = undefined
attrClear _ = clearSourceFuncsCheck
sourceFuncs_check :: AttrLabelProxy "check"
sourceFuncs_check = AttrLabelProxy
#endif
getSourceFuncsFinalize :: MonadIO m => SourceFuncs -> m (Maybe GLib.Callbacks.SourceFuncsFinalizeFieldCallback)
getSourceFuncsFinalize s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO (FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback)
result <- SP.convertFunPtrIfNonNull val $ \val' -> do
let val'' = GLib.Callbacks.dynamic_SourceFuncsFinalizeFieldCallback val'
return val''
return result
setSourceFuncsFinalize :: MonadIO m => SourceFuncs -> FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback -> m ()
setSourceFuncsFinalize s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (val :: FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback)
clearSourceFuncsFinalize :: MonadIO m => SourceFuncs -> m ()
clearSourceFuncsFinalize s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (FP.nullFunPtr :: FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback)
#if ENABLE_OVERLOADING
data SourceFuncsFinalizeFieldInfo
instance AttrInfo SourceFuncsFinalizeFieldInfo where
type AttrAllowedOps SourceFuncsFinalizeFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint SourceFuncsFinalizeFieldInfo = (~) (FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback)
type AttrBaseTypeConstraint SourceFuncsFinalizeFieldInfo = (~) SourceFuncs
type AttrGetType SourceFuncsFinalizeFieldInfo = Maybe GLib.Callbacks.SourceFuncsFinalizeFieldCallback
type AttrLabel SourceFuncsFinalizeFieldInfo = "finalize"
type AttrOrigin SourceFuncsFinalizeFieldInfo = SourceFuncs
attrGet _ = getSourceFuncsFinalize
attrSet _ = setSourceFuncsFinalize
attrConstruct = undefined
attrClear _ = clearSourceFuncsFinalize
sourceFuncs_finalize :: AttrLabelProxy "finalize"
sourceFuncs_finalize = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList SourceFuncs
type instance O.AttributeList SourceFuncs = SourceFuncsAttributeList
type SourceFuncsAttributeList = ('[ '("prepare", SourceFuncsPrepareFieldInfo), '("check", SourceFuncsCheckFieldInfo), '("finalize", SourceFuncsFinalizeFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveSourceFuncsMethod (t :: Symbol) (o :: *) :: * where
ResolveSourceFuncsMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSourceFuncsMethod t SourceFuncs, O.MethodInfo info SourceFuncs p) => O.IsLabelProxy t (SourceFuncs -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveSourceFuncsMethod t SourceFuncs, O.MethodInfo info SourceFuncs p) => O.IsLabel t (SourceFuncs -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#endif