{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A GtkBuilder is an auxiliary object that reads textual descriptions
-- of a user interface and instantiates the described objects. To create
-- a GtkBuilder from a user interface description, call
-- 'GI.Gtk.Objects.Builder.builderNewFromFile', 'GI.Gtk.Objects.Builder.builderNewFromResource' or
-- 'GI.Gtk.Objects.Builder.builderNewFromString'.
-- 
-- In the (unusual) case that you want to add user interface
-- descriptions from multiple sources to the same GtkBuilder you can
-- call 'GI.Gtk.Objects.Builder.builderNew' to get an empty builder and populate it by
-- (multiple) calls to 'GI.Gtk.Objects.Builder.builderAddFromFile',
-- 'GI.Gtk.Objects.Builder.builderAddFromResource' or 'GI.Gtk.Objects.Builder.builderAddFromString'.
-- 
-- A GtkBuilder holds a reference to all objects that it has constructed
-- and drops these references when it is finalized. This finalization can
-- cause the destruction of non-widget objects or widgets which are not
-- contained in a toplevel window. For toplevel windows constructed by a
-- builder, it is the responsibility of the user to call 'GI.Gtk.Objects.Widget.widgetDestroy'
-- to get rid of them and all the widgets they contain.
-- 
-- The functions 'GI.Gtk.Objects.Builder.builderGetObject' and 'GI.Gtk.Objects.Builder.builderGetObjects'
-- can be used to access the widgets in the interface by the names assigned
-- to them inside the UI description. Toplevel windows returned by these
-- functions will stay around until the user explicitly destroys them
-- with 'GI.Gtk.Objects.Widget.widgetDestroy'. Other widgets will either be part of a
-- larger hierarchy constructed by the builder (in which case you should
-- not have to worry about their lifecycle), or without a parent, in which
-- case they have to be added to some container to make use of them.
-- Non-widget objects need to be reffed with 'GI.GObject.Objects.Object.objectRef' to keep them
-- beyond the lifespan of the builder.
-- 
-- The function 'GI.Gtk.Objects.Builder.builderConnectSignals' and variants thereof can be
-- used to connect handlers to the named signals in the description.
-- 
-- # GtkBuilder UI Definitions # {@/BUILDER/@-UI}
-- 
-- GtkBuilder parses textual descriptions of user interfaces which are
-- specified in an XML format which can be roughly described by the
-- RELAX NG schema below. We refer to these descriptions as “GtkBuilder
-- UI definitions” or just “UI definitions” if the context is clear.
-- Do not confuse GtkBuilder UI Definitions with
-- [GtkUIManager UI Definitions][XML-UI], which are more limited in scope.
-- It is common to use @.ui@ as the filename extension for files containing
-- GtkBuilder UI definitions.
-- 
-- <https://git.gnome.org/browse/gtk+/tree/gtk/gtkbuilder.rnc RELAX NG Compact Syntax>
-- 
-- The toplevel element is \<interface>. It optionally takes a “domain”
-- attribute, which will make the builder look for translated strings
-- using @/dgettext()/@ in the domain specified. This can also be done by
-- calling 'GI.Gtk.Objects.Builder.builderSetTranslationDomain' on the builder.
-- Objects are described by \<object> elements, which can contain
-- \<property> elements to set properties, \<signal> elements which
-- connect signals to handlers, and \<child> elements, which describe
-- child objects (most often widgets inside a container, but also e.g.
-- actions in an action group, or columns in a tree model). A \<child>
-- element contains an \<object> element which describes the child object.
-- The target toolkit version(s) are described by \<requires> elements,
-- the “lib” attribute specifies the widget library in question (currently
-- the only supported value is “gtk+”) and the “version” attribute specifies
-- the target version in the form “\<major>.\<minor>”. The builder will error
-- out if the version requirements are not met.
-- 
-- Typically, the specific kind of object represented by an \<object>
-- element is specified by the “class” attribute. If the type has not
-- been loaded yet, GTK+ tries to find the @/get_type()/@ function from the
-- class name by applying heuristics. This works in most cases, but if
-- necessary, it is possible to specify the name of the @/get_type()/@ function
-- explictly with the \"type-func\" attribute. As a special case, GtkBuilder
-- allows to use an object that has been constructed by a t'GI.Gtk.Objects.UIManager.UIManager' in
-- another part of the UI definition by specifying the id of the t'GI.Gtk.Objects.UIManager.UIManager'
-- in the “constructor” attribute and the name of the object in the “id”
-- attribute.
-- 
-- Objects may be given a name with the “id” attribute, which allows the
-- application to retrieve them from the builder with 'GI.Gtk.Objects.Builder.builderGetObject'.
-- An id is also necessary to use the object as property value in other
-- parts of the UI definition. GTK+ reserves ids starting and ending
-- with ___ (3 underscores) for its own purposes.
-- 
-- Setting properties of objects is pretty straightforward with the
-- \<property> element: the “name” attribute specifies the name of the
-- property, and the content of the element specifies the value.
-- If the “translatable” attribute is set to a true value, GTK+ uses
-- @/gettext()/@ (or @/dgettext()/@ if the builder has a translation domain set)
-- to find a translation for the value. This happens before the value
-- is parsed, so it can be used for properties of any type, but it is
-- probably most useful for string properties. It is also possible to
-- specify a context to disambiguate short strings, and comments which
-- may help the translators.
-- 
-- GtkBuilder can parse textual representations for the most common
-- property types: characters, strings, integers, floating-point numbers,
-- booleans (strings like “TRUE”, “t”, “yes”, “y”, “1” are interpreted
-- as 'P.True', strings like “FALSE”, “f”, “no”, “n”, “0” are interpreted
-- as 'P.False'), enumerations (can be specified by their name, nick or
-- integer value), flags (can be specified by their name, nick, integer
-- value, optionally combined with “|”, e.g. “GTK_VISIBLE|GTK_REALIZED”)
-- and colors (in a format understood by 'GI.Gdk.Structs.RGBA.rGBAParse').
-- 
-- GVariants can be specified in the format understood by 'GI.GLib.Functions.variantParse',
-- and pixbufs can be specified as a filename of an image file to load.
-- 
-- Objects can be referred to by their name and by default refer to
-- objects declared in the local xml fragment and objects exposed via
-- 'GI.Gtk.Objects.Builder.builderExposeObject'. In general, GtkBuilder allows forward
-- references to objects — declared in the local xml; an object doesn’t
-- have to be constructed before it can be referred to. The exception
-- to this rule is that an object has to be constructed before it can
-- be used as the value of a construct-only property.
-- 
-- It is also possible to bind a property value to another object\'s
-- property value using the attributes
-- \"bind-source\" to specify the source object of the binding,
-- \"bind-property\" to specify the source property and optionally
-- \"bind-flags\" to specify the binding flags
-- Internally builder implement this using GBinding objects.
-- For more information see 'GI.GObject.Objects.Object.objectBindProperty'
-- 
-- Signal handlers are set up with the \<signal> element. The “name”
-- attribute specifies the name of the signal, and the “handler” attribute
-- specifies the function to connect to the signal. By default, GTK+ tries
-- to find the handler using 'GI.GModule.Structs.Module.moduleSymbol', but this can be changed by
-- passing a custom t'GI.Gtk.Callbacks.BuilderConnectFunc' to
-- 'GI.Gtk.Objects.Builder.builderConnectSignalsFull'. The remaining attributes, “after”,
-- “swapped” and “object”, have the same meaning as the corresponding
-- parameters of the @/g_signal_connect_object()/@ or
-- @/g_signal_connect_data()/@ functions. A “last_modification_time”
-- attribute is also allowed, but it does not have a meaning to the
-- builder.
-- 
-- Sometimes it is necessary to refer to widgets which have implicitly
-- been constructed by GTK+ as part of a composite widget, to set
-- properties on them or to add further children (e.g. the /@vbox@/ of
-- a t'GI.Gtk.Objects.Dialog.Dialog'). This can be achieved by setting the “internal-child”
-- propery of the \<child> element to a true value. Note that GtkBuilder
-- still requires an \<object> element for the internal child, even if it
-- has already been constructed.
-- 
-- A number of widgets have different places where a child can be added
-- (e.g. tabs vs. page content in notebooks). This can be reflected in
-- a UI definition by specifying the “type” attribute on a \<child>
-- The possible values for the “type” attribute are described in the
-- sections describing the widget-specific portions of UI definitions.
-- 
-- = A GtkBuilder UI Definition
-- 
-- >
-- ><interface>
-- >  <object class="GtkDialog" id="dialog1">
-- >    <child internal-child="vbox">
-- >      <object class="GtkBox" id="vbox1">
-- >        <property name="border-width">10</property>
-- >        <child internal-child="action_area">
-- >          <object class="GtkButtonBox" id="hbuttonbox1">
-- >            <property name="border-width">20</property>
-- >            <child>
-- >              <object class="GtkButton" id="ok_button">
-- >                <property name="label">gtk-ok</property>
-- >                <property name="use-stock">TRUE</property>
-- >                <signal name="clicked" handler="ok_button_clicked"/>
-- >              </object>
-- >            </child>
-- >          </object>
-- >        </child>
-- >      </object>
-- >    </child>
-- >  </object>
-- ></interface>
-- 
-- 
-- Beyond this general structure, several object classes define their
-- own XML DTD fragments for filling in the ANY placeholders in the DTD
-- above. Note that a custom element in a \<child> element gets parsed by
-- the custom tag handler of the parent object, while a custom element in
-- an \<object> element gets parsed by the custom tag handler of the object.
-- 
-- These XML fragments are explained in the documentation of the
-- respective objects.
-- 
-- Additionally, since 3.10 a special \<template> tag has been added
-- to the format allowing one to define a widget class’s components.
-- See the [GtkWidget documentation][composite-templates] for details.

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

module GI.Gtk.Objects.Builder
    ( 

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


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

#if defined(ENABLE_OVERLOADING)
    ResolveBuilderMethod                    ,
#endif


-- ** addCallbackSymbol #method:addCallbackSymbol#

#if defined(ENABLE_OVERLOADING)
    BuilderAddCallbackSymbolMethodInfo      ,
#endif
    builderAddCallbackSymbol                ,


-- ** addFromFile #method:addFromFile#

#if defined(ENABLE_OVERLOADING)
    BuilderAddFromFileMethodInfo            ,
#endif
    builderAddFromFile                      ,


-- ** addFromResource #method:addFromResource#

#if defined(ENABLE_OVERLOADING)
    BuilderAddFromResourceMethodInfo        ,
#endif
    builderAddFromResource                  ,


-- ** addFromString #method:addFromString#

#if defined(ENABLE_OVERLOADING)
    BuilderAddFromStringMethodInfo          ,
#endif
    builderAddFromString                    ,


-- ** addObjectsFromFile #method:addObjectsFromFile#

#if defined(ENABLE_OVERLOADING)
    BuilderAddObjectsFromFileMethodInfo     ,
#endif
    builderAddObjectsFromFile               ,


-- ** addObjectsFromResource #method:addObjectsFromResource#

#if defined(ENABLE_OVERLOADING)
    BuilderAddObjectsFromResourceMethodInfo ,
#endif
    builderAddObjectsFromResource           ,


-- ** addObjectsFromString #method:addObjectsFromString#

#if defined(ENABLE_OVERLOADING)
    BuilderAddObjectsFromStringMethodInfo   ,
#endif
    builderAddObjectsFromString             ,


-- ** connectSignals #method:connectSignals#

#if defined(ENABLE_OVERLOADING)
    BuilderConnectSignalsMethodInfo         ,
#endif
    builderConnectSignals                   ,


-- ** connectSignalsFull #method:connectSignalsFull#

#if defined(ENABLE_OVERLOADING)
    BuilderConnectSignalsFullMethodInfo     ,
#endif
    builderConnectSignalsFull               ,


-- ** exposeObject #method:exposeObject#

#if defined(ENABLE_OVERLOADING)
    BuilderExposeObjectMethodInfo           ,
#endif
    builderExposeObject                     ,


-- ** extendWithTemplate #method:extendWithTemplate#

#if defined(ENABLE_OVERLOADING)
    BuilderExtendWithTemplateMethodInfo     ,
#endif
    builderExtendWithTemplate               ,


-- ** getApplication #method:getApplication#

#if defined(ENABLE_OVERLOADING)
    BuilderGetApplicationMethodInfo         ,
#endif
    builderGetApplication                   ,


-- ** getObject #method:getObject#

#if defined(ENABLE_OVERLOADING)
    BuilderGetObjectMethodInfo              ,
#endif
    builderGetObject                        ,


-- ** getObjects #method:getObjects#

#if defined(ENABLE_OVERLOADING)
    BuilderGetObjectsMethodInfo             ,
#endif
    builderGetObjects                       ,


-- ** getTranslationDomain #method:getTranslationDomain#

#if defined(ENABLE_OVERLOADING)
    BuilderGetTranslationDomainMethodInfo   ,
#endif
    builderGetTranslationDomain             ,


-- ** getTypeFromName #method:getTypeFromName#

#if defined(ENABLE_OVERLOADING)
    BuilderGetTypeFromNameMethodInfo        ,
#endif
    builderGetTypeFromName                  ,


-- ** new #method:new#

    builderNew                              ,


-- ** newFromFile #method:newFromFile#

    builderNewFromFile                      ,


-- ** newFromResource #method:newFromResource#

    builderNewFromResource                  ,


-- ** newFromString #method:newFromString#

    builderNewFromString                    ,


-- ** setApplication #method:setApplication#

#if defined(ENABLE_OVERLOADING)
    BuilderSetApplicationMethodInfo         ,
#endif
    builderSetApplication                   ,


-- ** setTranslationDomain #method:setTranslationDomain#

#if defined(ENABLE_OVERLOADING)
    BuilderSetTranslationDomainMethodInfo   ,
#endif
    builderSetTranslationDomain             ,


-- ** valueFromString #method:valueFromString#

#if defined(ENABLE_OVERLOADING)
    BuilderValueFromStringMethodInfo        ,
#endif
    builderValueFromString                  ,


-- ** valueFromStringType #method:valueFromStringType#

#if defined(ENABLE_OVERLOADING)
    BuilderValueFromStringTypeMethodInfo    ,
#endif
    builderValueFromStringType              ,




 -- * Properties
-- ** translationDomain #attr:translationDomain#
-- | The translation domain used when translating property values that
-- have been marked as translatable in interface descriptions.
-- If the translation domain is 'P.Nothing', t'GI.Gtk.Objects.Builder.Builder' uses @/gettext()/@,
-- otherwise 'GI.GLib.Functions.dgettext'.
-- 
-- /Since: 2.12/

#if defined(ENABLE_OVERLOADING)
    BuilderTranslationDomainPropertyInfo    ,
#endif
#if defined(ENABLE_OVERLOADING)
    builderTranslationDomain                ,
#endif
    clearBuilderTranslationDomain           ,
    constructBuilderTranslationDomain       ,
    getBuilderTranslationDomain             ,
    setBuilderTranslationDomain             ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Callbacks as GObject.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gtk.Callbacks as Gtk.Callbacks
import {-# SOURCE #-} qualified GI.Gtk.Objects.Application as Gtk.Application
import {-# SOURCE #-} qualified GI.Gtk.Objects.Widget as Gtk.Widget

-- | Memory-managed wrapper type.
newtype Builder = Builder (ManagedPtr Builder)
    deriving (Builder -> Builder -> Bool
(Builder -> Builder -> Bool)
-> (Builder -> Builder -> Bool) -> Eq Builder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Builder -> Builder -> Bool
$c/= :: Builder -> Builder -> Bool
== :: Builder -> Builder -> Bool
$c== :: Builder -> Builder -> Bool
Eq)
foreign import ccall "gtk_builder_get_type"
    c_gtk_builder_get_type :: IO GType

instance GObject Builder where
    gobjectType :: IO GType
gobjectType = IO GType
c_gtk_builder_get_type
    

-- | Convert 'Builder' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue Builder where
    toGValue :: Builder -> IO GValue
toGValue o :: Builder
o = do
        GType
gtype <- IO GType
c_gtk_builder_get_type
        Builder -> (Ptr Builder -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Builder
o (GType
-> (GValue -> Ptr Builder -> IO ()) -> Ptr Builder -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Builder -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO Builder
fromGValue gv :: GValue
gv = do
        Ptr Builder
ptr <- GValue -> IO (Ptr Builder)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Builder)
        (ManagedPtr Builder -> Builder) -> Ptr Builder -> IO Builder
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Builder -> Builder
Builder Ptr Builder
ptr
        
    

-- | Type class for types which can be safely cast to `Builder`, for instance with `toBuilder`.
class (GObject o, O.IsDescendantOf Builder o) => IsBuilder o
instance (GObject o, O.IsDescendantOf Builder o) => IsBuilder o

instance O.HasParentTypes Builder
type instance O.ParentTypes Builder = '[GObject.Object.Object]

-- | Cast to `Builder`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toBuilder :: (MonadIO m, IsBuilder o) => o -> m Builder
toBuilder :: o -> m Builder
toBuilder = IO Builder -> m Builder
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Builder -> m Builder) -> (o -> IO Builder) -> o -> m Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Builder -> Builder) -> o -> IO Builder
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Builder -> Builder
Builder

-- | A convenience alias for `Nothing` :: `Maybe` `Builder`.
noBuilder :: Maybe Builder
noBuilder :: Maybe Builder
noBuilder = Maybe Builder
forall a. Maybe a
Nothing

#if defined(ENABLE_OVERLOADING)
type family ResolveBuilderMethod (t :: Symbol) (o :: *) :: * where
    ResolveBuilderMethod "addCallbackSymbol" o = BuilderAddCallbackSymbolMethodInfo
    ResolveBuilderMethod "addFromFile" o = BuilderAddFromFileMethodInfo
    ResolveBuilderMethod "addFromResource" o = BuilderAddFromResourceMethodInfo
    ResolveBuilderMethod "addFromString" o = BuilderAddFromStringMethodInfo
    ResolveBuilderMethod "addObjectsFromFile" o = BuilderAddObjectsFromFileMethodInfo
    ResolveBuilderMethod "addObjectsFromResource" o = BuilderAddObjectsFromResourceMethodInfo
    ResolveBuilderMethod "addObjectsFromString" o = BuilderAddObjectsFromStringMethodInfo
    ResolveBuilderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveBuilderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveBuilderMethod "connectSignals" o = BuilderConnectSignalsMethodInfo
    ResolveBuilderMethod "connectSignalsFull" o = BuilderConnectSignalsFullMethodInfo
    ResolveBuilderMethod "exposeObject" o = BuilderExposeObjectMethodInfo
    ResolveBuilderMethod "extendWithTemplate" o = BuilderExtendWithTemplateMethodInfo
    ResolveBuilderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveBuilderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveBuilderMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveBuilderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveBuilderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveBuilderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveBuilderMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveBuilderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveBuilderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveBuilderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveBuilderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveBuilderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveBuilderMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveBuilderMethod "valueFromString" o = BuilderValueFromStringMethodInfo
    ResolveBuilderMethod "valueFromStringType" o = BuilderValueFromStringTypeMethodInfo
    ResolveBuilderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveBuilderMethod "getApplication" o = BuilderGetApplicationMethodInfo
    ResolveBuilderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveBuilderMethod "getObject" o = BuilderGetObjectMethodInfo
    ResolveBuilderMethod "getObjects" o = BuilderGetObjectsMethodInfo
    ResolveBuilderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveBuilderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveBuilderMethod "getTranslationDomain" o = BuilderGetTranslationDomainMethodInfo
    ResolveBuilderMethod "getTypeFromName" o = BuilderGetTypeFromNameMethodInfo
    ResolveBuilderMethod "setApplication" o = BuilderSetApplicationMethodInfo
    ResolveBuilderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveBuilderMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveBuilderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveBuilderMethod "setTranslationDomain" o = BuilderSetTranslationDomainMethodInfo
    ResolveBuilderMethod l o = O.MethodResolutionFailed l o

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

#endif

-- VVV Prop "translation-domain"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just True)

-- | Get the value of the “@translation-domain@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' builder #translationDomain
-- @
getBuilderTranslationDomain :: (MonadIO m, IsBuilder o) => o -> m T.Text
getBuilderTranslationDomain :: o -> m Text
getBuilderTranslationDomain obj :: o
obj = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing "getBuilderTranslationDomain" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj "translation-domain"

-- | Set the value of the “@translation-domain@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' builder [ #translationDomain 'Data.GI.Base.Attributes.:=' value ]
-- @
setBuilderTranslationDomain :: (MonadIO m, IsBuilder o) => o -> T.Text -> m ()
setBuilderTranslationDomain :: o -> Text -> m ()
setBuilderTranslationDomain obj :: o
obj val :: Text
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> IO ()
forall a. GObject a => a -> String -> Maybe Text -> IO ()
B.Properties.setObjectPropertyString o
obj "translation-domain" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

-- | Construct a `GValueConstruct` with valid value for the “@translation-domain@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructBuilderTranslationDomain :: (IsBuilder o) => T.Text -> IO (GValueConstruct o)
constructBuilderTranslationDomain :: Text -> IO (GValueConstruct o)
constructBuilderTranslationDomain val :: Text
val = String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString "translation-domain" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

-- | Set the value of the “@translation-domain@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #translationDomain
-- @
clearBuilderTranslationDomain :: (MonadIO m, IsBuilder o) => o -> m ()
clearBuilderTranslationDomain :: o -> m ()
clearBuilderTranslationDomain obj :: o
obj = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> IO ()
forall a. GObject a => a -> String -> Maybe Text -> IO ()
B.Properties.setObjectPropertyString o
obj "translation-domain" (Maybe Text
forall a. Maybe a
Nothing :: Maybe T.Text)

#if defined(ENABLE_OVERLOADING)
data BuilderTranslationDomainPropertyInfo
instance AttrInfo BuilderTranslationDomainPropertyInfo where
    type AttrAllowedOps BuilderTranslationDomainPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint BuilderTranslationDomainPropertyInfo = IsBuilder
    type AttrSetTypeConstraint BuilderTranslationDomainPropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint BuilderTranslationDomainPropertyInfo = (~) T.Text
    type AttrTransferType BuilderTranslationDomainPropertyInfo = T.Text
    type AttrGetType BuilderTranslationDomainPropertyInfo = T.Text
    type AttrLabel BuilderTranslationDomainPropertyInfo = "translation-domain"
    type AttrOrigin BuilderTranslationDomainPropertyInfo = Builder
    attrGet = getBuilderTranslationDomain
    attrSet = setBuilderTranslationDomain
    attrTransfer _ v = do
        return v
    attrConstruct = constructBuilderTranslationDomain
    attrClear = clearBuilderTranslationDomain
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Builder
type instance O.AttributeList Builder = BuilderAttributeList
type BuilderAttributeList = ('[ '("translationDomain", BuilderTranslationDomainPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
builderTranslationDomain :: AttrLabelProxy "translationDomain"
builderTranslationDomain = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Builder = BuilderSignalList
type BuilderSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Builder::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "Builder" })
-- throws : False
-- Skip return : False

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

-- | Creates a new empty builder object.
-- 
-- This function is only useful if you intend to make multiple calls
-- to 'GI.Gtk.Objects.Builder.builderAddFromFile', 'GI.Gtk.Objects.Builder.builderAddFromResource'
-- or 'GI.Gtk.Objects.Builder.builderAddFromString' in order to merge multiple UI
-- descriptions into a single builder.
-- 
-- Most users will probably want to use 'GI.Gtk.Objects.Builder.builderNewFromFile',
-- 'GI.Gtk.Objects.Builder.builderNewFromResource' or 'GI.Gtk.Objects.Builder.builderNewFromString'.
-- 
-- /Since: 2.12/
builderNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Builder
    -- ^ __Returns:__ a new (empty) t'GI.Gtk.Objects.Builder.Builder' object
builderNew :: m Builder
builderNew  = IO Builder -> m Builder
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Builder -> m Builder) -> IO Builder -> m Builder
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
result <- IO (Ptr Builder)
gtk_builder_new
    Text -> Ptr Builder -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "builderNew" Ptr Builder
result
    Builder
result' <- ((ManagedPtr Builder -> Builder) -> Ptr Builder -> IO Builder
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Builder -> Builder
Builder) Ptr Builder
result
    Builder -> IO Builder
forall (m :: * -> *) a. Monad m => a -> m a
return Builder
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Builder::new_from_file
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "filename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "filename of user interface description file"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "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)

-- | Builds the [GtkBuilder UI definition][BUILDER-UI]
-- in the file /@filename@/.
-- 
-- If there is an error opening the file or parsing the description then
-- the program will be aborted.  You should only ever attempt to parse
-- user interface descriptions that are shipped as part of your program.
-- 
-- /Since: 3.10/
builderNewFromFile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@filename@/: filename of user interface description file
    -> m Builder
    -- ^ __Returns:__ a t'GI.Gtk.Objects.Builder.Builder' containing the described interface
builderNewFromFile :: Text -> m Builder
builderNewFromFile filename :: Text
filename = IO Builder -> m Builder
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Builder -> m Builder) -> IO Builder -> m Builder
forall a b. (a -> b) -> a -> b
$ do
    CString
filename' <- Text -> IO CString
textToCString Text
filename
    Ptr Builder
result <- CString -> IO (Ptr Builder)
gtk_builder_new_from_file CString
filename'
    Text -> Ptr Builder -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "builderNewFromFile" Ptr Builder
result
    Builder
result' <- ((ManagedPtr Builder -> Builder) -> Ptr Builder -> IO Builder
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Builder -> Builder
Builder) Ptr Builder
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
    Builder -> IO Builder
forall (m :: * -> *) a. Monad m => a -> m a
return Builder
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Builder::new_from_resource
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "resource_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GResource resource path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "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)

-- | Builds the [GtkBuilder UI definition][BUILDER-UI]
-- at /@resourcePath@/.
-- 
-- If there is an error locating the resource or parsing the
-- description, then the program will be aborted.
-- 
-- /Since: 3.10/
builderNewFromResource ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@resourcePath@/: a t'GI.Gio.Structs.Resource.Resource' resource path
    -> m Builder
    -- ^ __Returns:__ a t'GI.Gtk.Objects.Builder.Builder' containing the described interface
builderNewFromResource :: Text -> m Builder
builderNewFromResource resourcePath :: Text
resourcePath = IO Builder -> m Builder
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Builder -> m Builder) -> IO Builder -> m Builder
forall a b. (a -> b) -> a -> b
$ do
    CString
resourcePath' <- Text -> IO CString
textToCString Text
resourcePath
    Ptr Builder
result <- CString -> IO (Ptr Builder)
gtk_builder_new_from_resource CString
resourcePath'
    Text -> Ptr Builder -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "builderNewFromResource" Ptr Builder
result
    Builder
result' <- ((ManagedPtr Builder -> Builder) -> Ptr Builder -> IO Builder
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Builder -> Builder
Builder) Ptr Builder
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
resourcePath'
    Builder -> IO Builder
forall (m :: * -> *) a. Monad m => a -> m a
return Builder
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Builder::new_from_string
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a user interface (XML) description"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the length of @string, or -1"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "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)

-- | Builds the user interface described by /@string@/ (in the
-- [GtkBuilder UI definition][BUILDER-UI] format).
-- 
-- If /@string@/ is 'P.Nothing'-terminated, then /@length@/ should be -1.
-- If /@length@/ is not -1, then it is the length of /@string@/.
-- 
-- If there is an error parsing /@string@/ then the program will be
-- aborted. You should not attempt to parse user interface description
-- from untrusted sources.
-- 
-- /Since: 3.10/
builderNewFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: a user interface (XML) description
    -> Int64
    -- ^ /@length@/: the length of /@string@/, or -1
    -> m Builder
    -- ^ __Returns:__ a t'GI.Gtk.Objects.Builder.Builder' containing the interface described by /@string@/
builderNewFromString :: Text -> Int64 -> m Builder
builderNewFromString string :: Text
string length_ :: Int64
length_ = IO Builder -> m Builder
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Builder -> m Builder) -> IO Builder -> m Builder
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    Ptr Builder
result <- CString -> Int64 -> IO (Ptr Builder)
gtk_builder_new_from_string CString
string' Int64
length_
    Text -> Ptr Builder -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "builderNewFromString" Ptr Builder
result
    Builder
result' <- ((ManagedPtr Builder -> Builder) -> Ptr Builder -> IO Builder
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Builder -> Builder
Builder) Ptr Builder
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
    Builder -> IO Builder
forall (m :: * -> *) a. Monad m => a -> m a
return Builder
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Builder::add_callback_symbol
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The name of the callback, as expected in the XML"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback_symbol"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Callback" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The callback pointer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeNotified
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_add_callback_symbol" gtk_builder_add_callback_symbol :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- callback_name : TBasicType TUTF8
    FunPtr GObject.Callbacks.C_Callback ->  -- callback_symbol : TInterface (Name {namespace = "GObject", name = "Callback"})
    IO ()

-- | Adds the /@callbackSymbol@/ to the scope of /@builder@/ under the given /@callbackName@/.
-- 
-- Using this function overrides the behavior of 'GI.Gtk.Objects.Builder.builderConnectSignals'
-- for any callback symbols that are added. Using this method allows for better
-- encapsulation as it does not require that callback symbols be declared in
-- the global namespace.
-- 
-- /Since: 3.10/
builderAddCallbackSymbol ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@callbackName@/: The name of the callback, as expected in the XML
    -> GObject.Callbacks.Callback
    -- ^ /@callbackSymbol@/: The callback pointer
    -> m ()
builderAddCallbackSymbol :: a -> Text -> IO () -> m ()
builderAddCallbackSymbol builder :: a
builder callbackName :: Text
callbackName callbackSymbol :: IO ()
callbackSymbol = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
callbackName' <- Text -> IO CString
textToCString Text
callbackName
    FunPtr (IO ())
callbackSymbol' <- IO () -> IO (FunPtr (IO ()))
GObject.Callbacks.mk_Callback (Maybe (Ptr (FunPtr (IO ()))) -> IO () -> IO ()
GObject.Callbacks.wrap_Callback Maybe (Ptr (FunPtr (IO ())))
forall a. Maybe a
Nothing IO ()
callbackSymbol)
    Ptr Builder -> CString -> FunPtr (IO ()) -> IO ()
gtk_builder_add_callback_symbol Ptr Builder
builder' CString
callbackName' FunPtr (IO ())
callbackSymbol'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
callbackName'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BuilderAddCallbackSymbolMethodInfo
instance (signature ~ (T.Text -> GObject.Callbacks.Callback -> m ()), MonadIO m, IsBuilder a) => O.MethodInfo BuilderAddCallbackSymbolMethodInfo a signature where
    overloadedMethod = builderAddCallbackSymbol

#endif

-- method Builder::add_from_file
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "filename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the file to parse"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_from_file" gtk_builder_add_from_file :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- filename : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO Word32

-- | Parses a file containing a [GtkBuilder UI definition][BUILDER-UI]
-- and merges it with the current contents of /@builder@/.
-- 
-- Most users will probably want to use 'GI.Gtk.Objects.Builder.builderNewFromFile'.
-- 
-- If an error occurs, 0 will be returned and /@error@/ will be assigned a
-- t'GError' from the @/GTK_BUILDER_ERROR/@, @/G_MARKUP_ERROR/@ or @/G_FILE_ERROR/@
-- domain.
-- 
-- It’s not really reasonable to attempt to handle failures of this
-- call. You should not use this function with untrusted files (ie:
-- files that are not part of your application). Broken t'GI.Gtk.Objects.Builder.Builder'
-- files can easily crash your program, and it’s possible that memory
-- was leaked leading up to the reported failure. The only reasonable
-- thing to do when an error is detected is to call @/g_error()/@.
-- 
-- /Since: 2.12/
builderAddFromFile ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@filename@/: the name of the file to parse
    -> m Word32
    -- ^ __Returns:__ A positive value on success, 0 if an error occurred /(Can throw 'Data.GI.Base.GError.GError')/
builderAddFromFile :: a -> Text -> m Word32
builderAddFromFile builder :: a
builder filename :: Text
filename = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
filename' <- Text -> IO CString
textToCString Text
filename
    IO Word32 -> IO () -> IO Word32
forall a b. IO a -> IO b -> IO a
onException (do
        Word32
result <- (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Word32) -> IO Word32)
-> (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ Ptr Builder -> CString -> Ptr (Ptr GError) -> IO Word32
gtk_builder_add_from_file Ptr Builder
builder' CString
filename'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
        Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderAddFromFileMethodInfo
instance (signature ~ (T.Text -> m Word32), MonadIO m, IsBuilder a) => O.MethodInfo BuilderAddFromFileMethodInfo a signature where
    overloadedMethod = builderAddFromFile

#endif

-- method Builder::add_from_resource
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "resource_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the path of the resource file to parse"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_from_resource" gtk_builder_add_from_resource :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- resource_path : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO Word32

-- | Parses a resource file containing a [GtkBuilder UI definition][BUILDER-UI]
-- and merges it with the current contents of /@builder@/.
-- 
-- Most users will probably want to use 'GI.Gtk.Objects.Builder.builderNewFromResource'.
-- 
-- If an error occurs, 0 will be returned and /@error@/ will be assigned a
-- t'GError' from the @/GTK_BUILDER_ERROR/@, @/G_MARKUP_ERROR/@ or @/G_RESOURCE_ERROR/@
-- domain.
-- 
-- It’s not really reasonable to attempt to handle failures of this
-- call.  The only reasonable thing to do when an error is detected is
-- to call @/g_error()/@.
-- 
-- /Since: 3.4/
builderAddFromResource ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@resourcePath@/: the path of the resource file to parse
    -> m Word32
    -- ^ __Returns:__ A positive value on success, 0 if an error occurred /(Can throw 'Data.GI.Base.GError.GError')/
builderAddFromResource :: a -> Text -> m Word32
builderAddFromResource builder :: a
builder resourcePath :: Text
resourcePath = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
resourcePath' <- Text -> IO CString
textToCString Text
resourcePath
    IO Word32 -> IO () -> IO Word32
forall a b. IO a -> IO b -> IO a
onException (do
        Word32
result <- (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Word32) -> IO Word32)
-> (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ Ptr Builder -> CString -> Ptr (Ptr GError) -> IO Word32
gtk_builder_add_from_resource Ptr Builder
builder' CString
resourcePath'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
resourcePath'
        Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
resourcePath'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderAddFromResourceMethodInfo
instance (signature ~ (T.Text -> m Word32), MonadIO m, IsBuilder a) => O.MethodInfo BuilderAddFromResourceMethodInfo a signature where
    overloadedMethod = builderAddFromResource

#endif

-- method Builder::add_from_string
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the string to parse"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the length of @buffer (may be -1 if @buffer is nul-terminated)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_from_string" gtk_builder_add_from_string :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- buffer : TBasicType TUTF8
    Int64 ->                                -- length : TBasicType TInt64
    Ptr (Ptr GError) ->                     -- error
    IO Word32

-- | Parses a string containing a [GtkBuilder UI definition][BUILDER-UI]
-- and merges it with the current contents of /@builder@/.
-- 
-- Most users will probably want to use 'GI.Gtk.Objects.Builder.builderNewFromString'.
-- 
-- Upon errors 0 will be returned and /@error@/ will be assigned a
-- t'GError' from the @/GTK_BUILDER_ERROR/@, @/G_MARKUP_ERROR/@ or
-- @/G_VARIANT_PARSE_ERROR/@ domain.
-- 
-- It’s not really reasonable to attempt to handle failures of this
-- call.  The only reasonable thing to do when an error is detected is
-- to call @/g_error()/@.
-- 
-- /Since: 2.12/
builderAddFromString ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@buffer@/: the string to parse
    -> Int64
    -- ^ /@length@/: the length of /@buffer@/ (may be -1 if /@buffer@/ is nul-terminated)
    -> m Word32
    -- ^ __Returns:__ A positive value on success, 0 if an error occurred /(Can throw 'Data.GI.Base.GError.GError')/
builderAddFromString :: a -> Text -> Int64 -> m Word32
builderAddFromString builder :: a
builder buffer :: Text
buffer length_ :: Int64
length_ = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
buffer' <- Text -> IO CString
textToCString Text
buffer
    IO Word32 -> IO () -> IO Word32
forall a b. IO a -> IO b -> IO a
onException (do
        Word32
result <- (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Word32) -> IO Word32)
-> (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ Ptr Builder -> CString -> Int64 -> Ptr (Ptr GError) -> IO Word32
gtk_builder_add_from_string Ptr Builder
builder' CString
buffer' Int64
length_
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buffer'
        Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buffer'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderAddFromStringMethodInfo
instance (signature ~ (T.Text -> Int64 -> m Word32), MonadIO m, IsBuilder a) => O.MethodInfo BuilderAddFromStringMethodInfo a signature where
    overloadedMethod = builderAddFromString

#endif

-- method Builder::add_objects_from_file
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "filename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the file to parse"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_ids"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "nul-terminated array of objects to build"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_objects_from_file" gtk_builder_add_objects_from_file :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- filename : TBasicType TUTF8
    Ptr CString ->                          -- object_ids : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO Word32

-- | Parses a file containing a [GtkBuilder UI definition][BUILDER-UI]
-- building only the requested objects and merges
-- them with the current contents of /@builder@/.
-- 
-- Upon errors 0 will be returned and /@error@/ will be assigned a
-- t'GError' from the @/GTK_BUILDER_ERROR/@, @/G_MARKUP_ERROR/@ or @/G_FILE_ERROR/@
-- domain.
-- 
-- If you are adding an object that depends on an object that is not
-- its child (for instance a t'GI.Gtk.Objects.TreeView.TreeView' that depends on its
-- t'GI.Gtk.Interfaces.TreeModel.TreeModel'), you have to explicitly list all of them in /@objectIds@/.
-- 
-- /Since: 2.14/
builderAddObjectsFromFile ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@filename@/: the name of the file to parse
    -> [T.Text]
    -- ^ /@objectIds@/: nul-terminated array of objects to build
    -> m Word32
    -- ^ __Returns:__ A positive value on success, 0 if an error occurred /(Can throw 'Data.GI.Base.GError.GError')/
builderAddObjectsFromFile :: a -> Text -> [Text] -> m Word32
builderAddObjectsFromFile builder :: a
builder filename :: Text
filename objectIds :: [Text]
objectIds = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
filename' <- Text -> IO CString
textToCString Text
filename
    Ptr CString
objectIds' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
objectIds
    IO Word32 -> IO () -> IO Word32
forall a b. IO a -> IO b -> IO a
onException (do
        Word32
result <- (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Word32) -> IO Word32)
-> (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ Ptr Builder
-> CString -> Ptr CString -> Ptr (Ptr GError) -> IO Word32
gtk_builder_add_objects_from_file Ptr Builder
builder' CString
filename' Ptr CString
objectIds'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
        (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
objectIds'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
objectIds'
        Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
        (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
objectIds'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
objectIds'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderAddObjectsFromFileMethodInfo
instance (signature ~ (T.Text -> [T.Text] -> m Word32), MonadIO m, IsBuilder a) => O.MethodInfo BuilderAddObjectsFromFileMethodInfo a signature where
    overloadedMethod = builderAddObjectsFromFile

#endif

-- method Builder::add_objects_from_resource
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "resource_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the path of the resource file to parse"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_ids"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "nul-terminated array of objects to build"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_objects_from_resource" gtk_builder_add_objects_from_resource :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- resource_path : TBasicType TUTF8
    Ptr CString ->                          -- object_ids : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO Word32

-- | Parses a resource file containing a [GtkBuilder UI definition][BUILDER-UI]
-- building only the requested objects and merges
-- them with the current contents of /@builder@/.
-- 
-- Upon errors 0 will be returned and /@error@/ will be assigned a
-- t'GError' from the @/GTK_BUILDER_ERROR/@, @/G_MARKUP_ERROR/@ or @/G_RESOURCE_ERROR/@
-- domain.
-- 
-- If you are adding an object that depends on an object that is not
-- its child (for instance a t'GI.Gtk.Objects.TreeView.TreeView' that depends on its
-- t'GI.Gtk.Interfaces.TreeModel.TreeModel'), you have to explicitly list all of them in /@objectIds@/.
-- 
-- /Since: 3.4/
builderAddObjectsFromResource ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@resourcePath@/: the path of the resource file to parse
    -> [T.Text]
    -- ^ /@objectIds@/: nul-terminated array of objects to build
    -> m Word32
    -- ^ __Returns:__ A positive value on success, 0 if an error occurred /(Can throw 'Data.GI.Base.GError.GError')/
builderAddObjectsFromResource :: a -> Text -> [Text] -> m Word32
builderAddObjectsFromResource builder :: a
builder resourcePath :: Text
resourcePath objectIds :: [Text]
objectIds = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
resourcePath' <- Text -> IO CString
textToCString Text
resourcePath
    Ptr CString
objectIds' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
objectIds
    IO Word32 -> IO () -> IO Word32
forall a b. IO a -> IO b -> IO a
onException (do
        Word32
result <- (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Word32) -> IO Word32)
-> (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ Ptr Builder
-> CString -> Ptr CString -> Ptr (Ptr GError) -> IO Word32
gtk_builder_add_objects_from_resource Ptr Builder
builder' CString
resourcePath' Ptr CString
objectIds'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
resourcePath'
        (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
objectIds'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
objectIds'
        Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
resourcePath'
        (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
objectIds'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
objectIds'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderAddObjectsFromResourceMethodInfo
instance (signature ~ (T.Text -> [T.Text] -> m Word32), MonadIO m, IsBuilder a) => O.MethodInfo BuilderAddObjectsFromResourceMethodInfo a signature where
    overloadedMethod = builderAddObjectsFromResource

#endif

-- method Builder::add_objects_from_string
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the string to parse"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the length of @buffer (may be -1 if @buffer is nul-terminated)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object_ids"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "nul-terminated array of objects to build"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_add_objects_from_string" gtk_builder_add_objects_from_string :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "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

-- | Parses a string containing a [GtkBuilder UI definition][BUILDER-UI]
-- building only the requested objects and merges
-- them with the current contents of /@builder@/.
-- 
-- Upon errors 0 will be returned and /@error@/ will be assigned a
-- t'GError' from the @/GTK_BUILDER_ERROR/@ or @/G_MARKUP_ERROR/@ domain.
-- 
-- If you are adding an object that depends on an object that is not
-- its child (for instance a t'GI.Gtk.Objects.TreeView.TreeView' that depends on its
-- t'GI.Gtk.Interfaces.TreeModel.TreeModel'), you have to explicitly list all of them in /@objectIds@/.
-- 
-- /Since: 2.14/
builderAddObjectsFromString ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@buffer@/: the string to parse
    -> Word64
    -- ^ /@length@/: the length of /@buffer@/ (may be -1 if /@buffer@/ is nul-terminated)
    -> [T.Text]
    -- ^ /@objectIds@/: nul-terminated array of objects to build
    -> m Word32
    -- ^ __Returns:__ A positive value on success, 0 if an error occurred /(Can throw 'Data.GI.Base.GError.GError')/
builderAddObjectsFromString :: a -> Text -> Word64 -> [Text] -> m Word32
builderAddObjectsFromString builder :: a
builder buffer :: Text
buffer length_ :: Word64
length_ objectIds :: [Text]
objectIds = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
buffer' <- Text -> IO CString
textToCString Text
buffer
    Ptr CString
objectIds' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
objectIds
    IO Word32 -> IO () -> IO Word32
forall a b. IO a -> IO b -> IO a
onException (do
        Word32
result <- (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Word32) -> IO Word32)
-> (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ Ptr Builder
-> CString
-> Word64
-> Ptr CString
-> Ptr (Ptr GError)
-> IO Word32
gtk_builder_add_objects_from_string Ptr Builder
builder' CString
buffer' Word64
length_ Ptr CString
objectIds'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buffer'
        (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
objectIds'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
objectIds'
        Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buffer'
        (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
objectIds'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
objectIds'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderAddObjectsFromStringMethodInfo
instance (signature ~ (T.Text -> Word64 -> [T.Text] -> m Word32), MonadIO m, IsBuilder a) => O.MethodInfo BuilderAddObjectsFromStringMethodInfo a signature where
    overloadedMethod = builderAddObjectsFromString

#endif

-- method Builder::connect_signals
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user data to pass back with all signals"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_connect_signals" gtk_builder_connect_signals :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | This method is a simpler variation of 'GI.Gtk.Objects.Builder.builderConnectSignalsFull'.
-- It uses symbols explicitly added to /@builder@/ with prior calls to
-- 'GI.Gtk.Objects.Builder.builderAddCallbackSymbol'. In the case that symbols are not
-- explicitly added; it uses t'GI.GModule.Structs.Module.Module'’s introspective features (by opening the module 'P.Nothing')
-- to look at the application’s symbol table. From here it tries to match
-- the signal handler names given in the interface description with
-- symbols in the application and connects the signals. Note that this
-- function can only be called once, subsequent calls will do nothing.
-- 
-- Note that unless 'GI.Gtk.Objects.Builder.builderAddCallbackSymbol' is called for
-- all signal callbacks which are referenced by the loaded XML, this
-- function will require that t'GI.GModule.Structs.Module.Module' be supported on the platform.
-- 
-- If you rely on t'GI.GModule.Structs.Module.Module' support to lookup callbacks in the symbol table,
-- the following details should be noted:
-- 
-- When compiling applications for Windows, you must declare signal callbacks
-- with @/G_MODULE_EXPORT/@, or they will not be put in the symbol table.
-- On Linux and Unices, this is not necessary; applications should instead
-- be compiled with the -Wl,--export-dynamic CFLAGS, and linked against
-- gmodule-export-2.0.
-- 
-- /Since: 2.12/
builderConnectSignals ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> Ptr ()
    -- ^ /@userData@/: user data to pass back with all signals
    -> m ()
builderConnectSignals :: a -> Ptr () -> m ()
builderConnectSignals builder :: a
builder userData :: Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    Ptr Builder -> Ptr () -> IO ()
gtk_builder_connect_signals Ptr Builder
builder' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BuilderConnectSignalsMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m, IsBuilder a) => O.MethodInfo BuilderConnectSignalsMethodInfo a signature where
    overloadedMethod = builderConnectSignals

#endif

-- method Builder::connect_signals_full
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "func"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "BuilderConnectFunc" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the function used to connect the signals"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeCall
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "arbitrary data that will be passed to the connection function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_connect_signals_full" gtk_builder_connect_signals_full :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    FunPtr Gtk.Callbacks.C_BuilderConnectFunc -> -- func : TInterface (Name {namespace = "Gtk", name = "BuilderConnectFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | This function can be thought of the interpreted language binding
-- version of 'GI.Gtk.Objects.Builder.builderConnectSignals', except that it does not
-- require GModule to function correctly.
-- 
-- /Since: 2.12/
builderConnectSignalsFull ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> Gtk.Callbacks.BuilderConnectFunc
    -- ^ /@func@/: the function used to connect the signals
    -> m ()
builderConnectSignalsFull :: a -> BuilderConnectFunc -> m ()
builderConnectSignalsFull builder :: a
builder func :: BuilderConnectFunc
func = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    FunPtr C_BuilderConnectFunc
func' <- C_BuilderConnectFunc -> IO (FunPtr C_BuilderConnectFunc)
Gtk.Callbacks.mk_BuilderConnectFunc (Maybe (Ptr (FunPtr C_BuilderConnectFunc))
-> BuilderConnectFunc_WithClosures -> C_BuilderConnectFunc
Gtk.Callbacks.wrap_BuilderConnectFunc Maybe (Ptr (FunPtr C_BuilderConnectFunc))
forall a. Maybe a
Nothing (BuilderConnectFunc -> BuilderConnectFunc_WithClosures
Gtk.Callbacks.drop_closures_BuilderConnectFunc BuilderConnectFunc
func))
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr Builder -> FunPtr C_BuilderConnectFunc -> Ptr () -> IO ()
gtk_builder_connect_signals_full Ptr Builder
builder' FunPtr C_BuilderConnectFunc
func' Ptr ()
forall a. Ptr a
userData
    Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_BuilderConnectFunc -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_BuilderConnectFunc
func'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BuilderConnectSignalsFullMethodInfo
instance (signature ~ (Gtk.Callbacks.BuilderConnectFunc -> m ()), MonadIO m, IsBuilder a) => O.MethodInfo BuilderConnectSignalsFullMethodInfo a signature where
    overloadedMethod = builderConnectSignalsFull

#endif

-- method Builder::expose_object
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the object exposed to the builder"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the object to expose"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_expose_object" gtk_builder_expose_object :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- name : TBasicType TUTF8
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    IO ()

-- | Add /@object@/ to the /@builder@/ object pool so it can be referenced just like any
-- other object built by builder.
-- 
-- /Since: 3.8/
builderExposeObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a, GObject.Object.IsObject b) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@name@/: the name of the object exposed to the builder
    -> b
    -- ^ /@object@/: the object to expose
    -> m ()
builderExposeObject :: a -> Text -> b -> m ()
builderExposeObject builder :: a
builder name :: Text
name object :: b
object = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr Object
object' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
object
    Ptr Builder -> CString -> Ptr Object -> IO ()
gtk_builder_expose_object Ptr Builder
builder' CString
name' Ptr Object
object'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
object
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BuilderExposeObjectMethodInfo
instance (signature ~ (T.Text -> b -> m ()), MonadIO m, IsBuilder a, GObject.Object.IsObject b) => O.MethodInfo BuilderExposeObjectMethodInfo a signature where
    overloadedMethod = builderExposeObject

#endif

-- method Builder::extend_with_template
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "widget"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Widget" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the widget that is being extended"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "template_type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the type that the template is for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the string to parse"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the length of @buffer (may be -1 if @buffer is nul-terminated)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_extend_with_template" gtk_builder_extend_with_template :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    Ptr Gtk.Widget.Widget ->                -- widget : TInterface (Name {namespace = "Gtk", name = "Widget"})
    CGType ->                               -- template_type : TBasicType TGType
    CString ->                              -- buffer : TBasicType TUTF8
    Word64 ->                               -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO Word32

-- | Main private entry point for building composite container
-- components from template XML.
-- 
-- This is exported purely to let gtk-builder-tool validate
-- templates, applications have no need to call this function.
builderExtendWithTemplate ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a, Gtk.Widget.IsWidget b) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> b
    -- ^ /@widget@/: the widget that is being extended
    -> GType
    -- ^ /@templateType@/: the type that the template is for
    -> T.Text
    -- ^ /@buffer@/: the string to parse
    -> Word64
    -- ^ /@length@/: the length of /@buffer@/ (may be -1 if /@buffer@/ is nul-terminated)
    -> m Word32
    -- ^ __Returns:__ A positive value on success, 0 if an error occurred /(Can throw 'Data.GI.Base.GError.GError')/
builderExtendWithTemplate :: a -> b -> GType -> Text -> Word64 -> m Word32
builderExtendWithTemplate builder :: a
builder widget :: b
widget templateType :: GType
templateType buffer :: Text
buffer length_ :: Word64
length_ = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    Ptr Widget
widget' <- b -> IO (Ptr Widget)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
widget
    let templateType' :: Word64
templateType' = GType -> Word64
gtypeToCGType GType
templateType
    CString
buffer' <- Text -> IO CString
textToCString Text
buffer
    IO Word32 -> IO () -> IO Word32
forall a b. IO a -> IO b -> IO a
onException (do
        Word32
result <- (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Word32) -> IO Word32)
-> (Ptr (Ptr GError) -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ Ptr Builder
-> Ptr Widget
-> Word64
-> CString
-> Word64
-> Ptr (Ptr GError)
-> IO Word32
gtk_builder_extend_with_template Ptr Builder
builder' Ptr Widget
widget' Word64
templateType' CString
buffer' Word64
length_
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
widget
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buffer'
        Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buffer'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderExtendWithTemplateMethodInfo
instance (signature ~ (b -> GType -> T.Text -> Word64 -> m Word32), MonadIO m, IsBuilder a, Gtk.Widget.IsWidget b) => O.MethodInfo BuilderExtendWithTemplateMethodInfo a signature where
    overloadedMethod = builderExtendWithTemplate

#endif

-- method Builder::get_application
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "Application" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_application" gtk_builder_get_application :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    IO (Ptr Gtk.Application.Application)

-- | Gets the t'GI.Gtk.Objects.Application.Application' associated with the builder.
-- 
-- The t'GI.Gtk.Objects.Application.Application' is used for creating action proxies as requested
-- from XML that the builder is loading.
-- 
-- By default, the builder uses the default application: the one from
-- 'GI.Gio.Objects.Application.applicationGetDefault'. If you want to use another application
-- for constructing proxies, use 'GI.Gtk.Objects.Builder.builderSetApplication'.
-- 
-- /Since: 3.10/
builderGetApplication ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> m (Maybe Gtk.Application.Application)
    -- ^ __Returns:__ the application being used by the builder,
    --     or 'P.Nothing'
builderGetApplication :: a -> m (Maybe Application)
builderGetApplication builder :: a
builder = IO (Maybe Application) -> m (Maybe Application)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Application) -> m (Maybe Application))
-> IO (Maybe Application) -> m (Maybe Application)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    Ptr Application
result <- Ptr Builder -> IO (Ptr Application)
gtk_builder_get_application Ptr Builder
builder'
    Maybe Application
maybeResult <- Ptr Application
-> (Ptr Application -> IO Application) -> IO (Maybe Application)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Application
result ((Ptr Application -> IO Application) -> IO (Maybe Application))
-> (Ptr Application -> IO Application) -> IO (Maybe Application)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr Application
result' -> do
        Application
result'' <- ((ManagedPtr Application -> Application)
-> Ptr Application -> IO Application
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Application -> Application
Gtk.Application.Application) Ptr Application
result'
        Application -> IO Application
forall (m :: * -> *) a. Monad m => a -> m a
return Application
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    Maybe Application -> IO (Maybe Application)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Application
maybeResult

#if defined(ENABLE_OVERLOADING)
data BuilderGetApplicationMethodInfo
instance (signature ~ (m (Maybe Gtk.Application.Application)), MonadIO m, IsBuilder a) => O.MethodInfo BuilderGetApplicationMethodInfo a signature where
    overloadedMethod = builderGetApplication

#endif

-- method Builder::get_object
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "name of object to get"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GObject" , name = "Object" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_object" gtk_builder_get_object :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr GObject.Object.Object)

-- | Gets the object named /@name@/. Note that this function does not
-- increment the reference count of the returned object.
-- 
-- /Since: 2.12/
builderGetObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@name@/: name of object to get
    -> m (Maybe GObject.Object.Object)
    -- ^ __Returns:__ the object named /@name@/ or 'P.Nothing' if
    --    it could not be found in the object tree.
builderGetObject :: a -> Text -> m (Maybe Object)
builderGetObject builder :: a
builder name :: Text
name = IO (Maybe Object) -> m (Maybe Object)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Object) -> m (Maybe Object))
-> IO (Maybe Object) -> m (Maybe Object)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr Object
result <- Ptr Builder -> CString -> IO (Ptr Object)
gtk_builder_get_object Ptr Builder
builder' CString
name'
    Maybe Object
maybeResult <- Ptr Object -> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Object
result ((Ptr Object -> IO Object) -> IO (Maybe Object))
-> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr Object
result' -> do
        Object
result'' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
result'
        Object -> IO Object
forall (m :: * -> *) a. Monad m => a -> m a
return Object
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Maybe Object -> IO (Maybe Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Object
maybeResult

#if defined(ENABLE_OVERLOADING)
data BuilderGetObjectMethodInfo
instance (signature ~ (T.Text -> m (Maybe GObject.Object.Object)), MonadIO m, IsBuilder a) => O.MethodInfo BuilderGetObjectMethodInfo a signature where
    overloadedMethod = builderGetObject

#endif

-- method Builder::get_objects
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGSList
--                  (TInterface Name { namespace = "GObject" , name = "Object" }))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_objects" gtk_builder_get_objects :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    IO (Ptr (GSList (Ptr GObject.Object.Object)))

-- | Gets all objects that have been constructed by /@builder@/. Note that
-- this function does not increment the reference counts of the returned
-- objects.
-- 
-- /Since: 2.12/
builderGetObjects ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> m [GObject.Object.Object]
    -- ^ __Returns:__ a newly-allocated t'GI.GLib.Structs.SList.SList' containing all the objects
    --   constructed by the t'GI.Gtk.Objects.Builder.Builder' instance. It should be freed by
    --   @/g_slist_free()/@
builderGetObjects :: a -> m [Object]
builderGetObjects builder :: a
builder = IO [Object] -> m [Object]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Object] -> m [Object]) -> IO [Object] -> m [Object]
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    Ptr (GSList (Ptr Object))
result <- Ptr Builder -> IO (Ptr (GSList (Ptr Object)))
gtk_builder_get_objects Ptr Builder
builder'
    [Ptr Object]
result' <- Ptr (GSList (Ptr Object)) -> IO [Ptr Object]
forall a. Ptr (GSList (Ptr a)) -> IO [Ptr a]
unpackGSList Ptr (GSList (Ptr Object))
result
    [Object]
result'' <- (Ptr Object -> IO Object) -> [Ptr Object] -> IO [Object]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) [Ptr Object]
result'
    Ptr (GSList (Ptr Object)) -> IO ()
forall a. Ptr (GSList a) -> IO ()
g_slist_free Ptr (GSList (Ptr Object))
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    [Object] -> IO [Object]
forall (m :: * -> *) a. Monad m => a -> m a
return [Object]
result''

#if defined(ENABLE_OVERLOADING)
data BuilderGetObjectsMethodInfo
instance (signature ~ (m [GObject.Object.Object]), MonadIO m, IsBuilder a) => O.MethodInfo BuilderGetObjectsMethodInfo a signature where
    overloadedMethod = builderGetObjects

#endif

-- method Builder::get_translation_domain
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_translation_domain" gtk_builder_get_translation_domain :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    IO CString

-- | Gets the translation domain of /@builder@/.
-- 
-- /Since: 2.12/
builderGetTranslationDomain ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> m T.Text
    -- ^ __Returns:__ the translation domain. This string is owned
    -- by the builder object and must not be modified or freed.
builderGetTranslationDomain :: a -> m Text
builderGetTranslationDomain builder :: a
builder = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
result <- Ptr Builder -> IO CString
gtk_builder_get_translation_domain Ptr Builder
builder'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "builderGetTranslationDomain" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data BuilderGetTranslationDomainMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsBuilder a) => O.MethodInfo BuilderGetTranslationDomainMethodInfo a signature where
    overloadedMethod = builderGetTranslationDomain

#endif

-- method Builder::get_type_from_name
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "type_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "type name to lookup"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_get_type_from_name" gtk_builder_get_type_from_name :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- type_name : TBasicType TUTF8
    IO CGType

-- | Looks up a type by name, using the virtual function that
-- t'GI.Gtk.Objects.Builder.Builder' has for that purpose. This is mainly used when
-- implementing the t'GI.Gtk.Interfaces.Buildable.Buildable' interface on a type.
-- 
-- /Since: 2.12/
builderGetTypeFromName ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> T.Text
    -- ^ /@typeName@/: type name to lookup
    -> m GType
    -- ^ __Returns:__ the t'GType' found for /@typeName@/ or @/G_TYPE_INVALID/@
    --   if no type was found
builderGetTypeFromName :: a -> Text -> m GType
builderGetTypeFromName builder :: a
builder typeName :: Text
typeName = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
typeName' <- Text -> IO CString
textToCString Text
typeName
    Word64
result <- Ptr Builder -> CString -> IO Word64
gtk_builder_get_type_from_name Ptr Builder
builder' CString
typeName'
    let result' :: GType
result' = Word64 -> GType
GType Word64
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
typeName'
    GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'

#if defined(ENABLE_OVERLOADING)
data BuilderGetTypeFromNameMethodInfo
instance (signature ~ (T.Text -> m GType), MonadIO m, IsBuilder a) => O.MethodInfo BuilderGetTypeFromNameMethodInfo a signature where
    overloadedMethod = builderGetTypeFromName

#endif

-- method Builder::set_application
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "application"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Application" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkApplication" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_set_application" gtk_builder_set_application :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    Ptr Gtk.Application.Application ->      -- application : TInterface (Name {namespace = "Gtk", name = "Application"})
    IO ()

-- | Sets the application associated with /@builder@/.
-- 
-- You only need this function if there is more than one t'GI.Gio.Objects.Application.Application'
-- in your process. /@application@/ cannot be 'P.Nothing'.
-- 
-- /Since: 3.10/
builderSetApplication ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a, Gtk.Application.IsApplication b) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> b
    -- ^ /@application@/: a t'GI.Gtk.Objects.Application.Application'
    -> m ()
builderSetApplication :: a -> b -> m ()
builderSetApplication builder :: a
builder application :: b
application = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    Ptr Application
application' <- b -> IO (Ptr Application)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
application
    Ptr Builder -> Ptr Application -> IO ()
gtk_builder_set_application Ptr Builder
builder' Ptr Application
application'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
application
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BuilderSetApplicationMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsBuilder a, Gtk.Application.IsApplication b) => O.MethodInfo BuilderSetApplicationMethodInfo a signature where
    overloadedMethod = builderSetApplication

#endif

-- method Builder::set_translation_domain
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the translation domain or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_builder_set_translation_domain" gtk_builder_set_translation_domain :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- domain : TBasicType TUTF8
    IO ()

-- | Sets the translation domain of /@builder@/.
-- See t'GI.Gtk.Objects.Builder.Builder':@/translation-domain/@.
-- 
-- /Since: 2.12/
builderSetTranslationDomain ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> Maybe (T.Text)
    -- ^ /@domain@/: the translation domain or 'P.Nothing'
    -> m ()
builderSetTranslationDomain :: a -> Maybe Text -> m ()
builderSetTranslationDomain builder :: a
builder domain :: Maybe Text
domain = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    CString
maybeDomain <- case Maybe Text
domain of
        Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just jDomain :: Text
jDomain -> do
            CString
jDomain' <- Text -> IO CString
textToCString Text
jDomain
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jDomain'
    Ptr Builder -> CString -> IO ()
gtk_builder_set_translation_domain Ptr Builder
builder' CString
maybeDomain
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeDomain
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BuilderSetTranslationDomainMethodInfo
instance (signature ~ (Maybe (T.Text) -> m ()), MonadIO m, IsBuilder a) => O.MethodInfo BuilderSetTranslationDomainMethodInfo a signature where
    overloadedMethod = builderSetTranslationDomain

#endif

-- method Builder::value_from_string
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pspec"
--           , argType = TParamSpec
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GParamSpec for the property"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the string representation of the value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Value" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GValue to store the result in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_value_from_string" gtk_builder_value_from_string :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    CString ->                              -- string : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | This function demarshals a value from a string. This function
-- calls 'GI.GObject.Structs.Value.valueInit' on the /@value@/ argument, so it need not be
-- initialised beforehand.
-- 
-- This function can handle char, uchar, boolean, int, uint, long,
-- ulong, enum, flags, float, double, string, t'GI.Gdk.Structs.Color.Color', t'GI.Gdk.Structs.RGBA.RGBA' and
-- t'GI.Gtk.Objects.Adjustment.Adjustment' type values. Support for t'GI.Gtk.Objects.Widget.Widget' type values is
-- still to come.
-- 
-- Upon errors 'P.False' will be returned and /@error@/ will be assigned a
-- t'GError' from the @/GTK_BUILDER_ERROR/@ domain.
-- 
-- /Since: 2.12/
builderValueFromString ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> GParamSpec
    -- ^ /@pspec@/: the t'GI.GObject.Objects.ParamSpec.ParamSpec' for the property
    -> T.Text
    -- ^ /@string@/: the string representation of the value
    -> m (GValue)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderValueFromString :: a -> GParamSpec -> Text -> m GValue
builderValueFromString builder :: a
builder pspec :: GParamSpec
pspec string :: Text
string = IO GValue -> m GValue
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
    CString
string' <- Text -> IO CString
textToCString Text
string
    Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 24 :: IO (Ptr GValue)
    IO GValue -> IO () -> IO GValue
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Builder
-> Ptr GParamSpec
-> CString
-> Ptr GValue
-> Ptr (Ptr GError)
-> IO CInt
gtk_builder_value_from_string Ptr Builder
builder' Ptr GParamSpec
pspec' CString
string' Ptr GValue
value
        GValue
value' <- ((ManagedPtr GValue -> GValue) -> Ptr GValue -> IO GValue
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr GValue -> GValue
GValue) Ptr GValue
value
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
        GValue -> IO GValue
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
value'
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
        Ptr GValue -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr GValue
value
     )

#if defined(ENABLE_OVERLOADING)
data BuilderValueFromStringMethodInfo
instance (signature ~ (GParamSpec -> T.Text -> m (GValue)), MonadIO m, IsBuilder a) => O.MethodInfo BuilderValueFromStringMethodInfo a signature where
    overloadedMethod = builderValueFromString

#endif

-- method Builder::value_from_string_type
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "builder"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Builder" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkBuilder" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GType of the value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the string representation of the value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Value" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GValue to store the result in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_value_from_string_type" gtk_builder_value_from_string_type :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CGType ->                               -- type : TBasicType TGType
    CString ->                              -- string : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Like 'GI.Gtk.Objects.Builder.builderValueFromString', this function demarshals
-- a value from a string, but takes a t'GType' instead of t'GI.GObject.Objects.ParamSpec.ParamSpec'.
-- This function calls 'GI.GObject.Structs.Value.valueInit' on the /@value@/ argument, so it
-- need not be initialised beforehand.
-- 
-- Upon errors 'P.False' will be returned and /@error@/ will be assigned a
-- t'GError' from the @/GTK_BUILDER_ERROR/@ domain.
-- 
-- /Since: 2.12/
builderValueFromStringType ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a t'GI.Gtk.Objects.Builder.Builder'
    -> GType
    -- ^ /@type@/: the t'GType' of the value
    -> T.Text
    -- ^ /@string@/: the string representation of the value
    -> m (GValue)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderValueFromStringType :: a -> GType -> Text -> m GValue
builderValueFromStringType builder :: a
builder type_ :: GType
type_ string :: Text
string = IO GValue -> m GValue
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
    Ptr Builder
builder' <- a -> IO (Ptr Builder)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
builder
    let type_' :: Word64
type_' = GType -> Word64
gtypeToCGType GType
type_
    CString
string' <- Text -> IO CString
textToCString Text
string
    Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 24 :: IO (Ptr GValue)
    IO GValue -> IO () -> IO GValue
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Builder
-> Word64 -> CString -> Ptr GValue -> Ptr (Ptr GError) -> IO CInt
gtk_builder_value_from_string_type Ptr Builder
builder' Word64
type_' CString
string' Ptr GValue
value
        GValue
value' <- ((ManagedPtr GValue -> GValue) -> Ptr GValue -> IO GValue
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr GValue -> GValue
GValue) Ptr GValue
value
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
        GValue -> IO GValue
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
value'
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
        Ptr GValue -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr GValue
value
     )

#if defined(ENABLE_OVERLOADING)
data BuilderValueFromStringTypeMethodInfo
instance (signature ~ (GType -> T.Text -> m (GValue)), MonadIO m, IsBuilder a) => O.MethodInfo BuilderValueFromStringTypeMethodInfo a signature where
    overloadedMethod = builderValueFromStringType

#endif