    {-# LINE 2 "./Graphics/UI/Gtk/Builder.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) XML Interface Parser
    --
    -- Author: John Millikin
    --
    -- Created: 19 November 2009
    --
    -- Copyright (C) 2009 John Millikin
    --
    -- This library is free software; you can redistribute it and/or
    -- modify it under the terms of the GNU Lesser General Public
    -- License as published by the Free Software Foundation; either
    -- version 2.1 of the License, or (at your option) any later version.
    --
    -- This library is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    -- Lesser General Public License for more details.
    --
    -- Notes:
    --
    -- Like the @libglade@ bindings, this module does not support signal
    -- auto-connection.
    --
    -- |
    -- Maintainer : gtk2hs-users@lists.sourceforge.net
    -- Stability : provisional
    -- Portability : portable (depends on GHC)
    --
    -- Build an interface from an XML UI definition
    --
    -- All functions in this module are only available in Gtk 2.12 or higher.
    --
    module Graphics.UI.Gtk.Builder

      (
    -- * Detail
    --
    -- A 'Builder' is an auxiliary object that reads textual descriptions of a
    -- user interface and instantiates the described objects. To pass a
    -- description to a 'Builder', perform 'builderAddFromFile' or
    -- 'builderAddFromString'. These computations can be performed multiple
    -- times; the builder merges the content of all descriptions.
    --
    -- A 'Builder' 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 perform 'widgetDestroy' to get rid
    -- of them and all the widgets they contain.
    --
    -- The computations 'builderGetObject' and '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
    -- 'widgetDestroy'. Other widgets will either be part of a larger hierarchy
    -- constructed by the builder (in which case you should not have to worry
    -- about their lifecycle), or without a parent, in which case they have to
    -- be added to some container to make use of them. Non-widget objects need
    -- to be reffed with 'objectRef' to keep them beyond the lifespan of the
    -- builder.
    --
    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----'GtkBuilder'
    -- @

    -- * Types
        Builder
      , BuilderClass
      , castToBuilder
      , gTypeBuilder
      , toBuilder
      , BuilderError (..)

    -- * Constructing and adding objects
      , builderNew
      , builderAddFromFile
      , builderAddFromString

      , builderAddObjectsFromFile
      , builderAddObjectsFromString

    -- * Retrieving objects
      , builderGetObject
      , builderGetObjects
      , builderGetObjectRaw
      , builderSetTranslationDomain
      , builderGetTranslationDomain
      ) where

    import Control.Exception (evaluate, throwIO, ErrorCall (..))
    import System.Glib.FFI
    import System.Glib.GError
    import System.Glib.GList
    import System.Glib.UTFString
    import Graphics.UI.Gtk.Types
    {-# LINE 104 "./Graphics/UI/Gtk/Builder.chs" #-}

    {-# LINE 106 "./Graphics/UI/Gtk/Builder.chs" #-}

    data BuilderError = BuilderErrorInvalidTypeFunction
                      | BuilderErrorUnhandledTag
                      | BuilderErrorMissingAttribute
                      | BuilderErrorInvalidAttribute
                      | BuilderErrorInvalidTag
                      | BuilderErrorMissingPropertyValue
                      | BuilderErrorInvalidValue
                      | BuilderErrorVersionMismatch
                      | BuilderErrorDuplicateId
                      | BuilderErrorObjectTypeRefused
                      | BuilderErrorTemplateMismatch
                      | BuilderErrorInvalidProperty
                      | BuilderErrorInvalidSignal
                      | BuilderErrorInvalidId
                      deriving (Int -> BuilderError
    BuilderError -> Int
    BuilderError -> [BuilderError]
    BuilderError -> BuilderError
    BuilderError -> BuilderError -> [BuilderError]
    BuilderError -> BuilderError -> BuilderError -> [BuilderError]
    (BuilderError -> BuilderError)
    -> (BuilderError -> BuilderError)
    -> (Int -> BuilderError)
    -> (BuilderError -> Int)
    -> (BuilderError -> [BuilderError])
    -> (BuilderError -> BuilderError -> [BuilderError])
    -> (BuilderError -> BuilderError -> [BuilderError])
    -> (BuilderError -> BuilderError -> BuilderError -> [BuilderError])
    -> Enum BuilderError
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: BuilderError -> BuilderError
    succ :: BuilderError -> BuilderError
    $cpred :: BuilderError -> BuilderError
    pred :: BuilderError -> BuilderError
    $ctoEnum :: Int -> BuilderError
    toEnum :: Int -> BuilderError
    $cfromEnum :: BuilderError -> Int
    fromEnum :: BuilderError -> Int
    $cenumFrom :: BuilderError -> [BuilderError]
    enumFrom :: BuilderError -> [BuilderError]
    $cenumFromThen :: BuilderError -> BuilderError -> [BuilderError]
    enumFromThen :: BuilderError -> BuilderError -> [BuilderError]
    $cenumFromTo :: BuilderError -> BuilderError -> [BuilderError]
    enumFromTo :: BuilderError -> BuilderError -> [BuilderError]
    $cenumFromThenTo :: BuilderError -> BuilderError -> BuilderError -> [BuilderError]
    enumFromThenTo :: BuilderError -> BuilderError -> BuilderError -> [BuilderError]
    Enum,Int -> BuilderError -> ShowS
    [BuilderError] -> ShowS
    BuilderError -> String
    (Int -> BuilderError -> ShowS)
    -> (BuilderError -> String)
    -> ([BuilderError] -> ShowS)
    -> Show BuilderError
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> BuilderError -> ShowS
    showsPrec :: Int -> BuilderError -> ShowS
    $cshow :: BuilderError -> String
    show :: BuilderError -> String
    $cshowList :: [BuilderError] -> ShowS
    showList :: [BuilderError] -> ShowS
    Show,BuilderError -> BuilderError -> Bool
    (BuilderError -> BuilderError -> Bool)
    -> (BuilderError -> BuilderError -> Bool) -> Eq BuilderError
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: BuilderError -> BuilderError -> Bool
    == :: BuilderError -> BuilderError -> Bool
    $c/= :: BuilderError -> BuilderError -> Bool
    /= :: BuilderError -> BuilderError -> Bool
    Eq)

    {-# LINE 108 "./Graphics/UI/Gtk/Builder.chs" #-}

    ---------------------------------------
    -- Constructing and adding objects

    -- | Creates a new 'Builder' object.
    builderNew :: IO Builder
    builderNew =
      wrapNewGObject mkBuilder $
      gtk_builder_new
    {-# LINE 117 "./Graphics/UI/Gtk/Builder.chs" #-}

    -- | Parses a file containing a GtkBuilder UI definition and merges it with
    -- the current contents of the 'Builder'.
    --
    -- * If an error occurs, the computation will throw an exception that can
    -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the
    -- error codes in 'BuilderError'.
    --
    builderAddFromFile :: GlibFilePath fp => Builder -> fp -> IO ()
    builderAddFromFile :: forall fp. GlibFilePath fp => Builder -> fp -> IO ()
    builderAddFromFile Builder
    builder fp
    path =
      (Ptr (Ptr ()) -> IO ()) -> IO ()
    forall a. (Ptr (Ptr ()) -> IO a) -> IO a
    propagateGError ((Ptr (Ptr ()) -> IO ()) -> IO ())
    -> (Ptr (Ptr ()) -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr (Ptr ())
    errPtrPtr ->
      fp -> (CString -> IO ()) -> IO ()
    forall a. fp -> (CString -> IO a) -> IO a
    forall fp a. GlibFilePath fp => fp -> (CString -> IO a) -> IO a
    withUTFFilePath fp
    path ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \CString
    pathPtr ->
      (\(Builder ForeignPtr Builder
    arg1) CString
    arg2 Ptr (Ptr ())
    arg3 -> ForeignPtr Builder -> (Ptr Builder -> IO CUInt) -> IO CUInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Builder
    arg1 ((Ptr Builder -> IO CUInt) -> IO CUInt)
    -> (Ptr Builder -> IO CUInt) -> IO CUInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr Builder
    argPtr1 ->Ptr Builder -> CString -> Ptr (Ptr ()) -> IO CUInt
    gtk_builder_add_from_file Ptr Builder
    argPtr1 CString
    arg2 Ptr (Ptr ())
    arg3)
    {-# LINE 130 "./Graphics/UI/Gtk/Builder.chs" #-}
        builder CString
    pathPtr Ptr (Ptr ())
    errPtrPtr
        IO CUInt -> IO () -> IO ()
    forall a b. IO a -> IO b -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

    -- | Parses a string containing a GtkBuilder UI definition and merges it
    -- with the current contents of the 'Builder'.
    --
    -- * If an error occurs, the computation will throw an exception that can
    -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the
    -- error codes in 'BuilderError'.
    --
    builderAddFromString :: GlibString string => Builder -> string -> IO ()
    builderAddFromString :: forall string. GlibString string => Builder -> string -> IO ()
    builderAddFromString Builder
    builder string
    str =
      (Ptr (Ptr ()) -> IO ()) -> IO ()
    forall a. (Ptr (Ptr ()) -> IO a) -> IO a
    propagateGError ((Ptr (Ptr ()) -> IO ()) -> IO ())
    -> (Ptr (Ptr ()) -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr (Ptr ())
    errPtrPtr ->
      string -> (CStringLen -> IO ()) -> IO ()
    forall a. string -> (CStringLen -> IO a) -> IO a
    forall s a. GlibString s => s -> (CStringLen -> IO a) -> IO a
    withUTFStringLen string
    str ((CStringLen -> IO ()) -> IO ()) -> (CStringLen -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \(CString
    strPtr, Int
    strLen) ->
      (\(Builder ForeignPtr Builder
    arg1) CString
    arg2 CULong
    arg3 Ptr (Ptr ())
    arg4 -> ForeignPtr Builder -> (Ptr Builder -> IO CUInt) -> IO CUInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Builder
    arg1 ((Ptr Builder -> IO CUInt) -> IO CUInt)
    -> (Ptr Builder -> IO CUInt) -> IO CUInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr Builder
    argPtr1 ->Ptr Builder -> CString -> CULong -> Ptr (Ptr ()) -> IO CUInt
    gtk_builder_add_from_string Ptr Builder
    argPtr1 CString
    arg2 CULong
    arg3 Ptr (Ptr ())
    arg4)
    {-# LINE 145 "./Graphics/UI/Gtk/Builder.chs" #-}
        builder CString
    strPtr (Int -> CULong
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    strLen) Ptr (Ptr ())
    errPtrPtr
        IO CUInt -> IO () -> IO ()
    forall a b. IO a -> IO b -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

    -- | Parses a file containing a GtkBuilder UI definition building only
    -- the requested objects and merges them with the current contents of
    -- the 'Builder'.
    --
    -- * If an error occurs, the computation will throw an exception that can
    -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the
    -- error codes in 'BuilderError'.
    --
    builderAddObjectsFromFile :: (GlibString string, GlibFilePath fp)
     => Builder
     -> fp
     -> [string] -- ^ Object IDs
     -> IO ()
    builderAddObjectsFromFile :: forall string fp.
    (GlibString string, GlibFilePath fp) =>
    Builder -> fp -> [string] -> IO ()
    builderAddObjectsFromFile Builder
    builder fp
    path [string]
    ids =
      (Ptr (Ptr ()) -> IO ()) -> IO ()
    forall a. (Ptr (Ptr ()) -> IO a) -> IO a
    propagateGError ((Ptr (Ptr ()) -> IO ()) -> IO ())
    -> (Ptr (Ptr ()) -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr (Ptr ())
    errPtrPtr ->
      fp -> (CString -> IO ()) -> IO ()
    forall a. fp -> (CString -> IO a) -> IO a
    forall fp a. GlibFilePath fp => fp -> (CString -> IO a) -> IO a
    withUTFFilePath fp
    path ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \CString
    pathPtr ->
      [string] -> (Ptr CString -> IO ()) -> IO ()
    forall s a. GlibString s => [s] -> (Ptr CString -> IO a) -> IO a
    withUTFStringArray0 [string]
    ids ((Ptr CString -> IO ()) -> IO ())
    -> (Ptr CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CString
    idsPtr ->
      (\(Builder ForeignPtr Builder
    arg1) CString
    arg2 Ptr CString
    arg3 Ptr (Ptr ())
    arg4 -> ForeignPtr Builder -> (Ptr Builder -> IO CUInt) -> IO CUInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Builder
    arg1 ((Ptr Builder -> IO CUInt) -> IO CUInt)
    -> (Ptr Builder -> IO CUInt) -> IO CUInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr Builder
    argPtr1 ->Ptr Builder -> CString -> Ptr CString -> Ptr (Ptr ()) -> IO CUInt
    gtk_builder_add_objects_from_file Ptr Builder
    argPtr1 CString
    arg2 Ptr CString
    arg3 Ptr (Ptr ())
    arg4)
    {-# LINE 167 "./Graphics/UI/Gtk/Builder.chs" #-}
        builder CString
    pathPtr Ptr CString
    idsPtr Ptr (Ptr ())
    errPtrPtr
        IO CUInt -> IO () -> IO ()
    forall a b. IO a -> IO b -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

    -- | Parses a string containing a GtkBuilder UI definition building only
    -- the requested objects and merges them with the current contents of
    -- the 'Builder'.
    --
    -- * If an error occurs, the computation will throw an exception that can
    -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the
    -- error codes in 'BuilderError'.
    --
    builderAddObjectsFromString :: GlibString string
     => Builder
     -> string
     -> [string] -- ^ Object IDs
     -> IO ()
    builderAddObjectsFromString :: forall string.
    GlibString string =>
    Builder -> string -> [string] -> IO ()
    builderAddObjectsFromString Builder
    builder string
    str [string]
    ids =
      (Ptr (Ptr ()) -> IO ()) -> IO ()
    forall a. (Ptr (Ptr ()) -> IO a) -> IO a
    propagateGError ((Ptr (Ptr ()) -> IO ()) -> IO ())
    -> (Ptr (Ptr ()) -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr (Ptr ())
    errPtrPtr ->
      string -> (CStringLen -> IO ()) -> IO ()
    forall a. string -> (CStringLen -> IO a) -> IO a
    forall s a. GlibString s => s -> (CStringLen -> IO a) -> IO a
    withUTFStringLen string
    str ((CStringLen -> IO ()) -> IO ()) -> (CStringLen -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \(CString
    strPtr, Int
    strLen) ->
      [string] -> (Ptr CString -> IO ()) -> IO ()
    forall s a. GlibString s => [s] -> (Ptr CString -> IO a) -> IO a
    withUTFStringArray0 [string]
    ids ((Ptr CString -> IO ()) -> IO ())
    -> (Ptr CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CString
    idsPtr ->
      (\(Builder ForeignPtr Builder
    arg1) CString
    arg2 CULong
    arg3 Ptr CString
    arg4 Ptr (Ptr ())
    arg5 -> ForeignPtr Builder -> (Ptr Builder -> IO CUInt) -> IO CUInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Builder
    arg1 ((Ptr Builder -> IO CUInt) -> IO CUInt)
    -> (Ptr Builder -> IO CUInt) -> IO CUInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr Builder
    argPtr1 ->Ptr Builder
    -> CString -> CULong -> Ptr CString -> Ptr (Ptr ()) -> IO CUInt
    gtk_builder_add_objects_from_string Ptr Builder
    argPtr1 CString
    arg2 CULong
    arg3 Ptr CString
    arg4 Ptr (Ptr ())
    arg5)
    {-# LINE 188 "./Graphics/UI/Gtk/Builder.chs" #-}
        builder CString
    strPtr (Int -> CULong
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    strLen) Ptr CString
    idsPtr Ptr (Ptr ())
    errPtrPtr
        IO CUInt -> IO () -> IO ()
    forall a b. IO a -> IO b -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

    ---------------------------------------
    -- Retrieving objects

    -- | Gets the object with the given name. Note that this computation does
    -- not increment the reference count of the returned object.
    builderGetObjectRaw :: GlibString string => Builder
     -> string -- The ID of the object in the UI file, eg \"button1\".
     -> IO (Maybe GObject)
    builderGetObjectRaw :: forall string.
    GlibString string =>
    Builder -> string -> IO (Maybe GObject)
    builderGetObjectRaw Builder
    builder string
    name =
      string -> (CString -> IO (Maybe GObject)) -> IO (Maybe GObject)
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    name ((CString -> IO (Maybe GObject)) -> IO (Maybe GObject))
    -> (CString -> IO (Maybe GObject)) -> IO (Maybe GObject)
    forall a b. (a -> b) -> a -> b
    $ \CString
    namePtr ->
      (IO (Ptr GObject) -> IO GObject)
    -> IO (Ptr GObject) -> IO (Maybe GObject)
    forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
    maybeNull ((ForeignPtr GObject -> GObject, FinalizerPtr GObject)
    -> IO (Ptr GObject) -> IO GObject
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewGObject (ForeignPtr GObject -> GObject, FinalizerPtr GObject)
    forall {a}. (ForeignPtr GObject -> GObject, FinalizerPtr a)
    mkGObject) (IO (Ptr GObject) -> IO (Maybe GObject))
    -> IO (Ptr GObject) -> IO (Maybe GObject)
    forall a b. (a -> b) -> a -> b
    $
      (\(Builder ForeignPtr Builder
    arg1) CString
    arg2 -> ForeignPtr Builder
    -> (Ptr Builder -> IO (Ptr GObject)) -> IO (Ptr GObject)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Builder
    arg1 ((Ptr Builder -> IO (Ptr GObject)) -> IO (Ptr GObject))
    -> (Ptr Builder -> IO (Ptr GObject)) -> IO (Ptr GObject)
    forall a b. (a -> b) -> a -> b
    $ \Ptr Builder
    argPtr1 ->Ptr Builder -> CString -> IO (Ptr GObject)
    gtk_builder_get_object Ptr Builder
    argPtr1 CString
    arg2)
    {-# LINE 204 "./Graphics/UI/Gtk/Builder.chs" #-}
        builder CString
    namePtr

    -- | Gets the object with the given name, with a conversion function. Note
    -- that this computation does not increment the reference count of the
    -- returned object.
    --
    -- If the object with the given ID is not of the requested type, an
    -- exception will be thrown.
    --
    builderGetObject :: (GObjectClass cls, GlibString string) =>
        Builder
     -> (GObject -> cls) -- ^ A dynamic cast function which returns an object
                         -- of the expected type, eg 'castToButton'
     -> string -- The ID of the object in the UI file, eg \"button1\".
     -> IO cls
    builderGetObject :: forall cls string.
    (GObjectClass cls, GlibString string) =>
    Builder -> (GObject -> cls) -> string -> IO cls
    builderGetObject Builder
    builder GObject -> cls
    cast string
    name = do
      raw <- Builder -> string -> IO (Maybe GObject)
    forall string.
    GlibString string =>
    Builder -> string -> IO (Maybe GObject)
    builderGetObjectRaw Builder
    builder string
    name
      case raw of
        Just GObject
    obj -> cls -> IO cls
    forall a. a -> IO a
    evaluate (cls -> IO cls) -> (GObject -> cls) -> GObject -> IO cls
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . GObject -> cls
    cast (GObject -> IO cls) -> GObject -> IO cls
    forall a b. (a -> b) -> a -> b
    $ GObject
    obj
        Maybe GObject
    Nothing -> ErrorCall -> IO cls
    forall e a. (HasCallStack, Exception e) => e -> IO a
    throwIO (ErrorCall -> IO cls) -> (String -> ErrorCall) -> String -> IO cls
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ErrorCall
    ErrorCall (String -> IO cls) -> String -> IO cls
    forall a b. (a -> b) -> a -> b
    $
          String
    "Gtk.Builder.builderGetObject: no object named " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ string -> String
    forall a. Show a => a -> String
    show string
    name String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    " in the builder."

    -- | Gets all objects that have been constructed by builder. Note that this
    -- computation does not increment the reference counts of the returned
    -- objects.
    builderGetObjects :: Builder -> IO [GObject]
    builderGetObjects :: Builder -> IO [GObject]
    builderGetObjects Builder
    builder =
      (\(Builder ForeignPtr Builder
    arg1) -> ForeignPtr Builder -> (Ptr Builder -> IO (Ptr ())) -> IO (Ptr ())
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Builder
    arg1 ((Ptr Builder -> IO (Ptr ())) -> IO (Ptr ()))
    -> (Ptr Builder -> IO (Ptr ())) -> IO (Ptr ())
    forall a b. (a -> b) -> a -> b
    $ \Ptr Builder
    argPtr1 ->Ptr Builder -> IO (Ptr ())
    gtk_builder_get_objects Ptr Builder
    argPtr1)
    {-# LINE 232 "./Graphics/UI/Gtk/Builder.chs" #-}
        builder
        IO (Ptr ()) -> (Ptr () -> IO [Ptr GObject]) -> IO [Ptr GObject]
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Ptr () -> IO [Ptr GObject]
    forall a. Ptr () -> IO [Ptr a]
    readGSList
        IO [Ptr GObject] -> ([Ptr GObject] -> IO [GObject]) -> IO [GObject]
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= (Ptr GObject -> IO GObject) -> [Ptr GObject] -> IO [GObject]
    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 ((ForeignPtr GObject -> GObject, FinalizerPtr GObject)
    -> IO (Ptr GObject) -> IO GObject
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewGObject (ForeignPtr GObject -> GObject, FinalizerPtr GObject)
    forall {a}. (ForeignPtr GObject -> GObject, FinalizerPtr a)
    mkGObject (IO (Ptr GObject) -> IO GObject)
    -> (Ptr GObject -> IO (Ptr GObject)) -> Ptr GObject -> IO GObject
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Ptr GObject -> IO (Ptr GObject)
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return)

    -- | Sets the translation domain of the 'Builder'.
    builderSetTranslationDomain :: GlibString string => Builder -> Maybe string -> IO ()
    builderSetTranslationDomain :: forall string.
    GlibString string =>
    Builder -> Maybe string -> IO ()
    builderSetTranslationDomain Builder
    builder Maybe string
    domain =
      (string -> (CString -> IO ()) -> IO ())
    -> Maybe string -> (CString -> IO ()) -> IO ()
    forall a b c.
    (a -> (Ptr b -> IO c) -> IO c)
    -> Maybe a -> (Ptr b -> IO c) -> IO c
    maybeWith string -> (CString -> IO ()) -> IO ()
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString Maybe string
    domain ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \CString
    domainPtr ->
      (\(Builder ForeignPtr Builder
    arg1) CString
    arg2 -> ForeignPtr Builder -> (Ptr Builder -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Builder
    arg1 ((Ptr Builder -> IO ()) -> IO ())
    -> (Ptr Builder -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Builder
    argPtr1 ->Ptr Builder -> CString -> IO ()
    gtk_builder_set_translation_domain Ptr Builder
    argPtr1 CString
    arg2)
    {-# LINE 241 "./Graphics/UI/Gtk/Builder.chs" #-}
        builder CString
    domainPtr

    -- | Gets the translation domain of the 'Builder'.
    builderGetTranslationDomain :: GlibString string => Builder -> IO (Maybe string)
    builderGetTranslationDomain :: forall string. GlibString string => Builder -> IO (Maybe string)
    builderGetTranslationDomain Builder
    builder =
      (\(Builder ForeignPtr Builder
    arg1) -> ForeignPtr Builder -> (Ptr Builder -> IO CString) -> IO CString
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Builder
    arg1 ((Ptr Builder -> IO CString) -> IO CString)
    -> (Ptr Builder -> IO CString) -> IO CString
    forall a b. (a -> b) -> a -> b
    $ \Ptr Builder
    argPtr1 ->Ptr Builder -> IO CString
    gtk_builder_get_translation_domain Ptr Builder
    argPtr1)
    {-# LINE 247 "./Graphics/UI/Gtk/Builder.chs" #-}
        builder
        IO CString -> (CString -> IO (Maybe string)) -> IO (Maybe string)
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= (CString -> IO string) -> CString -> IO (Maybe string)
    forall a b. (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
    maybePeek CString -> IO string
    forall s. GlibString s => CString -> IO s
    peekUTFString

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

    foreign import ccall unsafe "gtk_builder_add_from_file"
      gtk_builder_add_from_file :: ((Ptr Builder) -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO CUInt))))

    foreign import ccall unsafe "gtk_builder_add_from_string"
      gtk_builder_add_from_string :: ((Ptr Builder) -> ((Ptr CChar) -> (CULong -> ((Ptr (Ptr ())) -> (IO CUInt)))))

    foreign import ccall unsafe "gtk_builder_add_objects_from_file"
      gtk_builder_add_objects_from_file :: ((Ptr Builder) -> ((Ptr CChar) -> ((Ptr (Ptr CChar)) -> ((Ptr (Ptr ())) -> (IO CUInt)))))

    foreign import ccall unsafe "gtk_builder_add_objects_from_string"
      gtk_builder_add_objects_from_string :: ((Ptr Builder) -> ((Ptr CChar) -> (CULong -> ((Ptr (Ptr CChar)) -> ((Ptr (Ptr ())) -> (IO CUInt))))))

    foreign import ccall unsafe "gtk_builder_get_object"
      gtk_builder_get_object :: ((Ptr Builder) -> ((Ptr CChar) -> (IO (Ptr GObject))))

    foreign import ccall unsafe "gtk_builder_get_objects"
      gtk_builder_get_objects :: ((Ptr Builder) -> (IO (Ptr ())))

    foreign import ccall unsafe "gtk_builder_set_translation_domain"
      gtk_builder_set_translation_domain :: ((Ptr Builder) -> ((Ptr CChar) -> (IO ())))

    foreign import ccall unsafe "gtk_builder_get_translation_domain"
      gtk_builder_get_translation_domain :: ((Ptr Builder) -> (IO (Ptr CChar)))