{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

A #GCClosure is a specialization of #GClosure for C function callbacks.
-}

module GI.GObject.Structs.CClosure
    ( 

-- * Exported types
    CClosure(..)                            ,
    noCClosure                              ,


 -- * Properties
-- ** Callback
    cClosureReadCallback                    ,


-- ** Closure
    cClosureReadClosure                     ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.GObject.Types
import GI.GObject.Callbacks

newtype CClosure = CClosure (ForeignPtr CClosure)
noCClosure :: Maybe CClosure
noCClosure = Nothing

cClosureReadClosure :: CClosure -> IO Closure
cClosureReadClosure s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO (Ptr Closure)
    val' <- (newBoxed Closure) val
    return val'

cClosureReadCallback :: CClosure -> IO (Ptr ())
cClosureReadCallback s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 64) :: IO (Ptr ())
    return val