{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The @GSourceFuncs@ struct contains a table of
-- functions used to handle event sources in a generic manner.
-- 
-- For idle sources, the prepare and check functions always return 'P.True'
-- to indicate that the source is always ready to be processed. The prepare
-- function also returns a timeout value of 0 to ensure that the @/poll()/@ call
-- doesn\'t block (since that would be time wasted which could have been spent
-- running the idle function).
-- 
-- For timeout sources, the prepare and check functions both return 'P.True'
-- if the timeout interval has expired. The prepare function also returns
-- a timeout value to ensure that the @/poll()/@ call doesn\'t block too long
-- and miss the next timeout.
-- 
-- For file descriptor sources, the prepare function typically returns 'P.False',
-- since it must wait until @/poll()/@ has been called before it knows whether
-- any events need to be processed. It sets the returned timeout to -1 to
-- indicate that it doesn\'t mind how long the @/poll()/@ call blocks. In the
-- check function, it tests the results of the @/poll()/@ call to see if the
-- required condition has been met, and returns 'P.True' if so.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.GLib.Structs.SourceFuncs
    ( 

-- * Exported types
    SourceFuncs(..)                         ,
    newZeroSourceFuncs                      ,
    noSourceFuncs                           ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveSourceFuncsMethod                ,
#endif




 -- * Properties
-- ** check #attr:check#
-- | /No description available in the introspection data./

    clearSourceFuncsCheck                   ,
    getSourceFuncsCheck                     ,
    setSourceFuncsCheck                     ,
#if defined(ENABLE_OVERLOADING)
    sourceFuncs_check                       ,
#endif


-- ** finalize #attr:finalize#
-- | /No description available in the introspection data./

    clearSourceFuncsFinalize                ,
    getSourceFuncsFinalize                  ,
    setSourceFuncsFinalize                  ,
#if defined(ENABLE_OVERLOADING)
    sourceFuncs_finalize                    ,
#endif


-- ** prepare #attr:prepare#
-- | /No description available in the introspection data./

    clearSourceFuncsPrepare                 ,
    getSourceFuncsPrepare                   ,
    setSourceFuncsPrepare                   ,
#if defined(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.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 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.GLib.Callbacks as GLib.Callbacks

-- | Memory-managed wrapper type.
newtype SourceFuncs = SourceFuncs (ManagedPtr SourceFuncs)
    deriving (SourceFuncs -> SourceFuncs -> Bool
(SourceFuncs -> SourceFuncs -> Bool)
-> (SourceFuncs -> SourceFuncs -> Bool) -> Eq SourceFuncs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceFuncs -> SourceFuncs -> Bool
$c/= :: SourceFuncs -> SourceFuncs -> Bool
== :: SourceFuncs -> SourceFuncs -> Bool
$c== :: SourceFuncs -> SourceFuncs -> Bool
Eq)
instance WrappedPtr SourceFuncs where
    wrappedPtrCalloc :: IO (Ptr SourceFuncs)
wrappedPtrCalloc = Int -> IO (Ptr SourceFuncs)
forall a. Int -> IO (Ptr a)
callocBytes 48
    wrappedPtrCopy :: SourceFuncs -> IO SourceFuncs
wrappedPtrCopy = \p :: SourceFuncs
p -> SourceFuncs
-> (Ptr SourceFuncs -> IO SourceFuncs) -> IO SourceFuncs
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
p (Int -> Ptr SourceFuncs -> IO (Ptr SourceFuncs)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 48 (Ptr SourceFuncs -> IO (Ptr SourceFuncs))
-> (Ptr SourceFuncs -> IO SourceFuncs)
-> Ptr SourceFuncs
-> IO SourceFuncs
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr SourceFuncs -> SourceFuncs)
-> Ptr SourceFuncs -> IO SourceFuncs
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr SourceFuncs -> SourceFuncs
SourceFuncs)
    wrappedPtrFree :: Maybe (GDestroyNotify SourceFuncs)
wrappedPtrFree = GDestroyNotify SourceFuncs -> Maybe (GDestroyNotify SourceFuncs)
forall a. a -> Maybe a
Just GDestroyNotify SourceFuncs
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free

-- | Construct a `SourceFuncs` struct initialized to zero.
newZeroSourceFuncs :: MonadIO m => m SourceFuncs
newZeroSourceFuncs :: m SourceFuncs
newZeroSourceFuncs = IO SourceFuncs -> m SourceFuncs
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SourceFuncs -> m SourceFuncs)
-> IO SourceFuncs -> m SourceFuncs
forall a b. (a -> b) -> a -> b
$ IO (Ptr SourceFuncs)
forall a. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr SourceFuncs)
-> (Ptr SourceFuncs -> IO SourceFuncs) -> IO SourceFuncs
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr SourceFuncs -> SourceFuncs)
-> Ptr SourceFuncs -> IO SourceFuncs
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr SourceFuncs -> SourceFuncs
SourceFuncs

instance tag ~ 'AttrSet => Constructible SourceFuncs tag where
    new :: (ManagedPtr SourceFuncs -> SourceFuncs)
-> [AttrOp SourceFuncs tag] -> m SourceFuncs
new _ attrs :: [AttrOp SourceFuncs tag]
attrs = do
        SourceFuncs
o <- m SourceFuncs
forall (m :: * -> *). MonadIO m => m SourceFuncs
newZeroSourceFuncs
        SourceFuncs -> [AttrOp SourceFuncs 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set SourceFuncs
o [AttrOp SourceFuncs tag]
[AttrOp SourceFuncs 'AttrSet]
attrs
        SourceFuncs -> m SourceFuncs
forall (m :: * -> *) a. Monad m => a -> m a
return SourceFuncs
o


-- | A convenience alias for `Nothing` :: `Maybe` `SourceFuncs`.
noSourceFuncs :: Maybe SourceFuncs
noSourceFuncs :: Maybe SourceFuncs
noSourceFuncs = Maybe SourceFuncs
forall a. Maybe a
Nothing

-- | Get the value of the “@prepare@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' sourceFuncs #prepare
-- @
getSourceFuncsPrepare :: MonadIO m => SourceFuncs -> m (Maybe GLib.Callbacks.SourceFuncsPrepareFieldCallback)
getSourceFuncsPrepare :: SourceFuncs -> m (Maybe SourceFuncsPrepareFieldCallback)
getSourceFuncsPrepare s :: SourceFuncs
s = IO (Maybe SourceFuncsPrepareFieldCallback)
-> m (Maybe SourceFuncsPrepareFieldCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe SourceFuncsPrepareFieldCallback)
 -> m (Maybe SourceFuncsPrepareFieldCallback))
-> IO (Maybe SourceFuncsPrepareFieldCallback)
-> m (Maybe SourceFuncsPrepareFieldCallback)
forall a b. (a -> b) -> a -> b
$ SourceFuncs
-> (Ptr SourceFuncs -> IO (Maybe SourceFuncsPrepareFieldCallback))
-> IO (Maybe SourceFuncsPrepareFieldCallback)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
s ((Ptr SourceFuncs -> IO (Maybe SourceFuncsPrepareFieldCallback))
 -> IO (Maybe SourceFuncsPrepareFieldCallback))
-> (Ptr SourceFuncs -> IO (Maybe SourceFuncsPrepareFieldCallback))
-> IO (Maybe SourceFuncsPrepareFieldCallback)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr SourceFuncs
ptr -> do
    FunPtr C_SourceFuncsPrepareFieldCallback
val <- Ptr (FunPtr C_SourceFuncsPrepareFieldCallback)
-> IO (FunPtr C_SourceFuncsPrepareFieldCallback)
forall a. Storable a => Ptr a -> IO a
peek (Ptr SourceFuncs
ptr Ptr SourceFuncs
-> Int -> Ptr (FunPtr C_SourceFuncsPrepareFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO (FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback)
    Maybe SourceFuncsPrepareFieldCallback
result <- FunPtr C_SourceFuncsPrepareFieldCallback
-> (FunPtr C_SourceFuncsPrepareFieldCallback
    -> IO SourceFuncsPrepareFieldCallback)
-> IO (Maybe SourceFuncsPrepareFieldCallback)
forall a b. FunPtr a -> (FunPtr a -> IO b) -> IO (Maybe b)
SP.convertFunPtrIfNonNull FunPtr C_SourceFuncsPrepareFieldCallback
val ((FunPtr C_SourceFuncsPrepareFieldCallback
  -> IO SourceFuncsPrepareFieldCallback)
 -> IO (Maybe SourceFuncsPrepareFieldCallback))
-> (FunPtr C_SourceFuncsPrepareFieldCallback
    -> IO SourceFuncsPrepareFieldCallback)
-> IO (Maybe SourceFuncsPrepareFieldCallback)
forall a b. (a -> b) -> a -> b
$ \val' :: FunPtr C_SourceFuncsPrepareFieldCallback
val' -> do
        let val'' :: SourceFuncsPrepareFieldCallback
val'' = FunPtr C_SourceFuncsPrepareFieldCallback
-> SourceFuncsPrepareFieldCallback
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_SourceFuncsPrepareFieldCallback
-> Source -> Int32 -> m Bool
GLib.Callbacks.dynamic_SourceFuncsPrepareFieldCallback FunPtr C_SourceFuncsPrepareFieldCallback
val'
        SourceFuncsPrepareFieldCallback
-> IO SourceFuncsPrepareFieldCallback
forall (m :: * -> *) a. Monad m => a -> m a
return SourceFuncsPrepareFieldCallback
val''
    Maybe SourceFuncsPrepareFieldCallback
-> IO (Maybe SourceFuncsPrepareFieldCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe SourceFuncsPrepareFieldCallback
result

-- | Set the value of the “@prepare@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' sourceFuncs [ #prepare 'Data.GI.Base.Attributes.:=' value ]
-- @
setSourceFuncsPrepare :: MonadIO m => SourceFuncs -> FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback -> m ()
setSourceFuncsPrepare :: SourceFuncs -> FunPtr C_SourceFuncsPrepareFieldCallback -> m ()
setSourceFuncsPrepare s :: SourceFuncs
s val :: FunPtr C_SourceFuncsPrepareFieldCallback
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ SourceFuncs -> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
s ((Ptr SourceFuncs -> IO ()) -> IO ())
-> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr SourceFuncs
ptr -> do
    Ptr (FunPtr C_SourceFuncsPrepareFieldCallback)
-> FunPtr C_SourceFuncsPrepareFieldCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SourceFuncs
ptr Ptr SourceFuncs
-> Int -> Ptr (FunPtr C_SourceFuncsPrepareFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (FunPtr C_SourceFuncsPrepareFieldCallback
val :: FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback)

-- | Set the value of the “@prepare@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #prepare
-- @
clearSourceFuncsPrepare :: MonadIO m => SourceFuncs -> m ()
clearSourceFuncsPrepare :: SourceFuncs -> m ()
clearSourceFuncsPrepare s :: SourceFuncs
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ SourceFuncs -> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
s ((Ptr SourceFuncs -> IO ()) -> IO ())
-> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr SourceFuncs
ptr -> do
    Ptr (FunPtr C_SourceFuncsPrepareFieldCallback)
-> FunPtr C_SourceFuncsPrepareFieldCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SourceFuncs
ptr Ptr SourceFuncs
-> Int -> Ptr (FunPtr C_SourceFuncsPrepareFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (FunPtr C_SourceFuncsPrepareFieldCallback
forall a. FunPtr a
FP.nullFunPtr :: FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback)

#if defined(ENABLE_OVERLOADING)
data SourceFuncsPrepareFieldInfo
instance AttrInfo SourceFuncsPrepareFieldInfo where
    type AttrBaseTypeConstraint SourceFuncsPrepareFieldInfo = (~) SourceFuncs
    type AttrAllowedOps SourceFuncsPrepareFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SourceFuncsPrepareFieldInfo = (~) (FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback)
    type AttrTransferTypeConstraint SourceFuncsPrepareFieldInfo = (~)GLib.Callbacks.SourceFuncsPrepareFieldCallback
    type AttrTransferType SourceFuncsPrepareFieldInfo = (FunPtr GLib.Callbacks.C_SourceFuncsPrepareFieldCallback)
    type AttrGetType SourceFuncsPrepareFieldInfo = Maybe GLib.Callbacks.SourceFuncsPrepareFieldCallback
    type AttrLabel SourceFuncsPrepareFieldInfo = "prepare"
    type AttrOrigin SourceFuncsPrepareFieldInfo = SourceFuncs
    attrGet = getSourceFuncsPrepare
    attrSet = setSourceFuncsPrepare
    attrConstruct = undefined
    attrClear = clearSourceFuncsPrepare
    attrTransfer _ v = do
        GLib.Callbacks.mk_SourceFuncsPrepareFieldCallback (GLib.Callbacks.wrap_SourceFuncsPrepareFieldCallback Nothing v)

sourceFuncs_prepare :: AttrLabelProxy "prepare"
sourceFuncs_prepare = AttrLabelProxy

#endif


-- | Get the value of the “@check@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' sourceFuncs #check
-- @
getSourceFuncsCheck :: MonadIO m => SourceFuncs -> m (Maybe GLib.Callbacks.SourceFuncsCheckFieldCallback)
getSourceFuncsCheck :: SourceFuncs -> m (Maybe SourceFuncsCheckFieldCallback)
getSourceFuncsCheck s :: SourceFuncs
s = IO (Maybe SourceFuncsCheckFieldCallback)
-> m (Maybe SourceFuncsCheckFieldCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe SourceFuncsCheckFieldCallback)
 -> m (Maybe SourceFuncsCheckFieldCallback))
-> IO (Maybe SourceFuncsCheckFieldCallback)
-> m (Maybe SourceFuncsCheckFieldCallback)
forall a b. (a -> b) -> a -> b
$ SourceFuncs
-> (Ptr SourceFuncs -> IO (Maybe SourceFuncsCheckFieldCallback))
-> IO (Maybe SourceFuncsCheckFieldCallback)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
s ((Ptr SourceFuncs -> IO (Maybe SourceFuncsCheckFieldCallback))
 -> IO (Maybe SourceFuncsCheckFieldCallback))
-> (Ptr SourceFuncs -> IO (Maybe SourceFuncsCheckFieldCallback))
-> IO (Maybe SourceFuncsCheckFieldCallback)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr SourceFuncs
ptr -> do
    FunPtr C_SourceFuncsCheckFieldCallback
val <- Ptr (FunPtr C_SourceFuncsCheckFieldCallback)
-> IO (FunPtr C_SourceFuncsCheckFieldCallback)
forall a. Storable a => Ptr a -> IO a
peek (Ptr SourceFuncs
ptr Ptr SourceFuncs
-> Int -> Ptr (FunPtr C_SourceFuncsCheckFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) :: IO (FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback)
    Maybe SourceFuncsCheckFieldCallback
result <- FunPtr C_SourceFuncsCheckFieldCallback
-> (FunPtr C_SourceFuncsCheckFieldCallback
    -> IO SourceFuncsCheckFieldCallback)
-> IO (Maybe SourceFuncsCheckFieldCallback)
forall a b. FunPtr a -> (FunPtr a -> IO b) -> IO (Maybe b)
SP.convertFunPtrIfNonNull FunPtr C_SourceFuncsCheckFieldCallback
val ((FunPtr C_SourceFuncsCheckFieldCallback
  -> IO SourceFuncsCheckFieldCallback)
 -> IO (Maybe SourceFuncsCheckFieldCallback))
-> (FunPtr C_SourceFuncsCheckFieldCallback
    -> IO SourceFuncsCheckFieldCallback)
-> IO (Maybe SourceFuncsCheckFieldCallback)
forall a b. (a -> b) -> a -> b
$ \val' :: FunPtr C_SourceFuncsCheckFieldCallback
val' -> do
        let val'' :: SourceFuncsCheckFieldCallback
val'' = FunPtr C_SourceFuncsCheckFieldCallback
-> SourceFuncsCheckFieldCallback
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_SourceFuncsCheckFieldCallback -> Source -> m Bool
GLib.Callbacks.dynamic_SourceFuncsCheckFieldCallback FunPtr C_SourceFuncsCheckFieldCallback
val'
        SourceFuncsCheckFieldCallback -> IO SourceFuncsCheckFieldCallback
forall (m :: * -> *) a. Monad m => a -> m a
return SourceFuncsCheckFieldCallback
val''
    Maybe SourceFuncsCheckFieldCallback
-> IO (Maybe SourceFuncsCheckFieldCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe SourceFuncsCheckFieldCallback
result

-- | Set the value of the “@check@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' sourceFuncs [ #check 'Data.GI.Base.Attributes.:=' value ]
-- @
setSourceFuncsCheck :: MonadIO m => SourceFuncs -> FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback -> m ()
setSourceFuncsCheck :: SourceFuncs -> FunPtr C_SourceFuncsCheckFieldCallback -> m ()
setSourceFuncsCheck s :: SourceFuncs
s val :: FunPtr C_SourceFuncsCheckFieldCallback
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ SourceFuncs -> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
s ((Ptr SourceFuncs -> IO ()) -> IO ())
-> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr SourceFuncs
ptr -> do
    Ptr (FunPtr C_SourceFuncsCheckFieldCallback)
-> FunPtr C_SourceFuncsCheckFieldCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SourceFuncs
ptr Ptr SourceFuncs
-> Int -> Ptr (FunPtr C_SourceFuncsCheckFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (FunPtr C_SourceFuncsCheckFieldCallback
val :: FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback)

-- | Set the value of the “@check@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #check
-- @
clearSourceFuncsCheck :: MonadIO m => SourceFuncs -> m ()
clearSourceFuncsCheck :: SourceFuncs -> m ()
clearSourceFuncsCheck s :: SourceFuncs
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ SourceFuncs -> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
s ((Ptr SourceFuncs -> IO ()) -> IO ())
-> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr SourceFuncs
ptr -> do
    Ptr (FunPtr C_SourceFuncsCheckFieldCallback)
-> FunPtr C_SourceFuncsCheckFieldCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SourceFuncs
ptr Ptr SourceFuncs
-> Int -> Ptr (FunPtr C_SourceFuncsCheckFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8) (FunPtr C_SourceFuncsCheckFieldCallback
forall a. FunPtr a
FP.nullFunPtr :: FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback)

#if defined(ENABLE_OVERLOADING)
data SourceFuncsCheckFieldInfo
instance AttrInfo SourceFuncsCheckFieldInfo where
    type AttrBaseTypeConstraint SourceFuncsCheckFieldInfo = (~) SourceFuncs
    type AttrAllowedOps SourceFuncsCheckFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SourceFuncsCheckFieldInfo = (~) (FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback)
    type AttrTransferTypeConstraint SourceFuncsCheckFieldInfo = (~)GLib.Callbacks.SourceFuncsCheckFieldCallback
    type AttrTransferType SourceFuncsCheckFieldInfo = (FunPtr GLib.Callbacks.C_SourceFuncsCheckFieldCallback)
    type AttrGetType SourceFuncsCheckFieldInfo = Maybe GLib.Callbacks.SourceFuncsCheckFieldCallback
    type AttrLabel SourceFuncsCheckFieldInfo = "check"
    type AttrOrigin SourceFuncsCheckFieldInfo = SourceFuncs
    attrGet = getSourceFuncsCheck
    attrSet = setSourceFuncsCheck
    attrConstruct = undefined
    attrClear = clearSourceFuncsCheck
    attrTransfer _ v = do
        GLib.Callbacks.mk_SourceFuncsCheckFieldCallback (GLib.Callbacks.wrap_SourceFuncsCheckFieldCallback Nothing v)

sourceFuncs_check :: AttrLabelProxy "check"
sourceFuncs_check = AttrLabelProxy

#endif


-- | Get the value of the “@finalize@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' sourceFuncs #finalize
-- @
getSourceFuncsFinalize :: MonadIO m => SourceFuncs -> m (Maybe GLib.Callbacks.SourceFuncsFinalizeFieldCallback)
getSourceFuncsFinalize :: SourceFuncs -> m (Maybe SourceFuncsFinalizeFieldCallback)
getSourceFuncsFinalize s :: SourceFuncs
s = IO (Maybe SourceFuncsFinalizeFieldCallback)
-> m (Maybe SourceFuncsFinalizeFieldCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe SourceFuncsFinalizeFieldCallback)
 -> m (Maybe SourceFuncsFinalizeFieldCallback))
-> IO (Maybe SourceFuncsFinalizeFieldCallback)
-> m (Maybe SourceFuncsFinalizeFieldCallback)
forall a b. (a -> b) -> a -> b
$ SourceFuncs
-> (Ptr SourceFuncs -> IO (Maybe SourceFuncsFinalizeFieldCallback))
-> IO (Maybe SourceFuncsFinalizeFieldCallback)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
s ((Ptr SourceFuncs -> IO (Maybe SourceFuncsFinalizeFieldCallback))
 -> IO (Maybe SourceFuncsFinalizeFieldCallback))
-> (Ptr SourceFuncs -> IO (Maybe SourceFuncsFinalizeFieldCallback))
-> IO (Maybe SourceFuncsFinalizeFieldCallback)
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr SourceFuncs
ptr -> do
    FunPtr C_SourceFuncsFinalizeFieldCallback
val <- Ptr (FunPtr C_SourceFuncsFinalizeFieldCallback)
-> IO (FunPtr C_SourceFuncsFinalizeFieldCallback)
forall a. Storable a => Ptr a -> IO a
peek (Ptr SourceFuncs
ptr Ptr SourceFuncs
-> Int -> Ptr (FunPtr C_SourceFuncsFinalizeFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24) :: IO (FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback)
    Maybe SourceFuncsFinalizeFieldCallback
result <- FunPtr C_SourceFuncsFinalizeFieldCallback
-> (FunPtr C_SourceFuncsFinalizeFieldCallback
    -> IO SourceFuncsFinalizeFieldCallback)
-> IO (Maybe SourceFuncsFinalizeFieldCallback)
forall a b. FunPtr a -> (FunPtr a -> IO b) -> IO (Maybe b)
SP.convertFunPtrIfNonNull FunPtr C_SourceFuncsFinalizeFieldCallback
val ((FunPtr C_SourceFuncsFinalizeFieldCallback
  -> IO SourceFuncsFinalizeFieldCallback)
 -> IO (Maybe SourceFuncsFinalizeFieldCallback))
-> (FunPtr C_SourceFuncsFinalizeFieldCallback
    -> IO SourceFuncsFinalizeFieldCallback)
-> IO (Maybe SourceFuncsFinalizeFieldCallback)
forall a b. (a -> b) -> a -> b
$ \val' :: FunPtr C_SourceFuncsFinalizeFieldCallback
val' -> do
        let val'' :: SourceFuncsFinalizeFieldCallback
val'' = FunPtr C_SourceFuncsFinalizeFieldCallback
-> SourceFuncsFinalizeFieldCallback
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_SourceFuncsFinalizeFieldCallback -> Source -> m ()
GLib.Callbacks.dynamic_SourceFuncsFinalizeFieldCallback FunPtr C_SourceFuncsFinalizeFieldCallback
val'
        SourceFuncsFinalizeFieldCallback
-> IO SourceFuncsFinalizeFieldCallback
forall (m :: * -> *) a. Monad m => a -> m a
return SourceFuncsFinalizeFieldCallback
val''
    Maybe SourceFuncsFinalizeFieldCallback
-> IO (Maybe SourceFuncsFinalizeFieldCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe SourceFuncsFinalizeFieldCallback
result

-- | Set the value of the “@finalize@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' sourceFuncs [ #finalize 'Data.GI.Base.Attributes.:=' value ]
-- @
setSourceFuncsFinalize :: MonadIO m => SourceFuncs -> FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback -> m ()
setSourceFuncsFinalize :: SourceFuncs -> FunPtr C_SourceFuncsFinalizeFieldCallback -> m ()
setSourceFuncsFinalize s :: SourceFuncs
s val :: FunPtr C_SourceFuncsFinalizeFieldCallback
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ SourceFuncs -> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
s ((Ptr SourceFuncs -> IO ()) -> IO ())
-> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr SourceFuncs
ptr -> do
    Ptr (FunPtr C_SourceFuncsFinalizeFieldCallback)
-> FunPtr C_SourceFuncsFinalizeFieldCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SourceFuncs
ptr Ptr SourceFuncs
-> Int -> Ptr (FunPtr C_SourceFuncsFinalizeFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24) (FunPtr C_SourceFuncsFinalizeFieldCallback
val :: FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback)

-- | Set the value of the “@finalize@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #finalize
-- @
clearSourceFuncsFinalize :: MonadIO m => SourceFuncs -> m ()
clearSourceFuncsFinalize :: SourceFuncs -> m ()
clearSourceFuncsFinalize s :: SourceFuncs
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ SourceFuncs -> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceFuncs
s ((Ptr SourceFuncs -> IO ()) -> IO ())
-> (Ptr SourceFuncs -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr SourceFuncs
ptr -> do
    Ptr (FunPtr C_SourceFuncsFinalizeFieldCallback)
-> FunPtr C_SourceFuncsFinalizeFieldCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SourceFuncs
ptr Ptr SourceFuncs
-> Int -> Ptr (FunPtr C_SourceFuncsFinalizeFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24) (FunPtr C_SourceFuncsFinalizeFieldCallback
forall a. FunPtr a
FP.nullFunPtr :: FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback)

#if defined(ENABLE_OVERLOADING)
data SourceFuncsFinalizeFieldInfo
instance AttrInfo SourceFuncsFinalizeFieldInfo where
    type AttrBaseTypeConstraint SourceFuncsFinalizeFieldInfo = (~) SourceFuncs
    type AttrAllowedOps SourceFuncsFinalizeFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SourceFuncsFinalizeFieldInfo = (~) (FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback)
    type AttrTransferTypeConstraint SourceFuncsFinalizeFieldInfo = (~)GLib.Callbacks.SourceFuncsFinalizeFieldCallback
    type AttrTransferType SourceFuncsFinalizeFieldInfo = (FunPtr GLib.Callbacks.C_SourceFuncsFinalizeFieldCallback)
    type AttrGetType SourceFuncsFinalizeFieldInfo = Maybe GLib.Callbacks.SourceFuncsFinalizeFieldCallback
    type AttrLabel SourceFuncsFinalizeFieldInfo = "finalize"
    type AttrOrigin SourceFuncsFinalizeFieldInfo = SourceFuncs
    attrGet = getSourceFuncsFinalize
    attrSet = setSourceFuncsFinalize
    attrConstruct = undefined
    attrClear = clearSourceFuncsFinalize
    attrTransfer _ v = do
        GLib.Callbacks.mk_SourceFuncsFinalizeFieldCallback (GLib.Callbacks.wrap_SourceFuncsFinalizeFieldCallback Nothing v)

sourceFuncs_finalize :: AttrLabelProxy "finalize"
sourceFuncs_finalize = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SourceFuncs
type instance O.AttributeList SourceFuncs = SourceFuncsAttributeList
type SourceFuncsAttributeList = ('[ '("prepare", SourceFuncsPrepareFieldInfo), '("check", SourceFuncsCheckFieldInfo), '("finalize", SourceFuncsFinalizeFieldInfo)] :: [(Symbol, *)])
#endif

#if defined(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) => OL.IsLabel t (SourceFuncs -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif