{-# LINE 1 "Data/GI/Base/Properties.hsc" #-}
{-# LANGUAGE ScopedTypeVariables, TypeApplications #-}

module Data.GI.Base.Properties
    ( setObjectPropertyString
    , setObjectPropertyStringArray
    , setObjectPropertyPtr
    , setObjectPropertyInt
    , setObjectPropertyUInt
    , setObjectPropertyLong
    , setObjectPropertyULong
    , setObjectPropertyInt32
    , setObjectPropertyUInt32
    , setObjectPropertyInt64
    , setObjectPropertyUInt64
    , setObjectPropertyFloat
    , setObjectPropertyDouble
    , setObjectPropertyBool
    , setObjectPropertyGType
    , setObjectPropertyObject
    , setObjectPropertyBoxed
    , setObjectPropertyEnum
    , setObjectPropertyFlags
    , setObjectPropertyClosure
    , setObjectPropertyVariant
    , setObjectPropertyByteArray
    , setObjectPropertyPtrGList
    , setObjectPropertyHash
    , setObjectPropertyCallback
    , setObjectPropertyGError
    , setObjectPropertyGValue

    , getObjectPropertyString
    , getObjectPropertyStringArray
    , getObjectPropertyPtr
    , getObjectPropertyInt
    , getObjectPropertyUInt
    , getObjectPropertyLong
    , getObjectPropertyULong
    , getObjectPropertyInt32
    , getObjectPropertyUInt32
    , getObjectPropertyInt64
    , getObjectPropertyUInt64
    , getObjectPropertyFloat
    , getObjectPropertyDouble
    , getObjectPropertyBool
    , getObjectPropertyGType
    , getObjectPropertyObject
    , getObjectPropertyBoxed
    , getObjectPropertyEnum
    , getObjectPropertyFlags
    , getObjectPropertyClosure
    , getObjectPropertyVariant
    , getObjectPropertyByteArray
    , getObjectPropertyPtrGList
    , getObjectPropertyHash
    , getObjectPropertyCallback
    , getObjectPropertyGError
    , getObjectPropertyGValue

    , constructObjectPropertyString
    , constructObjectPropertyStringArray
    , constructObjectPropertyPtr
    , constructObjectPropertyInt
    , constructObjectPropertyUInt
    , constructObjectPropertyLong
    , constructObjectPropertyULong
    , constructObjectPropertyInt32
    , constructObjectPropertyUInt32
    , constructObjectPropertyInt64
    , constructObjectPropertyUInt64
    , constructObjectPropertyFloat
    , constructObjectPropertyDouble
    , constructObjectPropertyBool
    , constructObjectPropertyGType
    , constructObjectPropertyObject
    , constructObjectPropertyBoxed
    , constructObjectPropertyEnum
    , constructObjectPropertyFlags
    , constructObjectPropertyClosure
    , constructObjectPropertyVariant
    , constructObjectPropertyByteArray
    , constructObjectPropertyPtrGList
    , constructObjectPropertyHash
    , constructObjectPropertyCallback
    , constructObjectPropertyGError
    , constructObjectPropertyGValue
    ) where


{-# LINE 92 "Data/GI/Base/Properties.hsc" #-}
import Control.Monad ((>=>))

import qualified Data.ByteString.Char8 as B
import Data.Text (Text)

import Data.GI.Base.BasicTypes
import Data.GI.Base.BasicConversions
import Data.GI.Base.ManagedPtr
import Data.GI.Base.GError (GError(..))
import Data.GI.Base.GValue
import Data.GI.Base.GType
import Data.GI.Base.GClosure (GClosure(..))
import Data.GI.Base.GVariant (newGVariantFromPtr)
import Data.GI.Base.Utils (freeMem, convertIfNonNull)

import Foreign (Ptr, FunPtr, Int32, Word32, Int64, Word64, nullPtr,
                castFunPtrToPtr, castPtrToFunPtr)
import Foreign.C (CString, withCString)
import Foreign.C.Types (CInt, CUInt, CLong, CULong)



foreign import ccall "g_object_set_property" g_object_set_property ::
    Ptr a -> CString -> Ptr GValue -> IO ()

setObjectProperty :: GObject a => a -> String -> b ->
                     (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty :: a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName b
propValue GValue -> b -> IO ()
setter (GType CGType
gtype) = do
  GValue
gvalue <- GType -> (GValue -> b -> IO ()) -> b -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
buildGValue (CGType -> GType
GType CGType
gtype) GValue -> b -> IO ()
setter b
propValue
  a -> (Ptr a -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr a
obj ((Ptr a -> IO ()) -> IO ()) -> (Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr a
objPtr ->
      String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
propName ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
cPropName ->
          GValue -> (Ptr GValue -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr GValue
gvalue ((Ptr GValue -> IO ()) -> IO ()) -> (Ptr GValue -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr GValue
gvalueptr ->
              Ptr a -> CString -> Ptr GValue -> IO ()
forall a. Ptr a -> CString -> Ptr GValue -> IO ()
g_object_set_property Ptr a
objPtr CString
cPropName Ptr GValue
gvalueptr

foreign import ccall "g_object_get_property" g_object_get_property ::
    Ptr a -> CString -> Ptr GValue -> IO ()

getObjectProperty :: GObject a => a -> String ->
                     (GValue -> IO b) -> GType -> IO b
getObjectProperty :: a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO b
getter GType
gtype = do
  GValue
gvalue <- GType -> IO GValue
newGValue GType
gtype
  a -> (Ptr a -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr a
obj ((Ptr a -> IO ()) -> IO ()) -> (Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr a
objPtr ->
      String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
propName ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
cPropName ->
          GValue -> (Ptr GValue -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr GValue
gvalue ((Ptr GValue -> IO ()) -> IO ()) -> (Ptr GValue -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr GValue
gvalueptr ->
              Ptr a -> CString -> Ptr GValue -> IO ()
forall a. Ptr a -> CString -> Ptr GValue -> IO ()
g_object_get_property Ptr a
objPtr CString
cPropName Ptr GValue
gvalueptr
  GValue -> IO b
getter GValue
gvalue

constructObjectProperty :: String -> b -> (GValue -> b -> IO ()) ->
                           GType -> IO (GValueConstruct o)
constructObjectProperty :: String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName b
propValue GValue -> b -> IO ()
setter GType
gtype = do
  GValue
gvalue <- GType -> (GValue -> b -> IO ()) -> b -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
buildGValue GType
gtype GValue -> b -> IO ()
setter b
propValue
  GValueConstruct o -> IO (GValueConstruct o)
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> GValue -> GValueConstruct o
forall o. String -> GValue -> GValueConstruct o
GValueConstruct String
propName GValue
gvalue)

setObjectPropertyString :: GObject a =>
                           a -> String -> Maybe Text -> IO ()
setObjectPropertyString :: a -> String -> Maybe Text -> IO ()
setObjectPropertyString a
obj String
propName Maybe Text
str =
    a
-> String
-> Maybe Text
-> (GValue -> Maybe Text -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Maybe Text
str GValue -> Maybe Text -> IO ()
set_string GType
gtypeString

constructObjectPropertyString :: String -> Maybe Text ->
                                 IO (GValueConstruct o)
constructObjectPropertyString :: String -> Maybe Text -> IO (GValueConstruct o)
constructObjectPropertyString String
propName Maybe Text
str =
    String
-> Maybe Text
-> (GValue -> Maybe Text -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Maybe Text
str GValue -> Maybe Text -> IO ()
set_string GType
gtypeString

getObjectPropertyString :: GObject a =>
                           a -> String -> IO (Maybe Text)
getObjectPropertyString :: a -> String -> IO (Maybe Text)
getObjectPropertyString a
obj String
propName =
    a
-> String
-> (GValue -> IO (Maybe Text))
-> GType
-> IO (Maybe Text)
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO (Maybe Text)
get_string GType
gtypeString

setObjectPropertyPtr :: GObject a =>
                        a -> String -> Ptr b -> IO ()
setObjectPropertyPtr :: a -> String -> Ptr b -> IO ()
setObjectPropertyPtr a
obj String
propName Ptr b
ptr =
    a
-> String -> Ptr b -> (GValue -> Ptr b -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Ptr b
ptr GValue -> Ptr b -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_pointer GType
gtypePointer

constructObjectPropertyPtr :: String -> Ptr b ->
                              IO (GValueConstruct o)
constructObjectPropertyPtr :: String -> Ptr b -> IO (GValueConstruct o)
constructObjectPropertyPtr String
propName Ptr b
ptr =
    String
-> Ptr b
-> (GValue -> Ptr b -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Ptr b
ptr GValue -> Ptr b -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_pointer GType
gtypePointer

getObjectPropertyPtr :: GObject a =>
                        a -> String -> IO (Ptr b)
getObjectPropertyPtr :: a -> String -> IO (Ptr b)
getObjectPropertyPtr a
obj String
propName =
    a -> String -> (GValue -> IO (Ptr b)) -> GType -> IO (Ptr b)
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO (Ptr b)
forall b. GValue -> IO (Ptr b)
get_pointer GType
gtypePointer

setObjectPropertyInt :: GObject a =>
                         a -> String -> CInt -> IO ()
setObjectPropertyInt :: a -> String -> CInt -> IO ()
setObjectPropertyInt a
obj String
propName CInt
int =
    a -> String -> CInt -> (GValue -> CInt -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName CInt
int GValue -> CInt -> IO ()
set_int GType
gtypeInt

constructObjectPropertyInt :: String -> CInt ->
                              IO (GValueConstruct o)
constructObjectPropertyInt :: String -> CInt -> IO (GValueConstruct o)
constructObjectPropertyInt String
propName CInt
int =
    String
-> CInt
-> (GValue -> CInt -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName CInt
int GValue -> CInt -> IO ()
set_int GType
gtypeInt

getObjectPropertyInt :: GObject a => a -> String -> IO CInt
getObjectPropertyInt :: a -> String -> IO CInt
getObjectPropertyInt a
obj String
propName =
    a -> String -> (GValue -> IO CInt) -> GType -> IO CInt
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO CInt
get_int GType
gtypeInt

setObjectPropertyUInt :: GObject a =>
                          a -> String -> CUInt -> IO ()
setObjectPropertyUInt :: a -> String -> CUInt -> IO ()
setObjectPropertyUInt a
obj String
propName CUInt
uint =
    a
-> String -> CUInt -> (GValue -> CUInt -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName CUInt
uint GValue -> CUInt -> IO ()
set_uint GType
gtypeUInt

constructObjectPropertyUInt :: String -> CUInt ->
                                IO (GValueConstruct o)
constructObjectPropertyUInt :: String -> CUInt -> IO (GValueConstruct o)
constructObjectPropertyUInt String
propName CUInt
uint =
    String
-> CUInt
-> (GValue -> CUInt -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName CUInt
uint GValue -> CUInt -> IO ()
set_uint GType
gtypeUInt

getObjectPropertyUInt :: GObject a => a -> String -> IO CUInt
getObjectPropertyUInt :: a -> String -> IO CUInt
getObjectPropertyUInt a
obj String
propName =
    a -> String -> (GValue -> IO CUInt) -> GType -> IO CUInt
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO CUInt
get_uint GType
gtypeUInt

setObjectPropertyLong :: GObject a =>
                         a -> String -> CLong -> IO ()
setObjectPropertyLong :: a -> String -> CLong -> IO ()
setObjectPropertyLong a
obj String
propName CLong
int =
    a
-> String -> CLong -> (GValue -> CLong -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName CLong
int GValue -> CLong -> IO ()
set_long GType
gtypeLong

constructObjectPropertyLong :: String -> CLong ->
                               IO (GValueConstruct o)
constructObjectPropertyLong :: String -> CLong -> IO (GValueConstruct o)
constructObjectPropertyLong String
propName CLong
int =
    String
-> CLong
-> (GValue -> CLong -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName CLong
int GValue -> CLong -> IO ()
set_long GType
gtypeLong

getObjectPropertyLong :: GObject a => a -> String -> IO CLong
getObjectPropertyLong :: a -> String -> IO CLong
getObjectPropertyLong a
obj String
propName =
    a -> String -> (GValue -> IO CLong) -> GType -> IO CLong
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO CLong
get_long GType
gtypeLong

setObjectPropertyULong :: GObject a =>
                          a -> String -> CULong -> IO ()
setObjectPropertyULong :: a -> String -> CULong -> IO ()
setObjectPropertyULong a
obj String
propName CULong
uint =
    a
-> String
-> CULong
-> (GValue -> CULong -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName CULong
uint GValue -> CULong -> IO ()
set_ulong GType
gtypeULong

constructObjectPropertyULong :: String -> CULong ->
                                IO (GValueConstruct o)
constructObjectPropertyULong :: String -> CULong -> IO (GValueConstruct o)
constructObjectPropertyULong String
propName CULong
uint =
    String
-> CULong
-> (GValue -> CULong -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName CULong
uint GValue -> CULong -> IO ()
set_ulong GType
gtypeULong

getObjectPropertyULong :: GObject a => a -> String -> IO CULong
getObjectPropertyULong :: a -> String -> IO CULong
getObjectPropertyULong a
obj String
propName =
    a -> String -> (GValue -> IO CULong) -> GType -> IO CULong
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO CULong
get_ulong GType
gtypeULong

setObjectPropertyInt32 :: GObject a =>
                          a -> String -> Int32 -> IO ()
setObjectPropertyInt32 :: a -> String -> Int32 -> IO ()
setObjectPropertyInt32 a
obj String
propName Int32
int32 =
    a
-> String -> Int32 -> (GValue -> Int32 -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Int32
int32 GValue -> Int32 -> IO ()
set_int32 GType
gtypeInt

constructObjectPropertyInt32 :: String -> Int32 ->
                                IO (GValueConstruct o)
constructObjectPropertyInt32 :: String -> Int32 -> IO (GValueConstruct o)
constructObjectPropertyInt32 String
propName Int32
int32 =
    String
-> Int32
-> (GValue -> Int32 -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Int32
int32 GValue -> Int32 -> IO ()
set_int32 GType
gtypeInt

getObjectPropertyInt32 :: GObject a => a -> String -> IO Int32
getObjectPropertyInt32 :: a -> String -> IO Int32
getObjectPropertyInt32 a
obj String
propName =
    a -> String -> (GValue -> IO Int32) -> GType -> IO Int32
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO Int32
get_int32 GType
gtypeInt

setObjectPropertyUInt32 :: GObject a =>
                          a -> String -> Word32 -> IO ()
setObjectPropertyUInt32 :: a -> String -> Word32 -> IO ()
setObjectPropertyUInt32 a
obj String
propName Word32
uint32 =
    a
-> String
-> Word32
-> (GValue -> Word32 -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Word32
uint32 GValue -> Word32 -> IO ()
set_uint32 GType
gtypeUInt

constructObjectPropertyUInt32 :: String -> Word32 ->
                                 IO (GValueConstruct o)
constructObjectPropertyUInt32 :: String -> Word32 -> IO (GValueConstruct o)
constructObjectPropertyUInt32 String
propName Word32
uint32 =
    String
-> Word32
-> (GValue -> Word32 -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Word32
uint32 GValue -> Word32 -> IO ()
set_uint32 GType
gtypeUInt

getObjectPropertyUInt32 :: GObject a => a -> String -> IO Word32
getObjectPropertyUInt32 :: a -> String -> IO Word32
getObjectPropertyUInt32 a
obj String
propName =
    a -> String -> (GValue -> IO Word32) -> GType -> IO Word32
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO Word32
get_uint32 GType
gtypeUInt

setObjectPropertyInt64 :: GObject a =>
                          a -> String -> Int64 -> IO ()
setObjectPropertyInt64 :: a -> String -> Int64 -> IO ()
setObjectPropertyInt64 a
obj String
propName Int64
int64 =
    a
-> String -> Int64 -> (GValue -> Int64 -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Int64
int64 GValue -> Int64 -> IO ()
set_int64 GType
gtypeInt64

constructObjectPropertyInt64 :: String -> Int64 ->
                                IO (GValueConstruct o)
constructObjectPropertyInt64 :: String -> Int64 -> IO (GValueConstruct o)
constructObjectPropertyInt64 String
propName Int64
int64 =
    String
-> Int64
-> (GValue -> Int64 -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Int64
int64 GValue -> Int64 -> IO ()
set_int64 GType
gtypeInt64

getObjectPropertyInt64 :: GObject a => a -> String -> IO Int64
getObjectPropertyInt64 :: a -> String -> IO Int64
getObjectPropertyInt64 a
obj String
propName =
    a -> String -> (GValue -> IO Int64) -> GType -> IO Int64
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO Int64
get_int64 GType
gtypeInt64

setObjectPropertyUInt64 :: GObject a =>
                          a -> String -> Word64 -> IO ()
setObjectPropertyUInt64 :: a -> String -> CGType -> IO ()
setObjectPropertyUInt64 a
obj String
propName CGType
uint64 =
    a
-> String
-> CGType
-> (GValue -> CGType -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName CGType
uint64 GValue -> CGType -> IO ()
set_uint64 GType
gtypeUInt64

constructObjectPropertyUInt64 :: String -> Word64 ->
                                 IO (GValueConstruct o)
constructObjectPropertyUInt64 :: String -> CGType -> IO (GValueConstruct o)
constructObjectPropertyUInt64 String
propName CGType
uint64 =
    String
-> CGType
-> (GValue -> CGType -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName CGType
uint64 GValue -> CGType -> IO ()
set_uint64 GType
gtypeUInt64

getObjectPropertyUInt64 :: GObject a => a -> String -> IO Word64
getObjectPropertyUInt64 :: a -> String -> IO CGType
getObjectPropertyUInt64 a
obj String
propName =
    a -> String -> (GValue -> IO CGType) -> GType -> IO CGType
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO CGType
get_uint64 GType
gtypeUInt64

setObjectPropertyFloat :: GObject a =>
                           a -> String -> Float -> IO ()
setObjectPropertyFloat :: a -> String -> Float -> IO ()
setObjectPropertyFloat a
obj String
propName Float
float =
    a
-> String -> Float -> (GValue -> Float -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Float
float GValue -> Float -> IO ()
set_float GType
gtypeFloat

constructObjectPropertyFloat :: String -> Float ->
                                 IO (GValueConstruct o)
constructObjectPropertyFloat :: String -> Float -> IO (GValueConstruct o)
constructObjectPropertyFloat String
propName Float
float =
    String
-> Float
-> (GValue -> Float -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Float
float GValue -> Float -> IO ()
set_float GType
gtypeFloat

getObjectPropertyFloat :: GObject a =>
                           a -> String -> IO Float
getObjectPropertyFloat :: a -> String -> IO Float
getObjectPropertyFloat a
obj String
propName =
    a -> String -> (GValue -> IO Float) -> GType -> IO Float
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO Float
get_float GType
gtypeFloat

setObjectPropertyDouble :: GObject a =>
                            a -> String -> Double -> IO ()
setObjectPropertyDouble :: a -> String -> Double -> IO ()
setObjectPropertyDouble a
obj String
propName Double
double =
    a
-> String
-> Double
-> (GValue -> Double -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Double
double GValue -> Double -> IO ()
set_double GType
gtypeDouble

constructObjectPropertyDouble :: String -> Double ->
                                  IO (GValueConstruct o)
constructObjectPropertyDouble :: String -> Double -> IO (GValueConstruct o)
constructObjectPropertyDouble String
propName Double
double =
    String
-> Double
-> (GValue -> Double -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Double
double GValue -> Double -> IO ()
set_double GType
gtypeDouble

getObjectPropertyDouble :: GObject a =>
                            a -> String -> IO Double
getObjectPropertyDouble :: a -> String -> IO Double
getObjectPropertyDouble a
obj String
propName =
    a -> String -> (GValue -> IO Double) -> GType -> IO Double
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO Double
get_double GType
gtypeDouble

setObjectPropertyBool :: GObject a =>
                         a -> String -> Bool -> IO ()
setObjectPropertyBool :: a -> String -> Bool -> IO ()
setObjectPropertyBool a
obj String
propName Bool
bool =
    a -> String -> Bool -> (GValue -> Bool -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Bool
bool GValue -> Bool -> IO ()
set_boolean GType
gtypeBoolean

constructObjectPropertyBool :: String -> Bool -> IO (GValueConstruct o)
constructObjectPropertyBool :: String -> Bool -> IO (GValueConstruct o)
constructObjectPropertyBool String
propName Bool
bool =
    String
-> Bool
-> (GValue -> Bool -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Bool
bool GValue -> Bool -> IO ()
set_boolean GType
gtypeBoolean

getObjectPropertyBool :: GObject a => a -> String -> IO Bool
getObjectPropertyBool :: a -> String -> IO Bool
getObjectPropertyBool a
obj String
propName =
    a -> String -> (GValue -> IO Bool) -> GType -> IO Bool
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO Bool
get_boolean GType
gtypeBoolean

setObjectPropertyGType :: GObject a =>
                         a -> String -> GType -> IO ()
setObjectPropertyGType :: a -> String -> GType -> IO ()
setObjectPropertyGType a
obj String
propName GType
gtype =
    a
-> String -> GType -> (GValue -> GType -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName GType
gtype GValue -> GType -> IO ()
set_gtype GType
gtypeGType

constructObjectPropertyGType :: String -> GType -> IO (GValueConstruct o)
constructObjectPropertyGType :: String -> GType -> IO (GValueConstruct o)
constructObjectPropertyGType String
propName GType
bool =
    String
-> GType
-> (GValue -> GType -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName GType
bool GValue -> GType -> IO ()
set_gtype GType
gtypeGType

getObjectPropertyGType :: GObject a => a -> String -> IO GType
getObjectPropertyGType :: a -> String -> IO GType
getObjectPropertyGType a
obj String
propName =
    a -> String -> (GValue -> IO GType) -> GType -> IO GType
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO GType
get_gtype GType
gtypeGType

setObjectPropertyObject :: forall a b. (GObject a, GObject b) =>
                           a -> String -> Maybe b -> IO ()
setObjectPropertyObject :: a -> String -> Maybe b -> IO ()
setObjectPropertyObject a
obj String
propName Maybe b
maybeObject = do
  GType
gtype <- TypedObject b => IO GType
forall a. TypedObject a => IO GType
glibType @b
  Maybe b -> (Ptr b -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
Maybe a -> (Ptr a -> IO c) -> IO c
maybeWithManagedPtr Maybe b
maybeObject ((Ptr b -> IO ()) -> IO ()) -> (Ptr b -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr b
objectPtr ->
      a
-> String -> Ptr b -> (GValue -> Ptr b -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Ptr b
objectPtr GValue -> Ptr b -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
set_object GType
gtype

constructObjectPropertyObject :: forall a o. GObject a =>
                                 String -> Maybe a -> IO (GValueConstruct o)
constructObjectPropertyObject :: String -> Maybe a -> IO (GValueConstruct o)
constructObjectPropertyObject String
propName Maybe a
maybeObject = do
  GType
gtype <- TypedObject a => IO GType
forall a. TypedObject a => IO GType
glibType @a
  Maybe a
-> (Ptr a -> IO (GValueConstruct o)) -> IO (GValueConstruct o)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
Maybe a -> (Ptr a -> IO c) -> IO c
maybeWithManagedPtr Maybe a
maybeObject ((Ptr a -> IO (GValueConstruct o)) -> IO (GValueConstruct o))
-> (Ptr a -> IO (GValueConstruct o)) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ \Ptr a
objectPtr ->
      String
-> Ptr a
-> (GValue -> Ptr a -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Ptr a
objectPtr GValue -> Ptr a -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
set_object GType
gtype

getObjectPropertyObject :: forall a b. (GObject a, GObject b) =>
                           a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
getObjectPropertyObject :: a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
getObjectPropertyObject a
obj String
propName ManagedPtr b -> b
constructor = do
  GType
gtype <- TypedObject b => IO GType
forall a. TypedObject a => IO GType
glibType @b
  a -> String -> (GValue -> IO (Maybe b)) -> GType -> IO (Maybe b)
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName
                        (\GValue
val -> (GValue -> IO (Ptr b)
forall b. GObject b => GValue -> IO (Ptr b)
get_object GValue
val :: IO (Ptr b))
                            IO (Ptr b) -> (Ptr b -> IO (Maybe b)) -> IO (Maybe b)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Ptr b -> (Ptr b -> IO b) -> IO (Maybe b))
-> (Ptr b -> IO b) -> Ptr b -> IO (Maybe b)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Ptr b -> (Ptr b -> IO b) -> IO (Maybe b)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull ((ManagedPtr b -> b) -> Ptr b -> IO b
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr b -> b
constructor))
                      GType
gtype

setObjectPropertyBoxed :: forall a b. (GObject a, GBoxed b) =>
                          a -> String -> Maybe b -> IO ()
setObjectPropertyBoxed :: a -> String -> Maybe b -> IO ()
setObjectPropertyBoxed a
obj String
propName Maybe b
maybeBoxed = do
  GType
gtype <- TypedObject b => IO GType
forall a. TypedObject a => IO GType
glibType @b
  Maybe b -> (Ptr b -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
Maybe a -> (Ptr a -> IO c) -> IO c
maybeWithManagedPtr Maybe b
maybeBoxed ((Ptr b -> IO ()) -> IO ()) -> (Ptr b -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr b
boxedPtr ->
        a
-> String -> Ptr b -> (GValue -> Ptr b -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Ptr b
boxedPtr GValue -> Ptr b -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtype

constructObjectPropertyBoxed :: forall a o. (GBoxed a) =>
                                String -> Maybe a -> IO (GValueConstruct o)
constructObjectPropertyBoxed :: String -> Maybe a -> IO (GValueConstruct o)
constructObjectPropertyBoxed String
propName Maybe a
maybeBoxed = do
  GType
gtype <- TypedObject a => IO GType
forall a. TypedObject a => IO GType
glibType @a
  Maybe a
-> (Ptr a -> IO (GValueConstruct o)) -> IO (GValueConstruct o)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
Maybe a -> (Ptr a -> IO c) -> IO c
maybeWithManagedPtr Maybe a
maybeBoxed ((Ptr a -> IO (GValueConstruct o)) -> IO (GValueConstruct o))
-> (Ptr a -> IO (GValueConstruct o)) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ \Ptr a
boxedPtr ->
      String
-> Ptr a
-> (GValue -> Ptr a -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Ptr a
boxedPtr GValue -> Ptr a -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtype

getObjectPropertyBoxed :: forall a b. (GObject a, GBoxed b) =>
                          a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
getObjectPropertyBoxed :: a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
getObjectPropertyBoxed a
obj String
propName ManagedPtr b -> b
constructor = do
  GType
gtype <- TypedObject b => IO GType
forall a. TypedObject a => IO GType
glibType @b
  a -> String -> (GValue -> IO (Maybe b)) -> GType -> IO (Maybe b)
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName (GValue -> IO (Ptr b)
forall b. GValue -> IO (Ptr b)
get_boxed (GValue -> IO (Ptr b))
-> (Ptr b -> IO (Maybe b)) -> GValue -> IO (Maybe b)
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=>
                                  (Ptr b -> (Ptr b -> IO b) -> IO (Maybe b))
-> (Ptr b -> IO b) -> Ptr b -> IO (Maybe b)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Ptr b -> (Ptr b -> IO b) -> IO (Maybe b)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull ((ManagedPtr b -> b) -> Ptr b -> IO b
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr b -> b
constructor))
                    GType
gtype

setObjectPropertyStringArray :: GObject a =>
                                a -> String -> Maybe [Text] -> IO ()
setObjectPropertyStringArray :: a -> String -> Maybe [Text] -> IO ()
setObjectPropertyStringArray a
obj String
propName Maybe [Text]
Nothing =
  a
-> String
-> Ptr Any
-> (GValue -> Ptr Any -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Ptr Any
forall a. Ptr a
nullPtr GValue -> Ptr Any -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypeStrv
setObjectPropertyStringArray a
obj String
propName (Just [Text]
strv) = do
  Ptr CString
cStrv <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
strv
  a
-> String
-> Ptr CString
-> (GValue -> Ptr CString -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Ptr CString
cStrv GValue -> Ptr CString -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypeStrv
  (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
cStrv
  Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
cStrv

constructObjectPropertyStringArray :: String -> Maybe [Text] ->
                                      IO (GValueConstruct o)
constructObjectPropertyStringArray :: String -> Maybe [Text] -> IO (GValueConstruct o)
constructObjectPropertyStringArray String
propName Maybe [Text]
Nothing =
  String
-> Ptr Any
-> (GValue -> Ptr Any -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Ptr Any
forall a. Ptr a
nullPtr GValue -> Ptr Any -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypeStrv
constructObjectPropertyStringArray String
propName (Just [Text]
strv) = do
  Ptr CString
cStrv <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
strv
  GValueConstruct o
result <- String
-> Ptr CString
-> (GValue -> Ptr CString -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Ptr CString
cStrv GValue -> Ptr CString -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypeStrv
  (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
cStrv
  Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
cStrv
  GValueConstruct o -> IO (GValueConstruct o)
forall (m :: * -> *) a. Monad m => a -> m a
return GValueConstruct o
result

getObjectPropertyStringArray :: GObject a => a -> String -> IO (Maybe [Text])
getObjectPropertyStringArray :: a -> String -> IO (Maybe [Text])
getObjectPropertyStringArray a
obj String
propName =
    a
-> String
-> (GValue -> IO (Maybe [Text]))
-> GType
-> IO (Maybe [Text])
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName
                      (GValue -> IO (Ptr CString)
forall b. GValue -> IO (Ptr b)
get_boxed (GValue -> IO (Ptr CString))
-> (Ptr CString -> IO (Maybe [Text]))
-> GValue
-> IO (Maybe [Text])
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=>
                       (Ptr CString -> (Ptr CString -> IO [Text]) -> IO (Maybe [Text]))
-> (Ptr CString -> IO [Text]) -> Ptr CString -> IO (Maybe [Text])
forall a b c. (a -> b -> c) -> b -> a -> c
flip Ptr CString -> (Ptr CString -> IO [Text]) -> IO (Maybe [Text])
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray)
                      GType
gtypeStrv

setObjectPropertyEnum :: forall a b. (GObject a, Enum b, BoxedEnum b) =>
                         a -> String -> b -> IO ()
setObjectPropertyEnum :: a -> String -> b -> IO ()
setObjectPropertyEnum a
obj String
propName b
enum = do
  GType
gtype <- TypedObject b => IO GType
forall a. TypedObject a => IO GType
glibType @b
  let cEnum :: CUInt
cEnum = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (b -> Int) -> b -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Int
forall a. Enum a => a -> Int
fromEnum) b
enum
  a
-> String -> CUInt -> (GValue -> CUInt -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName CUInt
cEnum GValue -> CUInt -> IO ()
set_enum GType
gtype

constructObjectPropertyEnum :: forall a o. (Enum a, BoxedEnum a) =>
                               String -> a -> IO (GValueConstruct o)
constructObjectPropertyEnum :: String -> a -> IO (GValueConstruct o)
constructObjectPropertyEnum String
propName a
enum = do
  GType
gtype <- TypedObject a => IO GType
forall a. TypedObject a => IO GType
glibType @a
  let cEnum :: CUInt
cEnum = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (a -> Int) -> a -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Int
forall a. Enum a => a -> Int
fromEnum) a
enum
  String
-> CUInt
-> (GValue -> CUInt -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName CUInt
cEnum GValue -> CUInt -> IO ()
set_enum GType
gtype

getObjectPropertyEnum :: forall a b. (GObject a,
                                      Enum b, BoxedEnum b) =>
                         a -> String -> IO b
getObjectPropertyEnum :: a -> String -> IO b
getObjectPropertyEnum a
obj String
propName = do
  GType
gtype <- TypedObject b => IO GType
forall a. TypedObject a => IO GType
glibType @b
  a -> String -> (GValue -> IO b) -> GType -> IO b
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName
                    (\GValue
val -> Int -> b
forall a. Enum a => Int -> a
toEnum (Int -> b) -> (CUInt -> Int) -> CUInt -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> b) -> IO CUInt -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GValue -> IO CUInt
get_enum GValue
val)
                    GType
gtype

setObjectPropertyFlags :: forall a b. (IsGFlag b, BoxedFlags b, GObject a) =>
                          a -> String -> [b] -> IO ()
setObjectPropertyFlags :: a -> String -> [b] -> IO ()
setObjectPropertyFlags a
obj String
propName [b]
flags = do
  let cFlags :: CUInt
cFlags = [b] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [b]
flags
  GType
gtype <- TypedObject b => IO GType
forall a. TypedObject a => IO GType
glibType @b
  a
-> String -> CUInt -> (GValue -> CUInt -> IO ()) -> GType -> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName CUInt
cFlags GValue -> CUInt -> IO ()
set_flags GType
gtype

constructObjectPropertyFlags :: forall a o. (IsGFlag a, BoxedFlags a)
                                => String -> [a] -> IO (GValueConstruct o)
constructObjectPropertyFlags :: String -> [a] -> IO (GValueConstruct o)
constructObjectPropertyFlags String
propName [a]
flags = do
  let cFlags :: CUInt
cFlags = [a] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [a]
flags
  GType
gtype <- TypedObject a => IO GType
forall a. TypedObject a => IO GType
glibType @a
  String
-> CUInt
-> (GValue -> CUInt -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName CUInt
cFlags GValue -> CUInt -> IO ()
set_flags GType
gtype

getObjectPropertyFlags :: forall a b. (GObject a, IsGFlag b, BoxedFlags b) =>
                          a -> String -> IO [b]
getObjectPropertyFlags :: a -> String -> IO [b]
getObjectPropertyFlags a
obj String
propName = do
  GType
gtype <- TypedObject b => IO GType
forall a. TypedObject a => IO GType
glibType @b
  a -> String -> (GValue -> IO [b]) -> GType -> IO [b]
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName
                        (\GValue
val -> CUInt -> [b]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags (CUInt -> [b]) -> IO CUInt -> IO [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GValue -> IO CUInt
get_flags GValue
val)
                        GType
gtype

setObjectPropertyClosure :: forall a b. GObject a =>
                          a -> String -> Maybe (GClosure b) -> IO ()
setObjectPropertyClosure :: a -> String -> Maybe (GClosure b) -> IO ()
setObjectPropertyClosure = a -> String -> Maybe (GClosure b) -> IO ()
forall a b.
(GObject a, GBoxed b) =>
a -> String -> Maybe b -> IO ()
setObjectPropertyBoxed

constructObjectPropertyClosure :: String -> Maybe (GClosure a) -> IO (GValueConstruct o)
constructObjectPropertyClosure :: String -> Maybe (GClosure a) -> IO (GValueConstruct o)
constructObjectPropertyClosure = String -> Maybe (GClosure a) -> IO (GValueConstruct o)
forall a o. GBoxed a => String -> Maybe a -> IO (GValueConstruct o)
constructObjectPropertyBoxed

getObjectPropertyClosure :: forall a b. GObject a =>
                            a -> String -> IO (Maybe (GClosure b))
getObjectPropertyClosure :: a -> String -> IO (Maybe (GClosure b))
getObjectPropertyClosure a
obj String
propName =
  a
-> String
-> (ManagedPtr (GClosure b) -> GClosure b)
-> IO (Maybe (GClosure b))
forall a b.
(GObject a, GBoxed b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
getObjectPropertyBoxed a
obj String
propName ManagedPtr (GClosure b) -> GClosure b
forall a. ManagedPtr (GClosure a) -> GClosure a
GClosure

setObjectPropertyVariant :: GObject a =>
                            a -> String -> Maybe GVariant -> IO ()
setObjectPropertyVariant :: a -> String -> Maybe GVariant -> IO ()
setObjectPropertyVariant a
obj String
propName Maybe GVariant
maybeVariant =
    Maybe GVariant -> (Ptr GVariant -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
Maybe a -> (Ptr a -> IO c) -> IO c
maybeWithManagedPtr Maybe GVariant
maybeVariant ((Ptr GVariant -> IO ()) -> IO ())
-> (Ptr GVariant -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr GVariant
variantPtr ->
        a
-> String
-> Ptr GVariant
-> (GValue -> Ptr GVariant -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Ptr GVariant
variantPtr GValue -> Ptr GVariant -> IO ()
set_variant GType
gtypeVariant

constructObjectPropertyVariant :: String -> Maybe GVariant
                               -> IO (GValueConstruct o)
constructObjectPropertyVariant :: String -> Maybe GVariant -> IO (GValueConstruct o)
constructObjectPropertyVariant String
propName Maybe GVariant
maybeVariant =
    Maybe GVariant
-> (Ptr GVariant -> IO (GValueConstruct o))
-> IO (GValueConstruct o)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
Maybe a -> (Ptr a -> IO c) -> IO c
maybeWithManagedPtr Maybe GVariant
maybeVariant ((Ptr GVariant -> IO (GValueConstruct o))
 -> IO (GValueConstruct o))
-> (Ptr GVariant -> IO (GValueConstruct o))
-> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ \Ptr GVariant
objPtr ->
        String
-> Ptr GVariant
-> (GValue -> Ptr GVariant -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Ptr GVariant
objPtr GValue -> Ptr GVariant -> IO ()
set_variant GType
gtypeVariant

getObjectPropertyVariant :: GObject a => a -> String ->
                            IO (Maybe GVariant)
getObjectPropertyVariant :: a -> String -> IO (Maybe GVariant)
getObjectPropertyVariant a
obj String
propName =
    a
-> String
-> (GValue -> IO (Maybe GVariant))
-> GType
-> IO (Maybe GVariant)
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName (GValue -> IO (Ptr GVariant)
get_variant (GValue -> IO (Ptr GVariant))
-> (Ptr GVariant -> IO (Maybe GVariant))
-> GValue
-> IO (Maybe GVariant)
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=>
                                    (Ptr GVariant
 -> (Ptr GVariant -> IO GVariant) -> IO (Maybe GVariant))
-> (Ptr GVariant -> IO GVariant)
-> Ptr GVariant
-> IO (Maybe GVariant)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Ptr GVariant
-> (Ptr GVariant -> IO GVariant) -> IO (Maybe GVariant)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr GVariant -> IO GVariant
newGVariantFromPtr)
                      GType
gtypeVariant

setObjectPropertyByteArray :: GObject a =>
                              a -> String -> Maybe B.ByteString -> IO ()
setObjectPropertyByteArray :: a -> String -> Maybe ByteString -> IO ()
setObjectPropertyByteArray a
obj String
propName Maybe ByteString
Nothing =
    a
-> String
-> Ptr Any
-> (GValue -> Ptr Any -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Ptr Any
forall a. Ptr a
nullPtr GValue -> Ptr Any -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypeByteArray
setObjectPropertyByteArray a
obj String
propName (Just ByteString
bytes) = do
  Ptr GByteArray
packed <- ByteString -> IO (Ptr GByteArray)
packGByteArray ByteString
bytes
  a
-> String
-> Ptr GByteArray
-> (GValue -> Ptr GByteArray -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Ptr GByteArray
packed GValue -> Ptr GByteArray -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypeByteArray
  Ptr GByteArray -> IO ()
unrefGByteArray Ptr GByteArray
packed

constructObjectPropertyByteArray :: String -> Maybe B.ByteString ->
                                    IO (GValueConstruct o)
constructObjectPropertyByteArray :: String -> Maybe ByteString -> IO (GValueConstruct o)
constructObjectPropertyByteArray String
propName Maybe ByteString
Nothing =
    String
-> Ptr Any
-> (GValue -> Ptr Any -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Ptr Any
forall a. Ptr a
nullPtr GValue -> Ptr Any -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypeByteArray
constructObjectPropertyByteArray String
propName (Just ByteString
bytes) = do
  Ptr GByteArray
packed <- ByteString -> IO (Ptr GByteArray)
packGByteArray ByteString
bytes
  GValueConstruct o
result <- String
-> Ptr GByteArray
-> (GValue -> Ptr GByteArray -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Ptr GByteArray
packed GValue -> Ptr GByteArray -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypeByteArray
  Ptr GByteArray -> IO ()
unrefGByteArray Ptr GByteArray
packed
  GValueConstruct o -> IO (GValueConstruct o)
forall (m :: * -> *) a. Monad m => a -> m a
return GValueConstruct o
result

getObjectPropertyByteArray :: GObject a =>
                              a -> String -> IO (Maybe B.ByteString)
getObjectPropertyByteArray :: a -> String -> IO (Maybe ByteString)
getObjectPropertyByteArray a
obj String
propName =
    a
-> String
-> (GValue -> IO (Maybe ByteString))
-> GType
-> IO (Maybe ByteString)
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName (GValue -> IO (Ptr GByteArray)
forall b. GValue -> IO (Ptr b)
get_boxed (GValue -> IO (Ptr GByteArray))
-> (Ptr GByteArray -> IO (Maybe ByteString))
-> GValue
-> IO (Maybe ByteString)
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=>
                                    (Ptr GByteArray
 -> (Ptr GByteArray -> IO ByteString) -> IO (Maybe ByteString))
-> (Ptr GByteArray -> IO ByteString)
-> Ptr GByteArray
-> IO (Maybe ByteString)
forall a b c. (a -> b -> c) -> b -> a -> c
flip Ptr GByteArray
-> (Ptr GByteArray -> IO ByteString) -> IO (Maybe ByteString)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr GByteArray -> IO ByteString
unpackGByteArray)
                      GType
gtypeByteArray

setObjectPropertyPtrGList :: GObject a =>
                              a -> String -> [Ptr b] -> IO ()
setObjectPropertyPtrGList :: a -> String -> [Ptr b] -> IO ()
setObjectPropertyPtrGList a
obj String
propName [Ptr b]
ptrs = do
  Ptr (GList (Ptr b))
packed <- [Ptr b] -> IO (Ptr (GList (Ptr b)))
forall a. [Ptr a] -> IO (Ptr (GList (Ptr a)))
packGList [Ptr b]
ptrs
  a
-> String
-> Ptr (GList (Ptr b))
-> (GValue -> Ptr (GList (Ptr b)) -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName Ptr (GList (Ptr b))
packed GValue -> Ptr (GList (Ptr b)) -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypePointer
  Ptr (GList (Ptr b)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr b))
packed

constructObjectPropertyPtrGList :: String -> [Ptr a] ->
                                    IO (GValueConstruct o)
constructObjectPropertyPtrGList :: String -> [Ptr a] -> IO (GValueConstruct o)
constructObjectPropertyPtrGList String
propName [Ptr a]
ptrs = do
  Ptr (GList (Ptr a))
packed <- [Ptr a] -> IO (Ptr (GList (Ptr a)))
forall a. [Ptr a] -> IO (Ptr (GList (Ptr a)))
packGList [Ptr a]
ptrs
  GValueConstruct o
result <- String
-> Ptr (GList (Ptr a))
-> (GValue -> Ptr (GList (Ptr a)) -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName Ptr (GList (Ptr a))
packed GValue -> Ptr (GList (Ptr a)) -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_boxed GType
gtypePointer
  Ptr (GList (Ptr a)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr a))
packed
  GValueConstruct o -> IO (GValueConstruct o)
forall (m :: * -> *) a. Monad m => a -> m a
return GValueConstruct o
result

getObjectPropertyPtrGList :: GObject a =>
                              a -> String -> IO [Ptr b]
getObjectPropertyPtrGList :: a -> String -> IO [Ptr b]
getObjectPropertyPtrGList a
obj String
propName =
    a -> String -> (GValue -> IO [Ptr b]) -> GType -> IO [Ptr b]
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName (GValue -> IO (Ptr (GList (Ptr b)))
forall b. GValue -> IO (Ptr b)
get_pointer (GValue -> IO (Ptr (GList (Ptr b))))
-> (Ptr (GList (Ptr b)) -> IO [Ptr b]) -> GValue -> IO [Ptr b]
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> Ptr (GList (Ptr b)) -> IO [Ptr b]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList) GType
gtypePointer

setObjectPropertyHash :: GObject a => a -> String -> b -> IO ()
setObjectPropertyHash :: a -> String -> b -> IO ()
setObjectPropertyHash =
    String -> a -> String -> b -> IO ()
forall a. HasCallStack => String -> a
error (String -> a -> String -> b -> IO ())
-> String -> a -> String -> b -> IO ()
forall a b. (a -> b) -> a -> b
$ String
"Setting GHashTable properties not supported yet."

constructObjectPropertyHash :: String -> b -> IO (GValueConstruct o)
constructObjectPropertyHash :: String -> b -> IO (GValueConstruct o)
constructObjectPropertyHash =
    String -> String -> b -> IO (GValueConstruct o)
forall a. HasCallStack => String -> a
error (String -> String -> b -> IO (GValueConstruct o))
-> String -> String -> b -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String
"Constructing GHashTable properties not supported yet."

getObjectPropertyHash :: GObject a => a -> String -> IO b
getObjectPropertyHash :: a -> String -> IO b
getObjectPropertyHash =
    String -> a -> String -> IO b
forall a. HasCallStack => String -> a
error (String -> a -> String -> IO b) -> String -> a -> String -> IO b
forall a b. (a -> b) -> a -> b
$ String
"Getting GHashTable properties not supported yet."

setObjectPropertyCallback :: GObject a => a -> String -> FunPtr b -> IO ()
setObjectPropertyCallback :: a -> String -> FunPtr b -> IO ()
setObjectPropertyCallback a
obj String
propName FunPtr b
funPtr =
    a
-> String
-> Ptr Any
-> (GValue -> Ptr Any -> IO ())
-> GType
-> IO ()
forall a b.
GObject a =>
a -> String -> b -> (GValue -> b -> IO ()) -> GType -> IO ()
setObjectProperty a
obj String
propName (FunPtr b -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr b
funPtr) GValue -> Ptr Any -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_pointer GType
gtypePointer

constructObjectPropertyCallback :: String -> FunPtr b -> IO (GValueConstruct o)
constructObjectPropertyCallback :: String -> FunPtr b -> IO (GValueConstruct o)
constructObjectPropertyCallback String
propName FunPtr b
funPtr =
  String
-> Ptr Any
-> (GValue -> Ptr Any -> IO ())
-> GType
-> IO (GValueConstruct o)
forall b o.
String
-> b -> (GValue -> b -> IO ()) -> GType -> IO (GValueConstruct o)
constructObjectProperty String
propName (FunPtr b -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr b
funPtr) GValue -> Ptr Any -> IO ()
forall a. GValue -> Ptr a -> IO ()
set_pointer GType
gtypePointer

getObjectPropertyCallback :: GObject a => a -> String ->
                             (FunPtr b -> c) -> IO (Maybe c)
getObjectPropertyCallback :: a -> String -> (FunPtr b -> c) -> IO (Maybe c)
getObjectPropertyCallback a
obj String
propName FunPtr b -> c
wrapper = do
  Ptr Any
ptr <- a -> String -> (GValue -> IO (Ptr Any)) -> GType -> IO (Ptr Any)
forall a b.
GObject a =>
a -> String -> (GValue -> IO b) -> GType -> IO b
getObjectProperty a
obj String
propName GValue -> IO (Ptr Any)
forall b. GValue -> IO (Ptr b)
get_pointer GType
gtypePointer
  if Ptr Any
ptr Ptr Any -> Ptr Any -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Any
forall a. Ptr a
nullPtr
    then Maybe c -> IO (Maybe c)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe c -> IO (Maybe c))
-> (FunPtr b -> Maybe c) -> FunPtr b -> IO (Maybe c)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> Maybe c
forall a. a -> Maybe a
Just (c -> Maybe c) -> (FunPtr b -> c) -> FunPtr b -> Maybe c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FunPtr b -> c
wrapper (FunPtr b -> IO (Maybe c)) -> FunPtr b -> IO (Maybe c)
forall a b. (a -> b) -> a -> b
$ Ptr Any -> FunPtr b
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
ptr
    else Maybe c -> IO (Maybe c)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe c
forall a. Maybe a
Nothing

-- | Set a property of type `GError`.
setObjectPropertyGError :: forall a. GObject a =>
                          a -> String -> Maybe GError -> IO ()
setObjectPropertyGError :: a -> String -> Maybe GError -> IO ()
setObjectPropertyGError = a -> String -> Maybe GError -> IO ()
forall a b.
(GObject a, GBoxed b) =>
a -> String -> Maybe b -> IO ()
setObjectPropertyBoxed

-- | Construct a property of type `GError`.
constructObjectPropertyGError :: String -> Maybe GError -> IO (GValueConstruct o)
constructObjectPropertyGError :: String -> Maybe GError -> IO (GValueConstruct o)
constructObjectPropertyGError = String -> Maybe GError -> IO (GValueConstruct o)
forall a o. GBoxed a => String -> Maybe a -> IO (GValueConstruct o)
constructObjectPropertyBoxed

-- | Get the value of a property of type `GError`.
getObjectPropertyGError :: forall a. GObject a =>
                            a -> String -> IO (Maybe GError)
getObjectPropertyGError :: a -> String -> IO (Maybe GError)
getObjectPropertyGError a
obj String
propName =
  a -> String -> (ManagedPtr GError -> GError) -> IO (Maybe GError)
forall a b.
(GObject a, GBoxed b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
getObjectPropertyBoxed a
obj String
propName ManagedPtr GError -> GError
GError

-- | Set a property of type `GValue`.
setObjectPropertyGValue :: forall a. GObject a =>
                           a -> String -> Maybe GValue -> IO ()
setObjectPropertyGValue :: a -> String -> Maybe GValue -> IO ()
setObjectPropertyGValue = a -> String -> Maybe GValue -> IO ()
forall a b.
(GObject a, GBoxed b) =>
a -> String -> Maybe b -> IO ()
setObjectPropertyBoxed

-- | Construct a property of type `GValue`.
constructObjectPropertyGValue :: String -> Maybe GValue -> IO (GValueConstruct o)
constructObjectPropertyGValue :: String -> Maybe GValue -> IO (GValueConstruct o)
constructObjectPropertyGValue = String -> Maybe GValue -> IO (GValueConstruct o)
forall a o. GBoxed a => String -> Maybe a -> IO (GValueConstruct o)
constructObjectPropertyBoxed

-- | Get the value of a property of type `GValue`.
getObjectPropertyGValue :: forall a. GObject a =>
                           a -> String -> IO (Maybe GValue)
getObjectPropertyGValue :: a -> String -> IO (Maybe GValue)
getObjectPropertyGValue a
obj String
propName =
  a -> String -> (ManagedPtr GValue -> GValue) -> IO (Maybe GValue)
forall a b.
(GObject a, GBoxed b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
getObjectPropertyBoxed a
obj String
propName ManagedPtr GValue -> GValue
GValue