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

module GI.Gtk.Objects.Builder
    ( 

-- * Exported types
    Builder(..)                             ,
    BuilderK                                ,
    toBuilder                               ,
    noBuilder                               ,


 -- * Methods
-- ** builderAddCallbackSymbol
    builderAddCallbackSymbol                ,


-- ** builderAddFromFile
    builderAddFromFile                      ,


-- ** builderAddFromResource
    builderAddFromResource                  ,


-- ** builderAddFromString
    builderAddFromString                    ,


-- ** builderAddObjectsFromFile
    builderAddObjectsFromFile               ,


-- ** builderAddObjectsFromResource
    builderAddObjectsFromResource           ,


-- ** builderAddObjectsFromString
    builderAddObjectsFromString             ,


-- ** builderConnectSignals
    builderConnectSignals                   ,


-- ** builderConnectSignalsFull
    builderConnectSignalsFull               ,


-- ** builderExposeObject
    builderExposeObject                     ,


-- ** builderGetApplication
    builderGetApplication                   ,


-- ** builderGetObject
    builderGetObject                        ,


-- ** builderGetObjects
    builderGetObjects                       ,


-- ** builderGetTranslationDomain
    builderGetTranslationDomain             ,


-- ** builderGetTypeFromName
    builderGetTypeFromName                  ,


-- ** builderNew
    builderNew                              ,


-- ** builderNewFromFile
    builderNewFromFile                      ,


-- ** builderNewFromResource
    builderNewFromResource                  ,


-- ** builderNewFromString
    builderNewFromString                    ,


-- ** builderSetApplication
    builderSetApplication                   ,


-- ** builderSetTranslationDomain
    builderSetTranslationDomain             ,


-- ** builderValueFromString
    builderValueFromString                  ,


-- ** builderValueFromStringType
    builderValueFromStringType              ,




 -- * Properties
-- ** TranslationDomain
    BuilderTranslationDomainPropertyInfo    ,
    constructBuilderTranslationDomain       ,
    getBuilderTranslationDomain             ,
    setBuilderTranslationDomain             ,




    ) 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.Gtk.Types
import GI.Gtk.Callbacks
import qualified GI.GObject as GObject

newtype Builder = Builder (ForeignPtr Builder)
foreign import ccall "gtk_builder_get_type"
    c_gtk_builder_get_type :: IO GType

type instance ParentTypes Builder = BuilderParentTypes
type BuilderParentTypes = '[GObject.Object]

instance GObject Builder where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_builder_get_type
    

class GObject o => BuilderK o
instance (GObject o, IsDescendantOf Builder o) => BuilderK o

toBuilder :: BuilderK o => o -> IO Builder
toBuilder = unsafeCastTo Builder

noBuilder :: Maybe Builder
noBuilder = Nothing

-- VVV Prop "translation-domain"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]

getBuilderTranslationDomain :: (MonadIO m, BuilderK o) => o -> m T.Text
getBuilderTranslationDomain obj = liftIO $ getObjectPropertyString obj "translation-domain"

setBuilderTranslationDomain :: (MonadIO m, BuilderK o) => o -> T.Text -> m ()
setBuilderTranslationDomain obj val = liftIO $ setObjectPropertyString obj "translation-domain" val

constructBuilderTranslationDomain :: T.Text -> IO ([Char], GValue)
constructBuilderTranslationDomain val = constructObjectPropertyString "translation-domain" val

data BuilderTranslationDomainPropertyInfo
instance AttrInfo BuilderTranslationDomainPropertyInfo where
    type AttrAllowedOps BuilderTranslationDomainPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint BuilderTranslationDomainPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint BuilderTranslationDomainPropertyInfo = BuilderK
    type AttrGetType BuilderTranslationDomainPropertyInfo = T.Text
    type AttrLabel BuilderTranslationDomainPropertyInfo = "Builder::translation-domain"
    attrGet _ = getBuilderTranslationDomain
    attrSet _ = setBuilderTranslationDomain
    attrConstruct _ = constructBuilderTranslationDomain

type instance AttributeList Builder = BuilderAttributeList
type BuilderAttributeList = ('[ '("translation-domain", BuilderTranslationDomainPropertyInfo)] :: [(Symbol, *)])

type instance SignalList Builder = BuilderSignalList
type BuilderSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Builder::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gtk" "Builder"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_new" gtk_builder_new :: 
    IO (Ptr Builder)


builderNew ::
    (MonadIO m) =>
    m Builder
builderNew  = liftIO $ do
    result <- gtk_builder_new
    checkUnexpectedReturnNULL "gtk_builder_new" result
    result' <- (wrapObject Builder) result
    return result'

-- method Builder::new_from_file
-- method type : Constructor
-- Args : [Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "Builder"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_new_from_file" gtk_builder_new_from_file :: 
    CString ->                              -- filename : TBasicType TUTF8
    IO (Ptr Builder)


builderNewFromFile ::
    (MonadIO m) =>
    T.Text ->                               -- filename
    m Builder
builderNewFromFile filename = liftIO $ do
    filename' <- textToCString filename
    result <- gtk_builder_new_from_file filename'
    checkUnexpectedReturnNULL "gtk_builder_new_from_file" result
    result' <- (wrapObject Builder) result
    freeMem filename'
    return result'

-- method Builder::new_from_resource
-- method type : Constructor
-- Args : [Arg {argName = "resource_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "resource_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "Builder"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_new_from_resource" gtk_builder_new_from_resource :: 
    CString ->                              -- resource_path : TBasicType TUTF8
    IO (Ptr Builder)


builderNewFromResource ::
    (MonadIO m) =>
    T.Text ->                               -- resource_path
    m Builder
builderNewFromResource resource_path = liftIO $ do
    resource_path' <- textToCString resource_path
    result <- gtk_builder_new_from_resource resource_path'
    checkUnexpectedReturnNULL "gtk_builder_new_from_resource" result
    result' <- (wrapObject Builder) result
    freeMem resource_path'
    return result'

-- method Builder::new_from_string
-- method type : Constructor
-- Args : [Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "Builder"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_new_from_string" gtk_builder_new_from_string :: 
    CString ->                              -- string : TBasicType TUTF8
    Int64 ->                                -- length : TBasicType TInt64
    IO (Ptr Builder)


builderNewFromString ::
    (MonadIO m) =>
    T.Text ->                               -- string
    Int64 ->                                -- length
    m Builder
builderNewFromString string length_ = liftIO $ do
    string' <- textToCString string
    result <- gtk_builder_new_from_string string' length_
    checkUnexpectedReturnNULL "gtk_builder_new_from_string" result
    result' <- (wrapObject Builder) result
    freeMem string'
    return result'

-- method Builder::add_callback_symbol
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_symbol", argType = TInterface "GObject" "Callback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_symbol", argType = TInterface "GObject" "Callback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_add_callback_symbol" gtk_builder_add_callback_symbol :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- callback_name : TBasicType TUTF8
    FunPtr GObject.CallbackC ->             -- callback_symbol : TInterface "GObject" "Callback"
    IO ()


builderAddCallbackSymbol ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- callback_name
    GObject.Callback ->                     -- callback_symbol
    m ()
builderAddCallbackSymbol _obj callback_name callback_symbol = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    callback_name' <- textToCString callback_name
    ptrcallback_symbol <- callocMem :: IO (Ptr (FunPtr GObject.CallbackC))
    callback_symbol' <- GObject.mkCallback (GObject.callbackWrapper (Just ptrcallback_symbol) callback_symbol)
    poke ptrcallback_symbol callback_symbol'
    gtk_builder_add_callback_symbol _obj' callback_name' callback_symbol'
    touchManagedPtr _obj
    freeMem callback_name'
    return ()

-- method Builder::add_from_file
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_from_file" gtk_builder_add_from_file :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- filename : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO Word32


builderAddFromFile ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- filename
    m Word32
builderAddFromFile _obj filename = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    filename' <- textToCString filename
    onException (do
        result <- propagateGError $ gtk_builder_add_from_file _obj' filename'
        touchManagedPtr _obj
        freeMem filename'
        return result
     ) (do
        freeMem filename'
     )

-- method Builder::add_from_resource
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "resource_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "resource_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_from_resource" gtk_builder_add_from_resource :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- resource_path : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO Word32


builderAddFromResource ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- resource_path
    m Word32
builderAddFromResource _obj resource_path = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    resource_path' <- textToCString resource_path
    onException (do
        result <- propagateGError $ gtk_builder_add_from_resource _obj' resource_path'
        touchManagedPtr _obj
        freeMem resource_path'
        return result
     ) (do
        freeMem resource_path'
     )

-- method Builder::add_from_string
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "buffer", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "buffer", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_from_string" gtk_builder_add_from_string :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- buffer : TBasicType TUTF8
    Word64 ->                               -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO Word32


builderAddFromString ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- buffer
    Word64 ->                               -- length
    m Word32
builderAddFromString _obj buffer length_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    buffer' <- textToCString buffer
    onException (do
        result <- propagateGError $ gtk_builder_add_from_string _obj' buffer' length_
        touchManagedPtr _obj
        freeMem buffer'
        return result
     ) (do
        freeMem buffer'
     )

-- method Builder::add_objects_from_file
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_ids", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_ids", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_objects_from_file" gtk_builder_add_objects_from_file :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- filename : TBasicType TUTF8
    Ptr CString ->                          -- object_ids : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO Word32


builderAddObjectsFromFile ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- filename
    [T.Text] ->                             -- object_ids
    m Word32
builderAddObjectsFromFile _obj filename object_ids = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    filename' <- textToCString filename
    object_ids' <- packZeroTerminatedUTF8CArray object_ids
    onException (do
        result <- propagateGError $ gtk_builder_add_objects_from_file _obj' filename' object_ids'
        touchManagedPtr _obj
        freeMem filename'
        mapZeroTerminatedCArray freeMem object_ids'
        freeMem object_ids'
        return result
     ) (do
        freeMem filename'
        mapZeroTerminatedCArray freeMem object_ids'
        freeMem object_ids'
     )

-- method Builder::add_objects_from_resource
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "resource_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_ids", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "resource_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_ids", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_objects_from_resource" gtk_builder_add_objects_from_resource :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- resource_path : TBasicType TUTF8
    Ptr CString ->                          -- object_ids : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO Word32


builderAddObjectsFromResource ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- resource_path
    [T.Text] ->                             -- object_ids
    m Word32
builderAddObjectsFromResource _obj resource_path object_ids = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    resource_path' <- textToCString resource_path
    object_ids' <- packZeroTerminatedUTF8CArray object_ids
    onException (do
        result <- propagateGError $ gtk_builder_add_objects_from_resource _obj' resource_path' object_ids'
        touchManagedPtr _obj
        freeMem resource_path'
        mapZeroTerminatedCArray freeMem object_ids'
        freeMem object_ids'
        return result
     ) (do
        freeMem resource_path'
        mapZeroTerminatedCArray freeMem object_ids'
        freeMem object_ids'
     )

-- method Builder::add_objects_from_string
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "buffer", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_ids", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "buffer", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object_ids", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_objects_from_string" gtk_builder_add_objects_from_string :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- buffer : TBasicType TUTF8
    Word64 ->                               -- length : TBasicType TUInt64
    Ptr CString ->                          -- object_ids : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO Word32


builderAddObjectsFromString ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- buffer
    Word64 ->                               -- length
    [T.Text] ->                             -- object_ids
    m Word32
builderAddObjectsFromString _obj buffer length_ object_ids = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    buffer' <- textToCString buffer
    object_ids' <- packZeroTerminatedUTF8CArray object_ids
    onException (do
        result <- propagateGError $ gtk_builder_add_objects_from_string _obj' buffer' length_ object_ids'
        touchManagedPtr _obj
        freeMem buffer'
        mapZeroTerminatedCArray freeMem object_ids'
        freeMem object_ids'
        return result
     ) (do
        freeMem buffer'
        mapZeroTerminatedCArray freeMem object_ids'
        freeMem object_ids'
     )

-- method Builder::connect_signals
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_connect_signals" gtk_builder_connect_signals :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


builderConnectSignals ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    Ptr () ->                               -- user_data
    m ()
builderConnectSignals _obj user_data = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_builder_connect_signals _obj' user_data
    touchManagedPtr _obj
    return ()

-- method Builder::connect_signals_full
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "Gtk" "BuilderConnectFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "Gtk" "BuilderConnectFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeCall, argClosure = 2, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_connect_signals_full" gtk_builder_connect_signals_full :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    FunPtr BuilderConnectFuncC ->           -- func : TInterface "Gtk" "BuilderConnectFunc"
    Ptr () ->                               -- user_data : TBasicType TVoid
    IO ()


builderConnectSignalsFull ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    BuilderConnectFunc ->                   -- func
    m ()
builderConnectSignalsFull _obj func = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    func' <- mkBuilderConnectFunc (builderConnectFuncWrapper Nothing func)
    let user_data = nullPtr
    gtk_builder_connect_signals_full _obj' func' user_data
    safeFreeFunPtr $ castFunPtrToPtr func'
    touchManagedPtr _obj
    return ()

-- method Builder::expose_object
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_expose_object" gtk_builder_expose_object :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- name : TBasicType TUTF8
    Ptr GObject.Object ->                   -- object : TInterface "GObject" "Object"
    IO ()


builderExposeObject ::
    (MonadIO m, BuilderK a, GObject.ObjectK b) =>
    a ->                                    -- _obj
    T.Text ->                               -- name
    b ->                                    -- object
    m ()
builderExposeObject _obj name object = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    name' <- textToCString name
    let object' = unsafeManagedPtrCastPtr object
    gtk_builder_expose_object _obj' name' object'
    touchManagedPtr _obj
    touchManagedPtr object
    freeMem name'
    return ()

-- method Builder::get_application
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "Application"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_application" gtk_builder_get_application :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    IO (Ptr Application)


builderGetApplication ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    m Application
builderGetApplication _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_builder_get_application _obj'
    checkUnexpectedReturnNULL "gtk_builder_get_application" result
    result' <- (newObject Application) result
    touchManagedPtr _obj
    return result'

-- method Builder::get_object
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GObject" "Object"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_object" gtk_builder_get_object :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr GObject.Object)


builderGetObject ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- name
    m GObject.Object
builderGetObject _obj name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    name' <- textToCString name
    result <- gtk_builder_get_object _obj' name'
    checkUnexpectedReturnNULL "gtk_builder_get_object" result
    result' <- (newObject GObject.Object) result
    touchManagedPtr _obj
    freeMem name'
    return result'

-- method Builder::get_objects
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGSList (TInterface "GObject" "Object")
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_objects" gtk_builder_get_objects :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    IO (Ptr (GSList (Ptr GObject.Object)))


builderGetObjects ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    m [GObject.Object]
builderGetObjects _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_builder_get_objects _obj'
    checkUnexpectedReturnNULL "gtk_builder_get_objects" result
    result' <- unpackGSList result
    result'' <- mapM (newObject GObject.Object) result'
    g_slist_free result
    touchManagedPtr _obj
    return result''

-- method Builder::get_translation_domain
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_translation_domain" gtk_builder_get_translation_domain :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    IO CString


builderGetTranslationDomain ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    m T.Text
builderGetTranslationDomain _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_builder_get_translation_domain _obj'
    checkUnexpectedReturnNULL "gtk_builder_get_translation_domain" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method Builder::get_type_from_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TGType
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_type_from_name" gtk_builder_get_type_from_name :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- type_name : TBasicType TUTF8
    IO CGType


builderGetTypeFromName ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- type_name
    m GType
builderGetTypeFromName _obj type_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    type_name' <- textToCString type_name
    result <- gtk_builder_get_type_from_name _obj' type_name'
    let result' = GType result
    touchManagedPtr _obj
    freeMem type_name'
    return result'

-- method Builder::set_application
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "application", argType = TInterface "Gtk" "Application", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "application", argType = TInterface "Gtk" "Application", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_set_application" gtk_builder_set_application :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    Ptr Application ->                      -- application : TInterface "Gtk" "Application"
    IO ()


builderSetApplication ::
    (MonadIO m, BuilderK a, ApplicationK b) =>
    a ->                                    -- _obj
    b ->                                    -- application
    m ()
builderSetApplication _obj application = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let application' = unsafeManagedPtrCastPtr application
    gtk_builder_set_application _obj' application'
    touchManagedPtr _obj
    touchManagedPtr application
    return ()

-- method Builder::set_translation_domain
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_set_translation_domain" gtk_builder_set_translation_domain :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CString ->                              -- domain : TBasicType TUTF8
    IO ()


builderSetTranslationDomain ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- domain
    m ()
builderSetTranslationDomain _obj domain = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeDomain <- case domain of
        Nothing -> return nullPtr
        Just jDomain -> do
            jDomain' <- textToCString jDomain
            return jDomain'
    gtk_builder_set_translation_domain _obj' maybeDomain
    touchManagedPtr _obj
    freeMem maybeDomain
    return ()

-- method Builder::value_from_string
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_value_from_string" gtk_builder_value_from_string :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    CString ->                              -- string : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface "GObject" "Value"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


builderValueFromString ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    GParamSpec ->                           -- pspec
    T.Text ->                               -- string
    m (GValue)
builderValueFromString _obj pspec string = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let pspec' = unsafeManagedPtrGetPtr pspec
    string' <- textToCString string
    value <- callocBoxedBytes 24 :: IO (Ptr GValue)
    onException (do
        _ <- propagateGError $ gtk_builder_value_from_string _obj' pspec' string' value
        value' <- (wrapBoxed GValue) value
        touchManagedPtr _obj
        freeMem string'
        return value'
     ) (do
        freeMem string'
        freeMem value
     )

-- method Builder::value_from_string_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Builder", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_value_from_string_type" gtk_builder_value_from_string_type :: 
    Ptr Builder ->                          -- _obj : TInterface "Gtk" "Builder"
    CGType ->                               -- type : TBasicType TGType
    CString ->                              -- string : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface "GObject" "Value"
    Ptr (Ptr GError) ->                     -- error
    IO CInt


builderValueFromStringType ::
    (MonadIO m, BuilderK a) =>
    a ->                                    -- _obj
    GType ->                                -- type
    T.Text ->                               -- string
    m (GValue)
builderValueFromStringType _obj type_ string = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = gtypeToCGType type_
    string' <- textToCString string
    value <- callocBoxedBytes 24 :: IO (Ptr GValue)
    onException (do
        _ <- propagateGError $ gtk_builder_value_from_string_type _obj' type_' string' value
        value' <- (wrapBoxed GValue) value
        touchManagedPtr _obj
        freeMem string'
        return value'
     ) (do
        freeMem string'
        freeMem value
     )