{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The @GSourceCallbackFuncs@ struct contains
-- functions for managing callback objects.

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

module GI.GLib.Structs.SourceCallbackFuncs
    ( 

-- * Exported types
    SourceCallbackFuncs(..)                 ,
    newZeroSourceCallbackFuncs              ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveSourceCallbackFuncsMethod        ,
#endif




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

    clearSourceCallbackFuncsRef             ,
    getSourceCallbackFuncsRef               ,
    setSourceCallbackFuncsRef               ,
#if defined(ENABLE_OVERLOADING)
    sourceCallbackFuncs_ref                 ,
#endif


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

    clearSourceCallbackFuncsUnref           ,
    getSourceCallbackFuncsUnref             ,
    setSourceCallbackFuncsUnref             ,
#if defined(ENABLE_OVERLOADING)
    sourceCallbackFuncs_unref               ,
#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.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.GLib.Callbacks as GLib.Callbacks

-- | Memory-managed wrapper type.
newtype SourceCallbackFuncs = SourceCallbackFuncs (SP.ManagedPtr SourceCallbackFuncs)
    deriving (SourceCallbackFuncs -> SourceCallbackFuncs -> Bool
(SourceCallbackFuncs -> SourceCallbackFuncs -> Bool)
-> (SourceCallbackFuncs -> SourceCallbackFuncs -> Bool)
-> Eq SourceCallbackFuncs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceCallbackFuncs -> SourceCallbackFuncs -> Bool
$c/= :: SourceCallbackFuncs -> SourceCallbackFuncs -> Bool
== :: SourceCallbackFuncs -> SourceCallbackFuncs -> Bool
$c== :: SourceCallbackFuncs -> SourceCallbackFuncs -> Bool
Eq)

instance SP.ManagedPtrNewtype SourceCallbackFuncs where
    toManagedPtr :: SourceCallbackFuncs -> ManagedPtr SourceCallbackFuncs
toManagedPtr (SourceCallbackFuncs ManagedPtr SourceCallbackFuncs
p) = ManagedPtr SourceCallbackFuncs
p

instance BoxedPtr SourceCallbackFuncs where
    boxedPtrCopy :: SourceCallbackFuncs -> IO SourceCallbackFuncs
boxedPtrCopy = \SourceCallbackFuncs
p -> SourceCallbackFuncs
-> (Ptr SourceCallbackFuncs -> IO SourceCallbackFuncs)
-> IO SourceCallbackFuncs
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SourceCallbackFuncs
p (Int -> Ptr SourceCallbackFuncs -> IO (Ptr SourceCallbackFuncs)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
24 (Ptr SourceCallbackFuncs -> IO (Ptr SourceCallbackFuncs))
-> (Ptr SourceCallbackFuncs -> IO SourceCallbackFuncs)
-> Ptr SourceCallbackFuncs
-> IO SourceCallbackFuncs
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr SourceCallbackFuncs -> SourceCallbackFuncs)
-> Ptr SourceCallbackFuncs -> IO SourceCallbackFuncs
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr SourceCallbackFuncs -> SourceCallbackFuncs
SourceCallbackFuncs)
    boxedPtrFree :: SourceCallbackFuncs -> IO ()
boxedPtrFree = \SourceCallbackFuncs
x -> SourceCallbackFuncs -> (Ptr SourceCallbackFuncs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr SourceCallbackFuncs
x Ptr SourceCallbackFuncs -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr SourceCallbackFuncs where
    boxedPtrCalloc :: IO (Ptr SourceCallbackFuncs)
boxedPtrCalloc = Int -> IO (Ptr SourceCallbackFuncs)
forall a. Int -> IO (Ptr a)
callocBytes Int
24


-- | Construct a `SourceCallbackFuncs` struct initialized to zero.
newZeroSourceCallbackFuncs :: MonadIO m => m SourceCallbackFuncs
newZeroSourceCallbackFuncs :: m SourceCallbackFuncs
newZeroSourceCallbackFuncs = IO SourceCallbackFuncs -> m SourceCallbackFuncs
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SourceCallbackFuncs -> m SourceCallbackFuncs)
-> IO SourceCallbackFuncs -> m SourceCallbackFuncs
forall a b. (a -> b) -> a -> b
$ IO (Ptr SourceCallbackFuncs)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr SourceCallbackFuncs)
-> (Ptr SourceCallbackFuncs -> IO SourceCallbackFuncs)
-> IO SourceCallbackFuncs
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr SourceCallbackFuncs -> SourceCallbackFuncs)
-> Ptr SourceCallbackFuncs -> IO SourceCallbackFuncs
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr SourceCallbackFuncs -> SourceCallbackFuncs
SourceCallbackFuncs

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


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

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

-- | Set the value of the “@ref@” 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' #ref
-- @
clearSourceCallbackFuncsRef :: MonadIO m => SourceCallbackFuncs -> m ()
clearSourceCallbackFuncsRef :: SourceCallbackFuncs -> m ()
clearSourceCallbackFuncsRef SourceCallbackFuncs
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ SourceCallbackFuncs -> (Ptr SourceCallbackFuncs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceCallbackFuncs
s ((Ptr SourceCallbackFuncs -> IO ()) -> IO ())
-> (Ptr SourceCallbackFuncs -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr SourceCallbackFuncs
ptr -> do
    Ptr (FunPtr SourceCallbackFuncsRefFieldCallback)
-> FunPtr SourceCallbackFuncsRefFieldCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SourceCallbackFuncs
ptr Ptr SourceCallbackFuncs
-> Int -> Ptr (FunPtr SourceCallbackFuncsRefFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (FunPtr SourceCallbackFuncsRefFieldCallback
forall a. FunPtr a
FP.nullFunPtr :: FunPtr GLib.Callbacks.C_SourceCallbackFuncsRefFieldCallback)

#if defined(ENABLE_OVERLOADING)
data SourceCallbackFuncsRefFieldInfo
instance AttrInfo SourceCallbackFuncsRefFieldInfo where
    type AttrBaseTypeConstraint SourceCallbackFuncsRefFieldInfo = (~) SourceCallbackFuncs
    type AttrAllowedOps SourceCallbackFuncsRefFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SourceCallbackFuncsRefFieldInfo = (~) (FunPtr GLib.Callbacks.C_SourceCallbackFuncsRefFieldCallback)
    type AttrTransferTypeConstraint SourceCallbackFuncsRefFieldInfo = (~)GLib.Callbacks.SourceCallbackFuncsRefFieldCallback
    type AttrTransferType SourceCallbackFuncsRefFieldInfo = (FunPtr GLib.Callbacks.C_SourceCallbackFuncsRefFieldCallback)
    type AttrGetType SourceCallbackFuncsRefFieldInfo = Maybe GLib.Callbacks.SourceCallbackFuncsRefFieldCallback
    type AttrLabel SourceCallbackFuncsRefFieldInfo = "ref"
    type AttrOrigin SourceCallbackFuncsRefFieldInfo = SourceCallbackFuncs
    attrGet = getSourceCallbackFuncsRef
    attrSet = setSourceCallbackFuncsRef
    attrConstruct = undefined
    attrClear = clearSourceCallbackFuncsRef
    attrTransfer _ v = do
        GLib.Callbacks.mk_SourceCallbackFuncsRefFieldCallback (GLib.Callbacks.wrap_SourceCallbackFuncsRefFieldCallback Nothing v)

sourceCallbackFuncs_ref :: AttrLabelProxy "ref"
sourceCallbackFuncs_ref = AttrLabelProxy

#endif


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

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

-- | Set the value of the “@unref@” 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' #unref
-- @
clearSourceCallbackFuncsUnref :: MonadIO m => SourceCallbackFuncs -> m ()
clearSourceCallbackFuncsUnref :: SourceCallbackFuncs -> m ()
clearSourceCallbackFuncsUnref SourceCallbackFuncs
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ SourceCallbackFuncs -> (Ptr SourceCallbackFuncs -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr SourceCallbackFuncs
s ((Ptr SourceCallbackFuncs -> IO ()) -> IO ())
-> (Ptr SourceCallbackFuncs -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr SourceCallbackFuncs
ptr -> do
    Ptr (FunPtr SourceCallbackFuncsRefFieldCallback)
-> FunPtr SourceCallbackFuncsRefFieldCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SourceCallbackFuncs
ptr Ptr SourceCallbackFuncs
-> Int -> Ptr (FunPtr SourceCallbackFuncsRefFieldCallback)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (FunPtr SourceCallbackFuncsRefFieldCallback
forall a. FunPtr a
FP.nullFunPtr :: FunPtr GLib.Callbacks.C_SourceCallbackFuncsUnrefFieldCallback)

#if defined(ENABLE_OVERLOADING)
data SourceCallbackFuncsUnrefFieldInfo
instance AttrInfo SourceCallbackFuncsUnrefFieldInfo where
    type AttrBaseTypeConstraint SourceCallbackFuncsUnrefFieldInfo = (~) SourceCallbackFuncs
    type AttrAllowedOps SourceCallbackFuncsUnrefFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SourceCallbackFuncsUnrefFieldInfo = (~) (FunPtr GLib.Callbacks.C_SourceCallbackFuncsUnrefFieldCallback)
    type AttrTransferTypeConstraint SourceCallbackFuncsUnrefFieldInfo = (~)GLib.Callbacks.SourceCallbackFuncsUnrefFieldCallback
    type AttrTransferType SourceCallbackFuncsUnrefFieldInfo = (FunPtr GLib.Callbacks.C_SourceCallbackFuncsUnrefFieldCallback)
    type AttrGetType SourceCallbackFuncsUnrefFieldInfo = Maybe GLib.Callbacks.SourceCallbackFuncsUnrefFieldCallback
    type AttrLabel SourceCallbackFuncsUnrefFieldInfo = "unref"
    type AttrOrigin SourceCallbackFuncsUnrefFieldInfo = SourceCallbackFuncs
    attrGet = getSourceCallbackFuncsUnref
    attrSet = setSourceCallbackFuncsUnref
    attrConstruct = undefined
    attrClear = clearSourceCallbackFuncsUnref
    attrTransfer _ v = do
        GLib.Callbacks.mk_SourceCallbackFuncsUnrefFieldCallback (GLib.Callbacks.wrap_SourceCallbackFuncsUnrefFieldCallback Nothing v)

sourceCallbackFuncs_unref :: AttrLabelProxy "unref"
sourceCallbackFuncs_unref = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SourceCallbackFuncs
type instance O.AttributeList SourceCallbackFuncs = SourceCallbackFuncsAttributeList
type SourceCallbackFuncsAttributeList = ('[ '("ref", SourceCallbackFuncsRefFieldInfo), '("unref", SourceCallbackFuncsUnrefFieldInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveSourceCallbackFuncsMethod (t :: Symbol) (o :: *) :: * where
    ResolveSourceCallbackFuncsMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSourceCallbackFuncsMethod t SourceCallbackFuncs, O.MethodInfo info SourceCallbackFuncs p) => OL.IsLabel t (SourceCallbackFuncs -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif