{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A @GtkBuilder@ reads XML 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.Window.windowDestroy' 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.Window.windowDestroy'. 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.
-- 
-- = GtkBuilder UI Definitions
-- 
-- @GtkBuilder@ parses textual descriptions of user interfaces which are
-- specified in XML format. We refer to these descriptions as “GtkBuilder
-- UI definitions” or just “UI definitions” if the context is clear.
-- 
-- 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>@”. @GtkBuilder@ 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 explicitly with the \"type-func\" 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 @___@ (three consecutive
-- 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_INPUT_HINT_EMOJI|GTK_INPUT_HINT_LOWERCASE”)
-- and colors (in a format understood by 'GI.Gdk.Structs.RGBA.rGBAParse').
-- 
-- @GVariant@s 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, and optionally, \"bind-property\" and
-- \"bind-flags\" to specify the source property and source binding flags
-- respectively. Internally, @GtkBuilder@ implements this using @GBinding@
-- objects. For more information see 'GI.GObject.Objects.Object.objectBindProperty'.
-- 
-- 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 content area
-- of a @GtkDialog@). This can be achieved by setting the “internal-child”
-- property 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.
-- 
-- = Signal handlers and function pointers
-- 
-- 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.
-- 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.
-- 
-- If you rely on @GModule@ 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 Unix, this is not necessary; applications should instead
-- be compiled with the -Wl,--export-dynamic @CFLAGS@, and linked against
-- @gmodule-export-2.0@.
-- 
-- = A GtkBuilder UI Definition
-- 
-- 
-- === /xml code/
-- ><interface>
-- >  <object class="GtkDialog" id="dialog1">
-- >    <child internal-child="content_area">
-- >      <object class="GtkBox" id="vbox1">
-- >        <child internal-child="action_area">
-- >          <object class="GtkBox" id="hbuttonbox1">
-- >            <child>
-- >              <object class="GtkButton" id="ok_button">
-- >                <property name="label" translatable="yes">_Ok</property>
-- >                <property name="use-underline">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.
-- 
-- A @\<template>@ tag can be used to define a widget class’s components.
-- See the <https://docs.gtk.org/gtk4/class.Widget.html#building-composite-widgets-from-template-xml GtkWidget documentation> 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                               ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [addFromFile]("GI.Gtk.Objects.Builder#g:method:addFromFile"), [addFromResource]("GI.Gtk.Objects.Builder#g:method:addFromResource"), [addFromString]("GI.Gtk.Objects.Builder#g:method:addFromString"), [addObjectsFromFile]("GI.Gtk.Objects.Builder#g:method:addObjectsFromFile"), [addObjectsFromResource]("GI.Gtk.Objects.Builder#g:method:addObjectsFromResource"), [addObjectsFromString]("GI.Gtk.Objects.Builder#g:method:addObjectsFromString"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [createClosure]("GI.Gtk.Objects.Builder#g:method:createClosure"), [exposeObject]("GI.Gtk.Objects.Builder#g:method:exposeObject"), [extendWithTemplate]("GI.Gtk.Objects.Builder#g:method:extendWithTemplate"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [valueFromString]("GI.Gtk.Objects.Builder#g:method:valueFromString"), [valueFromStringType]("GI.Gtk.Objects.Builder#g:method:valueFromStringType"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getCurrentObject]("GI.Gtk.Objects.Builder#g:method:getCurrentObject"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getObject]("GI.Gtk.Objects.Builder#g:method:getObject"), [getObjects]("GI.Gtk.Objects.Builder#g:method:getObjects"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getScope]("GI.Gtk.Objects.Builder#g:method:getScope"), [getTranslationDomain]("GI.Gtk.Objects.Builder#g:method:getTranslationDomain"), [getTypeFromName]("GI.Gtk.Objects.Builder#g:method:getTypeFromName").
-- 
-- ==== Setters
-- [setCurrentObject]("GI.Gtk.Objects.Builder#g:method:setCurrentObject"), [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setScope]("GI.Gtk.Objects.Builder#g:method:setScope"), [setTranslationDomain]("GI.Gtk.Objects.Builder#g:method:setTranslationDomain").

#if defined(ENABLE_OVERLOADING)
    ResolveBuilderMethod                    ,
#endif

-- ** 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             ,


-- ** createClosure #method:createClosure#

#if defined(ENABLE_OVERLOADING)
    BuilderCreateClosureMethodInfo          ,
#endif
    builderCreateClosure                    ,


-- ** exposeObject #method:exposeObject#

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


-- ** extendWithTemplate #method:extendWithTemplate#

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


-- ** getCurrentObject #method:getCurrentObject#

#if defined(ENABLE_OVERLOADING)
    BuilderGetCurrentObjectMethodInfo       ,
#endif
    builderGetCurrentObject                 ,


-- ** getObject #method:getObject#

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


-- ** getObjects #method:getObjects#

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


-- ** getScope #method:getScope#

#if defined(ENABLE_OVERLOADING)
    BuilderGetScopeMethodInfo               ,
#endif
    builderGetScope                         ,


-- ** 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                    ,


-- ** setCurrentObject #method:setCurrentObject#

#if defined(ENABLE_OVERLOADING)
    BuilderSetCurrentObjectMethodInfo       ,
#endif
    builderSetCurrentObject                 ,


-- ** setScope #method:setScope#

#if defined(ENABLE_OVERLOADING)
    BuilderSetScopeMethodInfo               ,
#endif
    builderSetScope                         ,


-- ** 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


-- ** currentObject #attr:currentObject#
-- | The object the builder is evaluating for.

#if defined(ENABLE_OVERLOADING)
    BuilderCurrentObjectPropertyInfo        ,
#endif
#if defined(ENABLE_OVERLOADING)
    builderCurrentObject                    ,
#endif
    clearBuilderCurrentObject               ,
    constructBuilderCurrentObject           ,
    getBuilderCurrentObject                 ,
    setBuilderCurrentObject                 ,


-- ** scope #attr:scope#
-- | The scope the builder is operating in

#if defined(ENABLE_OVERLOADING)
    BuilderScopePropertyInfo                ,
#endif
#if defined(ENABLE_OVERLOADING)
    builderScope                            ,
#endif
    clearBuilderScope                       ,
    constructBuilderScope                   ,
    getBuilderScope                         ,
    setBuilderScope                         ,


-- ** translationDomain #attr:translationDomain#
-- | The translation domain used when translating property values that
-- have been marked as translatable.
-- 
-- If the translation domain is 'P.Nothing', @GtkBuilder@ uses @/gettext()/@,
-- otherwise 'GI.GLib.Functions.dgettext'.

#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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Flags as Gtk.Flags
import {-# SOURCE #-} qualified GI.Gtk.Interfaces.BuilderScope as Gtk.BuilderScope

-- | Memory-managed wrapper type.
newtype Builder = Builder (SP.ManagedPtr Builder)
    deriving (Builder -> Builder -> Bool
(Builder -> Builder -> Bool)
-> (Builder -> Builder -> Bool) -> Eq Builder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Builder -> Builder -> Bool
== :: Builder -> Builder -> Bool
$c/= :: Builder -> Builder -> Bool
/= :: Builder -> Builder -> Bool
Eq)

instance SP.ManagedPtrNewtype Builder where
    toManagedPtr :: Builder -> ManagedPtr Builder
toManagedPtr (Builder ManagedPtr Builder
p) = ManagedPtr Builder
p

foreign import ccall "gtk_builder_get_type"
    c_gtk_builder_get_type :: IO B.Types.GType

instance B.Types.TypedObject Builder where
    glibType :: IO GType
glibType = IO GType
c_gtk_builder_get_type

instance B.Types.GObject Builder

-- | Type class for types which can be safely cast to `Builder`, for instance with `toBuilder`.
class (SP.GObject o, O.IsDescendantOf Builder o) => IsBuilder o
instance (SP.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 :: (MIO.MonadIO m, IsBuilder o) => o -> m Builder
toBuilder :: forall (m :: * -> *) o. (MonadIO m, IsBuilder o) => o -> m Builder
toBuilder = IO Builder -> m Builder
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Builder -> Builder
Builder

-- | Convert 'Builder' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Builder) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_builder_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Builder -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Builder
P.Nothing = Ptr GValue -> Ptr Builder -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Builder
forall a. Ptr a
FP.nullPtr :: FP.Ptr Builder)
    gvalueSet_ Ptr GValue
gv (P.Just Builder
obj) = Builder -> (Ptr Builder -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Builder
obj (Ptr GValue -> Ptr Builder -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Builder)
gvalueGet_ Ptr GValue
gv = do
        Ptr Builder
ptr <- Ptr GValue -> IO (Ptr Builder)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Builder)
        if Ptr Builder
ptr Ptr Builder -> Ptr Builder -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Builder
forall a. Ptr a
FP.nullPtr
        then Builder -> Maybe Builder
forall a. a -> Maybe a
P.Just (Builder -> Maybe Builder) -> IO Builder -> IO (Maybe Builder)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (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
        else Maybe Builder -> IO (Maybe Builder)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Builder
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveBuilderMethod (t :: Symbol) (o :: *) :: * where
    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 "createClosure" o = BuilderCreateClosureMethodInfo
    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 "getCurrentObject" o = BuilderGetCurrentObjectMethodInfo
    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 "getScope" o = BuilderGetScopeMethodInfo
    ResolveBuilderMethod "getTranslationDomain" o = BuilderGetTranslationDomainMethodInfo
    ResolveBuilderMethod "getTypeFromName" o = BuilderGetTypeFromNameMethodInfo
    ResolveBuilderMethod "setCurrentObject" o = BuilderSetCurrentObjectMethodInfo
    ResolveBuilderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveBuilderMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveBuilderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveBuilderMethod "setScope" o = BuilderSetScopeMethodInfo
    ResolveBuilderMethod "setTranslationDomain" o = BuilderSetTranslationDomainMethodInfo
    ResolveBuilderMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveBuilderMethod t Builder, O.OverloadedMethod 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

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveBuilderMethod t Builder, O.OverloadedMethod info Builder p, R.HasField t Builder p) => R.HasField t Builder p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveBuilderMethod t Builder, O.OverloadedMethodInfo info Builder) => OL.IsLabel t (O.MethodProxy info Builder) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- VVV Prop "current-object"
   -- Type: TInterface (Name {namespace = "GObject", name = "Object"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just True,Just True)

-- | Get the value of the “@current-object@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' builder #currentObject
-- @
getBuilderCurrentObject :: (MonadIO m, IsBuilder o) => o -> m (Maybe GObject.Object.Object)
getBuilderCurrentObject :: forall (m :: * -> *) o.
(MonadIO m, IsBuilder o) =>
o -> m (Maybe Object)
getBuilderCurrentObject o
obj = IO (Maybe Object) -> m (Maybe Object)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Object) -> m (Maybe Object))
-> IO (Maybe Object) -> m (Maybe Object)
forall a b. (a -> b) -> a -> b
$ o -> String -> (ManagedPtr Object -> Object) -> IO (Maybe Object)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"current-object" ManagedPtr Object -> Object
GObject.Object.Object

-- | Set the value of the “@current-object@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' builder [ #currentObject 'Data.GI.Base.Attributes.:=' value ]
-- @
setBuilderCurrentObject :: (MonadIO m, IsBuilder o, GObject.Object.IsObject a) => o -> a -> m ()
setBuilderCurrentObject :: forall (m :: * -> *) o a.
(MonadIO m, IsBuilder o, IsObject a) =>
o -> a -> m ()
setBuilderCurrentObject o
obj a
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    o -> String -> Maybe a -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"current-object" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)

-- | Construct a `GValueConstruct` with valid value for the “@current-object@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructBuilderCurrentObject :: (IsBuilder o, MIO.MonadIO m, GObject.Object.IsObject a) => a -> m (GValueConstruct o)
constructBuilderCurrentObject :: forall o (m :: * -> *) a.
(IsBuilder o, MonadIO m, IsObject a) =>
a -> m (GValueConstruct o)
constructBuilderCurrentObject a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"current-object" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)

-- | Set the value of the “@current-object@” 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' #currentObject
-- @
clearBuilderCurrentObject :: (MonadIO m, IsBuilder o) => o -> m ()
clearBuilderCurrentObject :: forall (m :: * -> *) o. (MonadIO m, IsBuilder o) => o -> m ()
clearBuilderCurrentObject o
obj = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Object -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"current-object" (Maybe Object
forall a. Maybe a
Nothing :: Maybe GObject.Object.Object)

#if defined(ENABLE_OVERLOADING)
data BuilderCurrentObjectPropertyInfo
instance AttrInfo BuilderCurrentObjectPropertyInfo where
    type AttrAllowedOps BuilderCurrentObjectPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint BuilderCurrentObjectPropertyInfo = IsBuilder
    type AttrSetTypeConstraint BuilderCurrentObjectPropertyInfo = GObject.Object.IsObject
    type AttrTransferTypeConstraint BuilderCurrentObjectPropertyInfo = GObject.Object.IsObject
    type AttrTransferType BuilderCurrentObjectPropertyInfo = GObject.Object.Object
    type AttrGetType BuilderCurrentObjectPropertyInfo = (Maybe GObject.Object.Object)
    type AttrLabel BuilderCurrentObjectPropertyInfo = "current-object"
    type AttrOrigin BuilderCurrentObjectPropertyInfo = Builder
    attrGet = getBuilderCurrentObject
    attrSet = setBuilderCurrentObject
    attrTransfer _ v = do
        unsafeCastTo GObject.Object.Object v
    attrConstruct = constructBuilderCurrentObject
    attrClear = clearBuilderCurrentObject
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.currentObject"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#g:attr:currentObject"
        })
#endif

-- VVV Prop "scope"
   -- Type: TInterface (Name {namespace = "Gtk", name = "BuilderScope"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just True)

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

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

-- | Construct a `GValueConstruct` with valid value for the “@scope@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructBuilderScope :: (IsBuilder o, MIO.MonadIO m, Gtk.BuilderScope.IsBuilderScope a) => a -> m (GValueConstruct o)
constructBuilderScope :: forall o (m :: * -> *) a.
(IsBuilder o, MonadIO m, IsBuilderScope a) =>
a -> m (GValueConstruct o)
constructBuilderScope a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"scope" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)

-- | Set the value of the “@scope@” 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' #scope
-- @
clearBuilderScope :: (MonadIO m, IsBuilder o) => o -> m ()
clearBuilderScope :: forall (m :: * -> *) o. (MonadIO m, IsBuilder o) => o -> m ()
clearBuilderScope o
obj = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe BuilderScope -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"scope" (Maybe BuilderScope
forall a. Maybe a
Nothing :: Maybe Gtk.BuilderScope.BuilderScope)

#if defined(ENABLE_OVERLOADING)
data BuilderScopePropertyInfo
instance AttrInfo BuilderScopePropertyInfo where
    type AttrAllowedOps BuilderScopePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint BuilderScopePropertyInfo = IsBuilder
    type AttrSetTypeConstraint BuilderScopePropertyInfo = Gtk.BuilderScope.IsBuilderScope
    type AttrTransferTypeConstraint BuilderScopePropertyInfo = Gtk.BuilderScope.IsBuilderScope
    type AttrTransferType BuilderScopePropertyInfo = Gtk.BuilderScope.BuilderScope
    type AttrGetType BuilderScopePropertyInfo = Gtk.BuilderScope.BuilderScope
    type AttrLabel BuilderScopePropertyInfo = "scope"
    type AttrOrigin BuilderScopePropertyInfo = Builder
    attrGet = getBuilderScope
    attrSet = setBuilderScope
    attrTransfer _ v = do
        unsafeCastTo Gtk.BuilderScope.BuilderScope v
    attrConstruct = constructBuilderScope
    attrClear = clearBuilderScope
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.scope"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#g:attr:scope"
        })
#endif

-- VVV Prop "translation-domain"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just True,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 (Maybe T.Text)
getBuilderTranslationDomain :: forall (m :: * -> *) o.
(MonadIO m, IsBuilder o) =>
o -> m (Maybe Text)
getBuilderTranslationDomain o
obj = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe 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 String
"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 :: forall (m :: * -> *) o.
(MonadIO m, IsBuilder o) =>
o -> Text -> m ()
setBuilderTranslationDomain o
obj Text
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    o -> String -> Maybe Text -> IO ()
forall a. GObject a => a -> String -> Maybe Text -> IO ()
B.Properties.setObjectPropertyString o
obj String
"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, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructBuilderTranslationDomain :: forall o (m :: * -> *).
(IsBuilder o, MonadIO m) =>
Text -> m (GValueConstruct o)
constructBuilderTranslationDomain Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString String
"translation-domain" (Text -> Maybe Text
forall a. a -> Maybe a
P.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 :: forall (m :: * -> *) o. (MonadIO m, IsBuilder o) => o -> m ()
clearBuilderTranslationDomain o
obj = IO () -> m ()
forall a. IO a -> m a
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 String
"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 = (Maybe T.Text)
    type AttrLabel BuilderTranslationDomainPropertyInfo = "translation-domain"
    type AttrOrigin BuilderTranslationDomainPropertyInfo = Builder
    attrGet = getBuilderTranslationDomain
    attrSet = setBuilderTranslationDomain
    attrTransfer _ v = do
        return v
    attrConstruct = constructBuilderTranslationDomain
    attrClear = clearBuilderTranslationDomain
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.translationDomain"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#g:attr:translationDomain"
        })
#endif

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

#if defined(ENABLE_OVERLOADING)
builderCurrentObject :: AttrLabelProxy "currentObject"
builderCurrentObject = AttrLabelProxy

builderScope :: AttrLabelProxy "scope"
builderScope = AttrLabelProxy

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.
builderNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Builder
    -- ^ __Returns:__ a new (empty) @GtkBuilder@ object
builderNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Builder
builderNew  = IO Builder -> m Builder
forall a. IO a -> m a
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 Text
"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 a. a -> IO a
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 TFileName
--           , 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 TFileName
    IO (Ptr Builder)

-- | Parses the UI definition 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.
builderNewFromFile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    -- ^ /@filename@/: filename of user interface description file
    -> m Builder
    -- ^ __Returns:__ a @GtkBuilder@ containing the described interface
builderNewFromFile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
String -> m Builder
builderNewFromFile String
filename = IO Builder -> m Builder
forall a. IO a -> m a
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' <- String -> IO CString
stringToCString String
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 Text
"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 a. a -> IO a
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)

-- | Parses the UI definition at /@resourcePath@/.
-- 
-- If there is an error locating the resource or parsing the
-- description, then the program will be aborted.
builderNewFromResource ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@resourcePath@/: a @GResource@ resource path
    -> m Builder
    -- ^ __Returns:__ a @GtkBuilder@ containing the described interface
builderNewFromResource :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m Builder
builderNewFromResource Text
resourcePath = IO Builder -> m Builder
forall a. IO a -> m a
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 Text
"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 a. a -> IO a
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)

-- | Parses the UI definition in /@string@/.
-- 
-- 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.
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 @GtkBuilder@ containing the interface described by /@string@/
builderNewFromString :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Int64 -> m Builder
builderNewFromString Text
string Int64
length_ = IO Builder -> m Builder
forall a. IO a -> m a
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 Text
"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 a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Builder
result'

#if defined(ENABLE_OVERLOADING)
#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 TFileName
--           , 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 TBoolean)
-- 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 TFileName
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Parses a file containing a UI definition and merges it with
-- the current contents of /@builder@/.
-- 
-- This function is useful if you need to call
-- 'GI.Gtk.Objects.Builder.builderSetCurrentObject') to add user data to
-- callbacks before loading GtkBuilder UI. Otherwise, you probably
-- want 'GI.Gtk.Objects.Builder.builderNewFromFile' instead.
-- 
-- If an error occurs, 0 will be returned and /@error@/ will be assigned a
-- @GError@ from the @GTK_BUILDER_ERROR@, @G_MARKUP_ERROR@ or @G_FILE_ERROR@
-- domains.
-- 
-- 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 @GtkBuilder@
-- 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()@.
builderAddFromFile ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> [Char]
    -- ^ /@filename@/: the name of the file to parse
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderAddFromFile :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> String -> m ()
builderAddFromFile a
builder String
filename = IO () -> m ()
forall a. IO a -> m a
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
filename' <- String -> IO CString
stringToCString String
filename
    IO () -> IO () -> IO ()
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 -> CString -> Ptr (Ptr GError) -> IO CInt
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'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderAddFromFileMethodInfo
instance (signature ~ ([Char] -> m ()), MonadIO m, IsBuilder a) => O.OverloadedMethod BuilderAddFromFileMethodInfo a signature where
    overloadedMethod = builderAddFromFile

instance O.OverloadedMethodInfo BuilderAddFromFileMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderAddFromFile",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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 TBoolean)
-- 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 CInt

-- | Parses a resource file containing a UI definition
-- and merges it with the current contents of /@builder@/.
-- 
-- This function is useful if you need to call
-- 'GI.Gtk.Objects.Builder.builderSetCurrentObject' to add user data to
-- callbacks before loading GtkBuilder UI. Otherwise, you probably
-- want 'GI.Gtk.Objects.Builder.builderNewFromResource' instead.
-- 
-- If an error occurs, 0 will be returned and /@error@/ will be assigned a
-- @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()/@.
builderAddFromResource ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> T.Text
    -- ^ /@resourcePath@/: the path of the resource file to parse
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderAddFromResource :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> Text -> m ()
builderAddFromResource a
builder Text
resourcePath = IO () -> m ()
forall a. IO a -> m a
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
resourcePath' <- Text -> IO CString
textToCString Text
resourcePath
    IO () -> IO () -> IO ()
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 -> CString -> Ptr (Ptr GError) -> IO CInt
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'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
resourcePath'
     )

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

instance O.OverloadedMethodInfo BuilderAddFromResourceMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderAddFromResource",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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 TBoolean)
-- 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 CInt

-- | Parses a string containing a UI definition and merges it
-- with the current contents of /@builder@/.
-- 
-- This function is useful if you need to call
-- 'GI.Gtk.Objects.Builder.builderSetCurrentObject' to add user data to
-- callbacks before loading @GtkBuilder@ UI. Otherwise, you probably
-- want 'GI.Gtk.Objects.Builder.builderNewFromString' instead.
-- 
-- Upon errors 'P.False' will be returned and /@error@/ will be assigned a
-- @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()/@.
builderAddFromString ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> T.Text
    -- ^ /@buffer@/: the string to parse
    -> Int64
    -- ^ /@length@/: the length of /@buffer@/ (may be -1 if /@buffer@/ is nul-terminated)
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderAddFromString :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> Text -> Int64 -> m ()
builderAddFromString a
builder Text
buffer Int64
length_ = IO () -> m ()
forall a. IO a -> m a
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
buffer' <- Text -> IO CString
textToCString Text
buffer
    IO () -> IO () -> IO ()
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 -> CString -> Int64 -> Ptr (Ptr GError) -> IO CInt
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'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buffer'
     )

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

instance O.OverloadedMethodInfo BuilderAddFromStringMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderAddFromString",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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 TFileName
--           , 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 TBoolean)
-- 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 TFileName
    Ptr CString ->                          -- object_ids : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Parses a file containing a UI definition 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
-- @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 @GtkTreeView@ that depends on its
-- @GtkTreeModel@), you have to explicitly list all of them in /@objectIds@/.
builderAddObjectsFromFile ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> [Char]
    -- ^ /@filename@/: the name of the file to parse
    -> [T.Text]
    -- ^ /@objectIds@/: nul-terminated array of objects to build
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderAddObjectsFromFile :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> String -> [Text] -> m ()
builderAddObjectsFromFile a
builder String
filename [Text]
objectIds = IO () -> m ()
forall a. IO a -> m a
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
filename' <- String -> IO CString
stringToCString String
filename
    Ptr CString
objectIds' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
objectIds
    IO () -> IO () -> IO ()
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
-> CString -> Ptr CString -> Ptr (Ptr GError) -> IO CInt
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'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (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 ~ ([Char] -> [T.Text] -> m ()), MonadIO m, IsBuilder a) => O.OverloadedMethod BuilderAddObjectsFromFileMethodInfo a signature where
    overloadedMethod = builderAddObjectsFromFile

instance O.OverloadedMethodInfo BuilderAddObjectsFromFileMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderAddObjectsFromFile",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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 TBoolean)
-- 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 CInt

-- | Parses a resource file containing a UI definition, 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
-- @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 @GtkTreeView@ that depends on its
-- @GtkTreeModel@), you have to explicitly list all of them in /@objectIds@/.
builderAddObjectsFromResource ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> T.Text
    -- ^ /@resourcePath@/: the path of the resource file to parse
    -> [T.Text]
    -- ^ /@objectIds@/: nul-terminated array of objects to build
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderAddObjectsFromResource :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> Text -> [Text] -> m ()
builderAddObjectsFromResource a
builder Text
resourcePath [Text]
objectIds = IO () -> m ()
forall a. IO a -> m a
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
resourcePath' <- Text -> IO CString
textToCString Text
resourcePath
    Ptr CString
objectIds' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
objectIds
    IO () -> IO () -> IO ()
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
-> CString -> Ptr CString -> Ptr (Ptr GError) -> IO CInt
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'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (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 ()), MonadIO m, IsBuilder a) => O.OverloadedMethod BuilderAddObjectsFromResourceMethodInfo a signature where
    overloadedMethod = builderAddObjectsFromResource

instance O.OverloadedMethodInfo BuilderAddObjectsFromResourceMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderAddObjectsFromResource",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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 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
--           }
--       , 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 TBoolean)
-- 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
    Int64 ->                                -- length : TBasicType TInt64
    Ptr CString ->                          -- object_ids : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Parses a string containing a UI definition, building only the
-- requested objects and merges them with the current contents of
-- /@builder@/.
-- 
-- Upon errors 'P.False' will be returned and /@error@/ will be assigned a
-- @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 @GtkTreeView@ that depends on its
-- @GtkTreeModel@), you have to explicitly list all of them in /@objectIds@/.
builderAddObjectsFromString ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> T.Text
    -- ^ /@buffer@/: the string to parse
    -> Int64
    -- ^ /@length@/: the length of /@buffer@/ (may be -1 if /@buffer@/ is nul-terminated)
    -> [T.Text]
    -- ^ /@objectIds@/: nul-terminated array of objects to build
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderAddObjectsFromString :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> Text -> Int64 -> [Text] -> m ()
builderAddObjectsFromString a
builder Text
buffer Int64
length_ [Text]
objectIds = IO () -> m ()
forall a. IO a -> m a
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
buffer' <- Text -> IO CString
textToCString Text
buffer
    Ptr CString
objectIds' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
objectIds
    IO () -> IO () -> IO ()
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
-> CString -> Int64 -> Ptr CString -> Ptr (Ptr GError) -> IO CInt
gtk_builder_add_objects_from_string Ptr Builder
builder' CString
buffer' Int64
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'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (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 -> Int64 -> [T.Text] -> m ()), MonadIO m, IsBuilder a) => O.OverloadedMethod BuilderAddObjectsFromStringMethodInfo a signature where
    overloadedMethod = builderAddObjectsFromString

instance O.OverloadedMethodInfo BuilderAddObjectsFromStringMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderAddObjectsFromString",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderAddObjectsFromString"
        })


#endif

-- method Builder::create_closure
-- 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 = "function_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "name of the function to look up"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "Gtk" , name = "BuilderClosureFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "closure creation flags"
--                 , 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 = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Object to create the closure with"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TGClosure Nothing)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_builder_create_closure" gtk_builder_create_closure :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    CString ->                              -- function_name : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gtk", name = "BuilderClosureFlags"})
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr (GClosure ()))

-- | Creates a closure to invoke the function called /@functionName@/.
-- 
-- This is using the @/create_closure()/@ implementation of /@builder@/\'s
-- t'GI.Gtk.Interfaces.BuilderScope.BuilderScope'.
-- 
-- If no closure could be created, 'P.Nothing' will be returned and /@error@/
-- will be set.
builderCreateClosure ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a, GObject.Object.IsObject b) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> T.Text
    -- ^ /@functionName@/: name of the function to look up
    -> [Gtk.Flags.BuilderClosureFlags]
    -- ^ /@flags@/: closure creation flags
    -> Maybe (b)
    -- ^ /@object@/: Object to create the closure with
    -> m (Maybe (GClosure c))
    -- ^ __Returns:__ A new closure for invoking /@functionName@/ /(Can throw 'Data.GI.Base.GError.GError')/
builderCreateClosure :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsBuilder a, IsObject b) =>
a
-> Text
-> [BuilderClosureFlags]
-> Maybe b
-> m (Maybe (GClosure c))
builderCreateClosure a
builder Text
functionName [BuilderClosureFlags]
flags Maybe b
object = IO (Maybe (GClosure c)) -> m (Maybe (GClosure c))
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe (GClosure c)) -> m (Maybe (GClosure c)))
-> IO (Maybe (GClosure c)) -> m (Maybe (GClosure c))
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
functionName' <- Text -> IO CString
textToCString Text
functionName
    let flags' :: CUInt
flags' = [BuilderClosureFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [BuilderClosureFlags]
flags
    Ptr Object
maybeObject <- case Maybe b
object of
        Maybe b
Nothing -> Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
        Just b
jObject -> do
            Ptr Object
jObject' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jObject
            Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jObject'
    IO (Maybe (GClosure c)) -> IO () -> IO (Maybe (GClosure c))
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr (GClosure ())
result <- (Ptr (Ptr GError) -> IO (Ptr (GClosure ())))
-> IO (Ptr (GClosure ()))
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr (GClosure ())))
 -> IO (Ptr (GClosure ())))
-> (Ptr (Ptr GError) -> IO (Ptr (GClosure ())))
-> IO (Ptr (GClosure ()))
forall a b. (a -> b) -> a -> b
$ Ptr Builder
-> CString
-> CUInt
-> Ptr Object
-> Ptr (Ptr GError)
-> IO (Ptr (GClosure ()))
gtk_builder_create_closure Ptr Builder
builder' CString
functionName' CUInt
flags' Ptr Object
maybeObject
        Maybe (GClosure c)
maybeResult <- Ptr (GClosure ())
-> (Ptr (GClosure ()) -> IO (GClosure c))
-> IO (Maybe (GClosure c))
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr (GClosure ())
result ((Ptr (GClosure ()) -> IO (GClosure c)) -> IO (Maybe (GClosure c)))
-> (Ptr (GClosure ()) -> IO (GClosure c))
-> IO (Maybe (GClosure c))
forall a b. (a -> b) -> a -> b
$ \Ptr (GClosure ())
result' -> do
            GClosure c
result'' <- (Ptr (GClosure c) -> IO (GClosure c)
forall a. Ptr (GClosure a) -> IO (GClosure a)
B.GClosure.wrapGClosurePtr (Ptr (GClosure c) -> IO (GClosure c))
-> (Ptr (GClosure ()) -> Ptr (GClosure c))
-> Ptr (GClosure ())
-> IO (GClosure c)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr (GClosure ()) -> Ptr (GClosure c)
forall a b. Ptr a -> Ptr b
FP.castPtr) Ptr (GClosure ())
result'
            GClosure c -> IO (GClosure c)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GClosure c
result''
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
object b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
functionName'
        Maybe (GClosure c) -> IO (Maybe (GClosure c))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe (GClosure c)
maybeResult
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
functionName'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderCreateClosureMethodInfo
instance (signature ~ (T.Text -> [Gtk.Flags.BuilderClosureFlags] -> Maybe (b) -> m (Maybe (GClosure c))), MonadIO m, IsBuilder a, GObject.Object.IsObject b) => O.OverloadedMethod BuilderCreateClosureMethodInfo a signature where
    overloadedMethod = builderCreateClosure

instance O.OverloadedMethodInfo BuilderCreateClosureMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderCreateClosure",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderCreateClosure"
        })


#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.
-- 
-- Only a single object may be added using /@name@/. However,
-- it is not an error to expose the same object under multiple
-- names. @gtk_builder_get_object()@ may be used to determine
-- if an object has already been added with /@name@/.
builderExposeObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a, GObject.Object.IsObject b) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> T.Text
    -- ^ /@name@/: the name of the object exposed to the builder
    -> b
    -- ^ /@object@/: the object to expose
    -> m ()
builderExposeObject :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsBuilder a, IsObject b) =>
a -> Text -> b -> m ()
builderExposeObject a
builder Text
name b
object = IO () -> m ()
forall a. IO a -> m a
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 a. a -> IO a
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.OverloadedMethod BuilderExposeObjectMethodInfo a signature where
    overloadedMethod = builderExposeObject

instance O.OverloadedMethodInfo BuilderExposeObjectMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderExposeObject",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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 = "object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the object 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 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 TBoolean)
-- 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 GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    CGType ->                               -- template_type : TBasicType TGType
    CString ->                              -- buffer : TBasicType TUTF8
    Int64 ->                                -- length : TBasicType TInt64
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Main private entry point for building composite components
-- from template XML.
-- 
-- Most likely you do not need to call this function in applications as
-- templates are handled by @GtkWidget@.
builderExtendWithTemplate ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a, GObject.Object.IsObject b) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> b
    -- ^ /@object@/: the object that is being extended
    -> GType
    -- ^ /@templateType@/: the type that the template is for
    -> T.Text
    -- ^ /@buffer@/: the string to parse
    -> Int64
    -- ^ /@length@/: the length of /@buffer@/ (may be -1 if /@buffer@/ is nul-terminated)
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderExtendWithTemplate :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsBuilder a, IsObject b) =>
a -> b -> GType -> Text -> Int64 -> m ()
builderExtendWithTemplate a
builder b
object GType
templateType Text
buffer Int64
length_ = IO () -> m ()
forall a. IO a -> m a
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 Object
object' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
object
    let templateType' :: CGType
templateType' = GType -> CGType
gtypeToCGType GType
templateType
    CString
buffer' <- Text -> IO CString
textToCString Text
buffer
    IO () -> IO () -> IO ()
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 Object
-> CGType
-> CString
-> Int64
-> Ptr (Ptr GError)
-> IO CInt
gtk_builder_extend_with_template Ptr Builder
builder' Ptr Object
object' CGType
templateType' CString
buffer' Int64
length_
        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
buffer'
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buffer'
     )

#if defined(ENABLE_OVERLOADING)
data BuilderExtendWithTemplateMethodInfo
instance (signature ~ (b -> GType -> T.Text -> Int64 -> m ()), MonadIO m, IsBuilder a, GObject.Object.IsObject b) => O.OverloadedMethod BuilderExtendWithTemplateMethodInfo a signature where
    overloadedMethod = builderExtendWithTemplate

instance O.OverloadedMethodInfo BuilderExtendWithTemplateMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderExtendWithTemplate",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderExtendWithTemplate"
        })


#endif

-- method Builder::get_current_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
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GObject" , name = "Object" })
-- throws : False
-- Skip return : False

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

-- | Gets the current object set via 'GI.Gtk.Objects.Builder.builderSetCurrentObject'.
builderGetCurrentObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> m (Maybe GObject.Object.Object)
    -- ^ __Returns:__ the current object
builderGetCurrentObject :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> m (Maybe Object)
builderGetCurrentObject a
builder = IO (Maybe Object) -> m (Maybe Object)
forall a. IO a -> m a
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
    Ptr Object
result <- Ptr Builder -> IO (Ptr Object)
gtk_builder_get_current_object Ptr Builder
builder'
    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
$ \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 a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Object
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    Maybe Object -> IO (Maybe Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Object
maybeResult

#if defined(ENABLE_OVERLOADING)
data BuilderGetCurrentObjectMethodInfo
instance (signature ~ (m (Maybe GObject.Object.Object)), MonadIO m, IsBuilder a) => O.OverloadedMethod BuilderGetCurrentObjectMethodInfo a signature where
    overloadedMethod = builderGetCurrentObject

instance O.OverloadedMethodInfo BuilderGetCurrentObjectMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderGetCurrentObject",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderGetCurrentObject"
        })


#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.
builderGetObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> T.Text
    -- ^ /@name@/: name of object to get
    -> m (Maybe GObject.Object.Object)
    -- ^ __Returns:__ the object named /@name@/
builderGetObject :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> Text -> m (Maybe Object)
builderGetObject a
builder Text
name = IO (Maybe Object) -> m (Maybe Object)
forall a. IO a -> m a
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
$ \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 a. a -> IO a
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 a. a -> IO a
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.OverloadedMethod BuilderGetObjectMethodInfo a signature where
    overloadedMethod = builderGetObject

instance O.OverloadedMethodInfo BuilderGetObjectMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderGetObject",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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.
builderGetObjects ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> m [GObject.Object.Object]
    -- ^ __Returns:__ a
    --   newly-allocated @GSList@ containing all the objects
    --   constructed by the @GtkBuilder instance@. It should be
    --   freed by @/g_slist_free()/@
builderGetObjects :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> m [Object]
builderGetObjects a
builder = IO [Object] -> m [Object]
forall a. IO a -> m a
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)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [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 a. a -> IO a
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.OverloadedMethod BuilderGetObjectsMethodInfo a signature where
    overloadedMethod = builderGetObjects

instance O.OverloadedMethodInfo BuilderGetObjectsMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderGetObjects",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderGetObjects"
        })


#endif

-- method Builder::get_scope
-- 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 = "BuilderScope" })
-- throws : False
-- Skip return : False

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

-- | Gets the scope in use that was set via 'GI.Gtk.Objects.Builder.builderSetScope'.
builderGetScope ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> m Gtk.BuilderScope.BuilderScope
    -- ^ __Returns:__ the current scope
builderGetScope :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> m BuilderScope
builderGetScope a
builder = IO BuilderScope -> m BuilderScope
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO BuilderScope -> m BuilderScope)
-> IO BuilderScope -> m BuilderScope
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 BuilderScope
result <- Ptr Builder -> IO (Ptr BuilderScope)
gtk_builder_get_scope Ptr Builder
builder'
    Text -> Ptr BuilderScope -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"builderGetScope" Ptr BuilderScope
result
    BuilderScope
result' <- ((ManagedPtr BuilderScope -> BuilderScope)
-> Ptr BuilderScope -> IO BuilderScope
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr BuilderScope -> BuilderScope
Gtk.BuilderScope.BuilderScope) Ptr BuilderScope
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    BuilderScope -> IO BuilderScope
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return BuilderScope
result'

#if defined(ENABLE_OVERLOADING)
data BuilderGetScopeMethodInfo
instance (signature ~ (m Gtk.BuilderScope.BuilderScope), MonadIO m, IsBuilder a) => O.OverloadedMethod BuilderGetScopeMethodInfo a signature where
    overloadedMethod = builderGetScope

instance O.OverloadedMethodInfo BuilderGetScopeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderGetScope",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderGetScope"
        })


#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@/.
builderGetTranslationDomain ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> m (Maybe T.Text)
    -- ^ __Returns:__ the translation domain
builderGetTranslationDomain :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> m (Maybe Text)
builderGetTranslationDomain a
builder = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe 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'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult

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

instance O.OverloadedMethodInfo BuilderGetTranslationDomainMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderGetTranslationDomain",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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.
-- 
-- This is using the virtual function that @GtkBuilder@ has
-- for that purpose. This is mainly used when implementing
-- the @GtkBuildable@ interface on a type.
builderGetTypeFromName ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> T.Text
    -- ^ /@typeName@/: type name to lookup
    -> m GType
    -- ^ __Returns:__ the @GType@ found for /@typeName@/ or @/G_TYPE_INVALID/@
    --   if no type was found
builderGetTypeFromName :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> Text -> m GType
builderGetTypeFromName a
builder Text
typeName = IO GType -> m GType
forall a. IO a -> m a
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
    CGType
result <- Ptr Builder -> CString -> IO CGType
gtk_builder_get_type_from_name Ptr Builder
builder' CString
typeName'
    let result' :: GType
result' = CGType -> GType
GType CGType
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 a. a -> IO a
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.OverloadedMethod BuilderGetTypeFromNameMethodInfo a signature where
    overloadedMethod = builderGetTypeFromName

instance O.OverloadedMethodInfo BuilderGetTypeFromNameMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderGetTypeFromName",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderGetTypeFromName"
        })


#endif

-- method Builder::set_current_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 = "current_object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the new current object"
--                 , 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_current_object" gtk_builder_set_current_object :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    Ptr GObject.Object.Object ->            -- current_object : TInterface (Name {namespace = "GObject", name = "Object"})
    IO ()

-- | Sets the current object for the /@builder@/.
-- 
-- The current object can be thought of as the @this@ object that the
-- builder is working for and will often be used as the default object
-- when an object is optional.
-- 
-- 'GI.Gtk.Objects.Widget.widgetInitTemplate' for example will set the current
-- object to the widget the template is inited for. For functions like
-- 'GI.Gtk.Objects.Builder.builderNewFromResource', the current object will be 'P.Nothing'.
builderSetCurrentObject ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a, GObject.Object.IsObject b) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> Maybe (b)
    -- ^ /@currentObject@/: the new current object
    -> m ()
builderSetCurrentObject :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsBuilder a, IsObject b) =>
a -> Maybe b -> m ()
builderSetCurrentObject a
builder Maybe b
currentObject = IO () -> m ()
forall a. IO a -> m a
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 Object
maybeCurrentObject <- case Maybe b
currentObject of
        Maybe b
Nothing -> Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
        Just b
jCurrentObject -> do
            Ptr Object
jCurrentObject' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCurrentObject
            Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jCurrentObject'
    Ptr Builder -> Ptr Object -> IO ()
gtk_builder_set_current_object Ptr Builder
builder' Ptr Object
maybeCurrentObject
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
currentObject b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BuilderSetCurrentObjectMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsBuilder a, GObject.Object.IsObject b) => O.OverloadedMethod BuilderSetCurrentObjectMethodInfo a signature where
    overloadedMethod = builderSetCurrentObject

instance O.OverloadedMethodInfo BuilderSetCurrentObjectMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderSetCurrentObject",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderSetCurrentObject"
        })


#endif

-- method Builder::set_scope
-- 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 = "scope"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "BuilderScope" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the scope to use" , 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_scope" gtk_builder_set_scope :: 
    Ptr Builder ->                          -- builder : TInterface (Name {namespace = "Gtk", name = "Builder"})
    Ptr Gtk.BuilderScope.BuilderScope ->    -- scope : TInterface (Name {namespace = "Gtk", name = "BuilderScope"})
    IO ()

-- | Sets the scope the builder should operate in.
-- 
-- If /@scope@/ is 'P.Nothing', a new t'GI.Gtk.Objects.BuilderCScope.BuilderCScope' will be created.
builderSetScope ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a, Gtk.BuilderScope.IsBuilderScope b) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> Maybe (b)
    -- ^ /@scope@/: the scope to use
    -> m ()
builderSetScope :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsBuilder a, IsBuilderScope b) =>
a -> Maybe b -> m ()
builderSetScope a
builder Maybe b
scope = IO () -> m ()
forall a. IO a -> m a
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 BuilderScope
maybeScope <- case Maybe b
scope of
        Maybe b
Nothing -> Ptr BuilderScope -> IO (Ptr BuilderScope)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr BuilderScope
forall a. Ptr a
nullPtr
        Just b
jScope -> do
            Ptr BuilderScope
jScope' <- b -> IO (Ptr BuilderScope)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jScope
            Ptr BuilderScope -> IO (Ptr BuilderScope)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr BuilderScope
jScope'
    Ptr Builder -> Ptr BuilderScope -> IO ()
gtk_builder_set_scope Ptr Builder
builder' Ptr BuilderScope
maybeScope
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
builder
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
scope b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data BuilderSetScopeMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsBuilder a, Gtk.BuilderScope.IsBuilderScope b) => O.OverloadedMethod BuilderSetScopeMethodInfo a signature where
    overloadedMethod = builderSetScope

instance O.OverloadedMethodInfo BuilderSetScopeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderSetScope",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderSetScope"
        })


#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"
--                 , 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@/.
builderSetTranslationDomain ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> Maybe (T.Text)
    -- ^ /@domain@/: the translation domain
    -> m ()
builderSetTranslationDomain :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> Maybe Text -> m ()
builderSetTranslationDomain a
builder Maybe Text
domain = IO () -> m ()
forall a. IO a -> m a
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
        Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jDomain -> do
            CString
jDomain' <- Text -> IO CString
textToCString Text
jDomain
            CString -> IO CString
forall a. a -> IO a
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 a. a -> IO a
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.OverloadedMethod BuilderSetTranslationDomainMethodInfo a signature where
    overloadedMethod = builderSetTranslationDomain

instance O.OverloadedMethodInfo BuilderSetTranslationDomainMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderSetTranslationDomain",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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 = TGValue
--           , 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 : TGValue
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | 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.
-- 
-- Can handle char, uchar, boolean, int, uint, long,
-- ulong, enum, flags, float, double, string, @GdkRGBA@ and
-- @GtkAdjustment@ type values.
-- 
-- Upon errors 'P.False' will be returned and /@error@/ will be
-- assigned a @GError@ from the @/GTK_BUILDER_ERROR/@ domain.
builderValueFromString ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> GParamSpec
    -- ^ /@pspec@/: the @GParamSpec@ for the property
    -> T.Text
    -- ^ /@string@/: the string representation of the value
    -> m (GValue)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderValueFromString :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> GParamSpec -> Text -> m GValue
builderValueFromString a
builder GParamSpec
pspec Text
string = IO GValue -> m GValue
forall a. IO a -> m a
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. Int -> IO (Ptr a)
SP.callocBytes Int
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' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr 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 a. a -> IO a
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.OverloadedMethod BuilderValueFromStringMethodInfo a signature where
    overloadedMethod = builderValueFromString

instance O.OverloadedMethodInfo BuilderValueFromStringMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderValueFromString",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v: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 = TGValue
--           , 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 : TGValue
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Demarshals a value from a string.
-- 
-- Unlike 'GI.Gtk.Objects.Builder.builderValueFromString', this function
-- takes a @GType@ instead of @GParamSpec@.
-- 
-- 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 @GError@ from the @/GTK_BUILDER_ERROR/@ domain.
builderValueFromStringType ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuilder a) =>
    a
    -- ^ /@builder@/: a @GtkBuilder@
    -> GType
    -- ^ /@type@/: the @GType@ of the value
    -> T.Text
    -- ^ /@string@/: the string representation of the value
    -> m (GValue)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
builderValueFromStringType :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBuilder a) =>
a -> GType -> Text -> m GValue
builderValueFromStringType a
builder GType
type_ Text
string = IO GValue -> m GValue
forall a. IO a -> m a
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_' :: CGType
type_' = GType -> CGType
gtypeToCGType GType
type_
    CString
string' <- Text -> IO CString
textToCString Text
string
    Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
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
-> CGType -> CString -> Ptr GValue -> Ptr (Ptr GError) -> IO CInt
gtk_builder_value_from_string_type Ptr Builder
builder' CGType
type_' CString
string' Ptr GValue
value
        GValue
value' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr 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 a. a -> IO a
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.OverloadedMethod BuilderValueFromStringTypeMethodInfo a signature where
    overloadedMethod = builderValueFromStringType

instance O.OverloadedMethodInfo BuilderValueFromStringTypeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Builder.builderValueFromStringType",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.6/docs/GI-Gtk-Objects-Builder.html#v:builderValueFromStringType"
        })


#endif