{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) The GParameter struct is an auxiliary structure used to hand parameter name/value pairs to g_object_newv(). -} module GI.GObject.Structs.Parameter ( -- * Exported types Parameter(..) , noParameter , -- * Properties -- ** Name parameterReadName , -- ** Value parameterReadValue , ) 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 Parameter = Parameter (ForeignPtr Parameter) noParameter :: Maybe Parameter noParameter = Nothing parameterReadName :: Parameter -> IO T.Text parameterReadName s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO CString val' <- cstringToText val return val' parameterReadValue :: Parameter -> IO GValue parameterReadValue s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO (Ptr GValue) val' <- (newBoxed GValue) val return val'