{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

The GKeyFile struct contains only private data
and should not be accessed directly.
-}

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

module GI.GLib.Structs.KeyFile
    (

-- * Exported types
    KeyFile(..)                             ,
    noKeyFile                               ,


 -- * Methods
-- ** errorQuark #method:errorQuark#

    keyFileErrorQuark                       ,


-- ** getBoolean #method:getBoolean#

#if ENABLE_OVERLOADING
    KeyFileGetBooleanMethodInfo             ,
#endif
    keyFileGetBoolean                       ,


-- ** getBooleanList #method:getBooleanList#

#if ENABLE_OVERLOADING
    KeyFileGetBooleanListMethodInfo         ,
#endif
    keyFileGetBooleanList                   ,


-- ** getComment #method:getComment#

#if ENABLE_OVERLOADING
    KeyFileGetCommentMethodInfo             ,
#endif
    keyFileGetComment                       ,


-- ** getDouble #method:getDouble#

#if ENABLE_OVERLOADING
    KeyFileGetDoubleMethodInfo              ,
#endif
    keyFileGetDouble                        ,


-- ** getDoubleList #method:getDoubleList#

#if ENABLE_OVERLOADING
    KeyFileGetDoubleListMethodInfo          ,
#endif
    keyFileGetDoubleList                    ,


-- ** getGroups #method:getGroups#

#if ENABLE_OVERLOADING
    KeyFileGetGroupsMethodInfo              ,
#endif
    keyFileGetGroups                        ,


-- ** getInt64 #method:getInt64#

#if ENABLE_OVERLOADING
    KeyFileGetInt64MethodInfo               ,
#endif
    keyFileGetInt64                         ,


-- ** getInteger #method:getInteger#

#if ENABLE_OVERLOADING
    KeyFileGetIntegerMethodInfo             ,
#endif
    keyFileGetInteger                       ,


-- ** getIntegerList #method:getIntegerList#

#if ENABLE_OVERLOADING
    KeyFileGetIntegerListMethodInfo         ,
#endif
    keyFileGetIntegerList                   ,


-- ** getKeys #method:getKeys#

#if ENABLE_OVERLOADING
    KeyFileGetKeysMethodInfo                ,
#endif
    keyFileGetKeys                          ,


-- ** getLocaleForKey #method:getLocaleForKey#

#if ENABLE_OVERLOADING
    KeyFileGetLocaleForKeyMethodInfo        ,
#endif
    keyFileGetLocaleForKey                  ,


-- ** getLocaleString #method:getLocaleString#

#if ENABLE_OVERLOADING
    KeyFileGetLocaleStringMethodInfo        ,
#endif
    keyFileGetLocaleString                  ,


-- ** getLocaleStringList #method:getLocaleStringList#

#if ENABLE_OVERLOADING
    KeyFileGetLocaleStringListMethodInfo    ,
#endif
    keyFileGetLocaleStringList              ,


-- ** getStartGroup #method:getStartGroup#

#if ENABLE_OVERLOADING
    KeyFileGetStartGroupMethodInfo          ,
#endif
    keyFileGetStartGroup                    ,


-- ** getString #method:getString#

#if ENABLE_OVERLOADING
    KeyFileGetStringMethodInfo              ,
#endif
    keyFileGetString                        ,


-- ** getStringList #method:getStringList#

#if ENABLE_OVERLOADING
    KeyFileGetStringListMethodInfo          ,
#endif
    keyFileGetStringList                    ,


-- ** getUint64 #method:getUint64#

#if ENABLE_OVERLOADING
    KeyFileGetUint64MethodInfo              ,
#endif
    keyFileGetUint64                        ,


-- ** getValue #method:getValue#

#if ENABLE_OVERLOADING
    KeyFileGetValueMethodInfo               ,
#endif
    keyFileGetValue                         ,


-- ** hasGroup #method:hasGroup#

#if ENABLE_OVERLOADING
    KeyFileHasGroupMethodInfo               ,
#endif
    keyFileHasGroup                         ,


-- ** loadFromBytes #method:loadFromBytes#

#if ENABLE_OVERLOADING
    KeyFileLoadFromBytesMethodInfo          ,
#endif
    keyFileLoadFromBytes                    ,


-- ** loadFromData #method:loadFromData#

#if ENABLE_OVERLOADING
    KeyFileLoadFromDataMethodInfo           ,
#endif
    keyFileLoadFromData                     ,


-- ** loadFromDataDirs #method:loadFromDataDirs#

#if ENABLE_OVERLOADING
    KeyFileLoadFromDataDirsMethodInfo       ,
#endif
    keyFileLoadFromDataDirs                 ,


-- ** loadFromDirs #method:loadFromDirs#

#if ENABLE_OVERLOADING
    KeyFileLoadFromDirsMethodInfo           ,
#endif
    keyFileLoadFromDirs                     ,


-- ** loadFromFile #method:loadFromFile#

#if ENABLE_OVERLOADING
    KeyFileLoadFromFileMethodInfo           ,
#endif
    keyFileLoadFromFile                     ,


-- ** new #method:new#

    keyFileNew                              ,


-- ** removeComment #method:removeComment#

#if ENABLE_OVERLOADING
    KeyFileRemoveCommentMethodInfo          ,
#endif
    keyFileRemoveComment                    ,


-- ** removeGroup #method:removeGroup#

#if ENABLE_OVERLOADING
    KeyFileRemoveGroupMethodInfo            ,
#endif
    keyFileRemoveGroup                      ,


-- ** removeKey #method:removeKey#

#if ENABLE_OVERLOADING
    KeyFileRemoveKeyMethodInfo              ,
#endif
    keyFileRemoveKey                        ,


-- ** saveToFile #method:saveToFile#

#if ENABLE_OVERLOADING
    KeyFileSaveToFileMethodInfo             ,
#endif
    keyFileSaveToFile                       ,


-- ** setBoolean #method:setBoolean#

#if ENABLE_OVERLOADING
    KeyFileSetBooleanMethodInfo             ,
#endif
    keyFileSetBoolean                       ,


-- ** setBooleanList #method:setBooleanList#

#if ENABLE_OVERLOADING
    KeyFileSetBooleanListMethodInfo         ,
#endif
    keyFileSetBooleanList                   ,


-- ** setComment #method:setComment#

#if ENABLE_OVERLOADING
    KeyFileSetCommentMethodInfo             ,
#endif
    keyFileSetComment                       ,


-- ** setDouble #method:setDouble#

#if ENABLE_OVERLOADING
    KeyFileSetDoubleMethodInfo              ,
#endif
    keyFileSetDouble                        ,


-- ** setDoubleList #method:setDoubleList#

#if ENABLE_OVERLOADING
    KeyFileSetDoubleListMethodInfo          ,
#endif
    keyFileSetDoubleList                    ,


-- ** setInt64 #method:setInt64#

#if ENABLE_OVERLOADING
    KeyFileSetInt64MethodInfo               ,
#endif
    keyFileSetInt64                         ,


-- ** setInteger #method:setInteger#

#if ENABLE_OVERLOADING
    KeyFileSetIntegerMethodInfo             ,
#endif
    keyFileSetInteger                       ,


-- ** setIntegerList #method:setIntegerList#

#if ENABLE_OVERLOADING
    KeyFileSetIntegerListMethodInfo         ,
#endif
    keyFileSetIntegerList                   ,


-- ** setListSeparator #method:setListSeparator#

#if ENABLE_OVERLOADING
    KeyFileSetListSeparatorMethodInfo       ,
#endif
    keyFileSetListSeparator                 ,


-- ** setLocaleString #method:setLocaleString#

#if ENABLE_OVERLOADING
    KeyFileSetLocaleStringMethodInfo        ,
#endif
    keyFileSetLocaleString                  ,


-- ** setLocaleStringList #method:setLocaleStringList#

#if ENABLE_OVERLOADING
    KeyFileSetLocaleStringListMethodInfo    ,
#endif
    keyFileSetLocaleStringList              ,


-- ** setString #method:setString#

#if ENABLE_OVERLOADING
    KeyFileSetStringMethodInfo              ,
#endif
    keyFileSetString                        ,


-- ** setStringList #method:setStringList#

#if ENABLE_OVERLOADING
    KeyFileSetStringListMethodInfo          ,
#endif
    keyFileSetStringList                    ,


-- ** setUint64 #method:setUint64#

#if ENABLE_OVERLOADING
    KeyFileSetUint64MethodInfo              ,
#endif
    keyFileSetUint64                        ,


-- ** setValue #method:setValue#

#if ENABLE_OVERLOADING
    KeyFileSetValueMethodInfo               ,
#endif
    keyFileSetValue                         ,


-- ** toData #method:toData#

#if ENABLE_OVERLOADING
    KeyFileToDataMethodInfo                 ,
#endif
    keyFileToData                           ,


-- ** unref #method:unref#

#if ENABLE_OVERLOADING
    KeyFileUnrefMethodInfo                  ,
#endif
    keyFileUnref                            ,




    ) where

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

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.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 {-# SOURCE #-} qualified GI.GLib.Flags as GLib.Flags
import {-# SOURCE #-} qualified GI.GLib.Structs.Bytes as GLib.Bytes

-- | Memory-managed wrapper type.
newtype KeyFile = KeyFile (ManagedPtr KeyFile)
foreign import ccall "g_key_file_get_type" c_g_key_file_get_type ::
    IO GType

instance BoxedObject KeyFile where
    boxedType _ = c_g_key_file_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `KeyFile`.
noKeyFile :: Maybe KeyFile
noKeyFile = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList KeyFile
type instance O.AttributeList KeyFile = KeyFileAttributeList
type KeyFileAttributeList = ('[ ] :: [(Symbol, *)])
#endif

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

foreign import ccall "g_key_file_new" g_key_file_new ::
    IO (Ptr KeyFile)

{- |
Creates a new empty 'GI.GLib.Structs.KeyFile.KeyFile' object. Use
'GI.GLib.Structs.KeyFile.keyFileLoadFromFile', 'GI.GLib.Structs.KeyFile.keyFileLoadFromData',
'GI.GLib.Structs.KeyFile.keyFileLoadFromDirs' or 'GI.GLib.Structs.KeyFile.keyFileLoadFromDataDirs' to
read an existing key file.

/Since: 2.6/
-}
keyFileNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m KeyFile
    {- ^ __Returns:__ an empty 'GI.GLib.Structs.KeyFile.KeyFile'. -}
keyFileNew  = liftIO $ do
    result <- g_key_file_new
    checkUnexpectedReturnNULL "keyFileNew" result
    result' <- (wrapBoxed KeyFile) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method KeyFile::get_boolean
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", 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 "g_key_file_get_boolean" g_key_file_get_boolean ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Returns the value associated with /@key@/ under /@groupName@/ as a
boolean.

If /@key@/ cannot be found then 'False' is returned and /@error@/ is set
to @/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@. Likewise, if the value
associated with /@key@/ cannot be interpreted as a boolean then 'False'
is returned and /@error@/ is set to @/G_KEY_FILE_ERROR_INVALID_VALUE/@.

/Since: 2.6/
-}
keyFileGetBoolean ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetBoolean keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    onException (do
        _ <- propagateGError $ g_key_file_get_boolean keyFile' groupName' key'
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        return ()
     ) (do
        freeMem groupName'
        freeMem key'
     )

#if ENABLE_OVERLOADING
data KeyFileGetBooleanMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo KeyFileGetBooleanMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetBoolean

#endif

-- method KeyFile::get_boolean_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of booleans returned", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of booleans returned", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TCArray False (-1) 3 (TBasicType TBoolean))
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_boolean_list" g_key_file_get_boolean_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CInt)

{- |
Returns the values associated with /@key@/ under /@groupName@/ as
booleans.

If /@key@/ cannot be found then 'Nothing' is returned and /@error@/ is set to
@/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@. Likewise, if the values associated
with /@key@/ cannot be interpreted as booleans then 'Nothing' is returned
and /@error@/ is set to @/G_KEY_FILE_ERROR_INVALID_VALUE/@.

/Since: 2.6/
-}
keyFileGetBooleanList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m [Bool]
    {- ^ __Returns:__ 
   the values associated with the key as a list of booleans, or 'Nothing' if the
   key was not found or could not be parsed. The returned list of booleans
   should be freed with 'GI.GLib.Functions.free' when no longer needed. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetBooleanList keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_key_file_get_boolean_list keyFile' groupName' key' length_
        length_' <- peek length_
        checkUnexpectedReturnNULL "keyFileGetBooleanList" result
        result' <- (unpackMapStorableArrayWithLength (/= 0) length_') result
        freeMem result
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        freeMem length_
        return result'
     ) (do
        freeMem groupName'
        freeMem key'
        freeMem length_
     )

#if ENABLE_OVERLOADING
data KeyFileGetBooleanListMethodInfo
instance (signature ~ (T.Text -> T.Text -> m [Bool]), MonadIO m) => O.MethodInfo KeyFileGetBooleanListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetBooleanList

#endif

-- method KeyFile::get_comment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a group name, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_comment" g_key_file_get_comment ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Retrieves a comment above /@key@/ from /@groupName@/.
If /@key@/ is 'Nothing' then /@comment@/ will be read from above
/@groupName@/. If both /@key@/ and /@groupName@/ are 'Nothing', then
/@comment@/ will be read from above the first group in the file.

Note that the returned string does not include the \'#\' comment markers,
but does include any whitespace after them (on each line). It includes
the line breaks between lines, but does not include the final line break.

/Since: 2.6/
-}
keyFileGetComment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> Maybe (T.Text)
    {- ^ /@groupName@/: a group name, or 'Nothing' -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m T.Text
    {- ^ __Returns:__ a comment that should be freed with 'GI.GLib.Functions.free' /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetComment keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    maybeGroupName <- case groupName of
        Nothing -> return nullPtr
        Just jGroupName -> do
            jGroupName' <- textToCString jGroupName
            return jGroupName'
    key' <- textToCString key
    onException (do
        result <- propagateGError $ g_key_file_get_comment keyFile' maybeGroupName key'
        checkUnexpectedReturnNULL "keyFileGetComment" result
        result' <- cstringToText result
        freeMem result
        touchManagedPtr keyFile
        freeMem maybeGroupName
        freeMem key'
        return result'
     ) (do
        freeMem maybeGroupName
        freeMem key'
     )

#if ENABLE_OVERLOADING
data KeyFileGetCommentMethodInfo
instance (signature ~ (Maybe (T.Text) -> T.Text -> m T.Text), MonadIO m) => O.MethodInfo KeyFileGetCommentMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetComment

#endif

-- method KeyFile::get_double
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_double" g_key_file_get_double ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CDouble

{- |
Returns the value associated with /@key@/ under /@groupName@/ as a
double. If /@groupName@/ is 'Nothing', the start_group is used.

If /@key@/ cannot be found then 0.0 is returned and /@error@/ is set to
@/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@. Likewise, if the value associated
with /@key@/ cannot be interpreted as a double then 0.0 is returned
and /@error@/ is set to @/G_KEY_FILE_ERROR_INVALID_VALUE/@.

/Since: 2.12/
-}
keyFileGetDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m Double
    {- ^ __Returns:__ the value associated with the key as a double, or
    0.0 if the key was not found or could not be parsed. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetDouble keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    onException (do
        result <- propagateGError $ g_key_file_get_double keyFile' groupName' key'
        let result' = realToFrac result
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        return result'
     ) (do
        freeMem groupName'
        freeMem key'
     )

#if ENABLE_OVERLOADING
data KeyFileGetDoubleMethodInfo
instance (signature ~ (T.Text -> T.Text -> m Double), MonadIO m) => O.MethodInfo KeyFileGetDoubleMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetDouble

#endif

-- method KeyFile::get_double_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of doubles returned", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of doubles returned", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TCArray False (-1) 3 (TBasicType TDouble))
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_double_list" g_key_file_get_double_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CDouble)

{- |
Returns the values associated with /@key@/ under /@groupName@/ as
doubles.

If /@key@/ cannot be found then 'Nothing' is returned and /@error@/ is set to
@/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@. Likewise, if the values associated
with /@key@/ cannot be interpreted as doubles then 'Nothing' is returned
and /@error@/ is set to @/G_KEY_FILE_ERROR_INVALID_VALUE/@.

/Since: 2.12/
-}
keyFileGetDoubleList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m [Double]
    {- ^ __Returns:__ 
    the values associated with the key as a list of doubles, or 'Nothing' if the
    key was not found or could not be parsed. The returned list of doubles
    should be freed with 'GI.GLib.Functions.free' when no longer needed. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetDoubleList keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_key_file_get_double_list keyFile' groupName' key' length_
        length_' <- peek length_
        checkUnexpectedReturnNULL "keyFileGetDoubleList" result
        result' <- (unpackMapStorableArrayWithLength realToFrac length_') result
        freeMem result
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        freeMem length_
        return result'
     ) (do
        freeMem groupName'
        freeMem key'
        freeMem length_
     )

#if ENABLE_OVERLOADING
data KeyFileGetDoubleListMethodInfo
instance (signature ~ (T.Text -> T.Text -> m [Double]), MonadIO m) => O.MethodInfo KeyFileGetDoubleListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetDoubleList

#endif

-- method KeyFile::get_groups
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the number of returned groups, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_get_groups" g_key_file_get_groups ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    IO (Ptr CString)

{- |
Returns all groups in the key file loaded with /@keyFile@/.
The array of returned groups will be 'Nothing'-terminated, so
/@length@/ may optionally be 'Nothing'.

/Since: 2.6/
-}
keyFileGetGroups ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> m (([T.Text], Word64))
    {- ^ __Returns:__ a newly-allocated 'Nothing'-terminated array of strings.
  Use 'GI.GLib.Functions.strfreev' to free it. -}
keyFileGetGroups keyFile = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    length_ <- allocMem :: IO (Ptr Word64)
    result <- g_key_file_get_groups keyFile' length_
    checkUnexpectedReturnNULL "keyFileGetGroups" result
    result' <- unpackZeroTerminatedUTF8CArray result
    mapZeroTerminatedCArray freeMem result
    freeMem result
    length_' <- peek length_
    touchManagedPtr keyFile
    freeMem length_
    return (result', length_')

#if ENABLE_OVERLOADING
data KeyFileGetGroupsMethodInfo
instance (signature ~ (m (([T.Text], Word64))), MonadIO m) => O.MethodInfo KeyFileGetGroupsMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetGroups

#endif

-- method KeyFile::get_int64
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a non-%NULL #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a non-%NULL group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a non-%NULL key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt64)
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_int64" g_key_file_get_int64 ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO Int64

{- |
Returns the value associated with /@key@/ under /@groupName@/ as a signed
64-bit integer. This is similar to 'GI.GLib.Structs.KeyFile.keyFileGetInteger' but can return
64-bit results without truncation.

/Since: 2.26/
-}
keyFileGetInt64 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a non-'Nothing' 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a non-'Nothing' group name -}
    -> T.Text
    {- ^ /@key@/: a non-'Nothing' key -}
    -> m Int64
    {- ^ __Returns:__ the value associated with the key as a signed 64-bit integer, or
0 if the key was not found or could not be parsed. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetInt64 keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    onException (do
        result <- propagateGError $ g_key_file_get_int64 keyFile' groupName' key'
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        return result
     ) (do
        freeMem groupName'
        freeMem key'
     )

#if ENABLE_OVERLOADING
data KeyFileGetInt64MethodInfo
instance (signature ~ (T.Text -> T.Text -> m Int64), MonadIO m) => O.MethodInfo KeyFileGetInt64MethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetInt64

#endif

-- method KeyFile::get_integer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_integer" g_key_file_get_integer ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO Int32

{- |
Returns the value associated with /@key@/ under /@groupName@/ as an
integer.

If /@key@/ cannot be found then 0 is returned and /@error@/ is set to
@/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@. Likewise, if the value associated
with /@key@/ cannot be interpreted as an integer, or is out of range
for a @/gint/@, then 0 is returned
and /@error@/ is set to @/G_KEY_FILE_ERROR_INVALID_VALUE/@.

/Since: 2.6/
-}
keyFileGetInteger ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m Int32
    {- ^ __Returns:__ the value associated with the key as an integer, or
    0 if the key was not found or could not be parsed. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetInteger keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    onException (do
        result <- propagateGError $ g_key_file_get_integer keyFile' groupName' key'
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        return result
     ) (do
        freeMem groupName'
        freeMem key'
     )

#if ENABLE_OVERLOADING
data KeyFileGetIntegerMethodInfo
instance (signature ~ (T.Text -> T.Text -> m Int32), MonadIO m) => O.MethodInfo KeyFileGetIntegerMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetInteger

#endif

-- method KeyFile::get_integer_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of integers returned", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of integers returned", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TCArray False (-1) 3 (TBasicType TInt))
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_integer_list" g_key_file_get_integer_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Int32)

{- |
Returns the values associated with /@key@/ under /@groupName@/ as
integers.

If /@key@/ cannot be found then 'Nothing' is returned and /@error@/ is set to
@/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@. Likewise, if the values associated
with /@key@/ cannot be interpreted as integers, or are out of range for
@/gint/@, then 'Nothing' is returned
and /@error@/ is set to @/G_KEY_FILE_ERROR_INVALID_VALUE/@.

/Since: 2.6/
-}
keyFileGetIntegerList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m [Int32]
    {- ^ __Returns:__ 
    the values associated with the key as a list of integers, or 'Nothing' if
    the key was not found or could not be parsed. The returned list of
    integers should be freed with 'GI.GLib.Functions.free' when no longer needed. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetIntegerList keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_key_file_get_integer_list keyFile' groupName' key' length_
        length_' <- peek length_
        checkUnexpectedReturnNULL "keyFileGetIntegerList" result
        result' <- (unpackStorableArrayWithLength length_') result
        freeMem result
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        freeMem length_
        return result'
     ) (do
        freeMem groupName'
        freeMem key'
        freeMem length_
     )

#if ENABLE_OVERLOADING
data KeyFileGetIntegerListMethodInfo
instance (signature ~ (T.Text -> T.Text -> m [Int32]), MonadIO m) => O.MethodInfo KeyFileGetIntegerListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetIntegerList

#endif

-- method KeyFile::get_keys
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the number of keys returned, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_keys" g_key_file_get_keys ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CString)

{- |
Returns all keys for the group name /@groupName@/.  The array of
returned keys will be 'Nothing'-terminated, so /@length@/ may
optionally be 'Nothing'. In the event that the /@groupName@/ cannot
be found, 'Nothing' is returned and /@error@/ is set to
@/G_KEY_FILE_ERROR_GROUP_NOT_FOUND/@.

/Since: 2.6/
-}
keyFileGetKeys ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> m (([T.Text], Word64))
    {- ^ __Returns:__ a newly-allocated 'Nothing'-terminated array of strings.
    Use 'GI.GLib.Functions.strfreev' to free it. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetKeys keyFile groupName = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_key_file_get_keys keyFile' groupName' length_
        checkUnexpectedReturnNULL "keyFileGetKeys" result
        result' <- unpackZeroTerminatedUTF8CArray result
        mapZeroTerminatedCArray freeMem result
        freeMem result
        length_' <- peek length_
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem length_
        return (result', length_')
     ) (do
        freeMem groupName'
        freeMem length_
     )

#if ENABLE_OVERLOADING
data KeyFileGetKeysMethodInfo
instance (signature ~ (T.Text -> m (([T.Text], Word64))), MonadIO m) => O.MethodInfo KeyFileGetKeysMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetKeys

#endif

-- method KeyFile::get_locale_for_key
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "locale", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a locale identifier or %NULL", 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 "g_key_file_get_locale_for_key" g_key_file_get_locale_for_key ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- locale : TBasicType TUTF8
    IO CString

{- |
Returns the actual locale which the result of
'GI.GLib.Structs.KeyFile.keyFileGetLocaleString' or 'GI.GLib.Structs.KeyFile.keyFileGetLocaleStringList'
came from.

If calling 'GI.GLib.Structs.KeyFile.keyFileGetLocaleString' or
'GI.GLib.Structs.KeyFile.keyFileGetLocaleStringList' with exactly the same /@keyFile@/,
/@groupName@/, /@key@/ and /@locale@/, the result of those functions will
have originally been tagged with the locale that is the result of
this function.

/Since: 2.56/
-}
keyFileGetLocaleForKey ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> Maybe (T.Text)
    {- ^ /@locale@/: a locale identifier or 'Nothing' -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the locale from the file, or 'Nothing' if the key was not
  found or the entry in the file was was untranslated -}
keyFileGetLocaleForKey keyFile groupName key locale = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    maybeLocale <- case locale of
        Nothing -> return nullPtr
        Just jLocale -> do
            jLocale' <- textToCString jLocale
            return jLocale'
    result <- g_key_file_get_locale_for_key keyFile' groupName' key' maybeLocale
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    freeMem maybeLocale
    return maybeResult

#if ENABLE_OVERLOADING
data KeyFileGetLocaleForKeyMethodInfo
instance (signature ~ (T.Text -> T.Text -> Maybe (T.Text) -> m (Maybe T.Text)), MonadIO m) => O.MethodInfo KeyFileGetLocaleForKeyMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetLocaleForKey

#endif

-- method KeyFile::get_locale_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "locale", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a locale identifier or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_locale_string" g_key_file_get_locale_string ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- locale : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Returns the value associated with /@key@/ under /@groupName@/
translated in the given /@locale@/ if available.  If /@locale@/ is
'Nothing' then the current locale is assumed.

If /@locale@/ is to be non-'Nothing', or if the current locale will change over
the lifetime of the 'GI.GLib.Structs.KeyFile.KeyFile', it must be loaded with
'GI.GLib.Flags.KeyFileFlagsKeepTranslations' in order to load strings for all locales.

If /@key@/ cannot be found then 'Nothing' is returned and /@error@/ is set
to @/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@. If the value associated
with /@key@/ cannot be interpreted or no suitable translation can
be found then the untranslated value is returned.

/Since: 2.6/
-}
keyFileGetLocaleString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> Maybe (T.Text)
    {- ^ /@locale@/: a locale identifier or 'Nothing' -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string or 'Nothing' if the specified
  key cannot be found. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetLocaleString keyFile groupName key locale = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    maybeLocale <- case locale of
        Nothing -> return nullPtr
        Just jLocale -> do
            jLocale' <- textToCString jLocale
            return jLocale'
    onException (do
        result <- propagateGError $ g_key_file_get_locale_string keyFile' groupName' key' maybeLocale
        checkUnexpectedReturnNULL "keyFileGetLocaleString" result
        result' <- cstringToText result
        freeMem result
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        freeMem maybeLocale
        return result'
     ) (do
        freeMem groupName'
        freeMem key'
        freeMem maybeLocale
     )

#if ENABLE_OVERLOADING
data KeyFileGetLocaleStringMethodInfo
instance (signature ~ (T.Text -> T.Text -> Maybe (T.Text) -> m T.Text), MonadIO m) => O.MethodInfo KeyFileGetLocaleStringMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetLocaleString

#endif

-- method KeyFile::get_locale_string_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "locale", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a locale identifier or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the number of returned strings or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) 4 (TBasicType TUTF8))
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_locale_string_list" g_key_file_get_locale_string_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- locale : TBasicType TUTF8
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CString)

{- |
Returns the values associated with /@key@/ under /@groupName@/
translated in the given /@locale@/ if available.  If /@locale@/ is
'Nothing' then the current locale is assumed.

If /@locale@/ is to be non-'Nothing', or if the current locale will change over
the lifetime of the 'GI.GLib.Structs.KeyFile.KeyFile', it must be loaded with
'GI.GLib.Flags.KeyFileFlagsKeepTranslations' in order to load strings for all locales.

If /@key@/ cannot be found then 'Nothing' is returned and /@error@/ is set
to @/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@. If the values associated
with /@key@/ cannot be interpreted or no suitable translations
can be found then the untranslated values are returned. The
returned array is 'Nothing'-terminated, so /@length@/ may optionally
be 'Nothing'.

/Since: 2.6/
-}
keyFileGetLocaleStringList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> Maybe (T.Text)
    {- ^ /@locale@/: a locale identifier or 'Nothing' -}
    -> m (([T.Text], Word64))
    {- ^ __Returns:__ a newly allocated 'Nothing'-terminated string array
  or 'Nothing' if the key isn\'t found. The string array should be freed
  with 'GI.GLib.Functions.strfreev'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetLocaleStringList keyFile groupName key locale = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    maybeLocale <- case locale of
        Nothing -> return nullPtr
        Just jLocale -> do
            jLocale' <- textToCString jLocale
            return jLocale'
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_key_file_get_locale_string_list keyFile' groupName' key' maybeLocale length_
        checkUnexpectedReturnNULL "keyFileGetLocaleStringList" result
        result' <- unpackZeroTerminatedUTF8CArray result
        mapZeroTerminatedCArray freeMem result
        freeMem result
        length_' <- peek length_
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        freeMem maybeLocale
        freeMem length_
        return (result', length_')
     ) (do
        freeMem groupName'
        freeMem key'
        freeMem maybeLocale
        freeMem length_
     )

#if ENABLE_OVERLOADING
data KeyFileGetLocaleStringListMethodInfo
instance (signature ~ (T.Text -> T.Text -> Maybe (T.Text) -> m (([T.Text], Word64))), MonadIO m) => O.MethodInfo KeyFileGetLocaleStringListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetLocaleStringList

#endif

-- method KeyFile::get_start_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", 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 "g_key_file_get_start_group" g_key_file_get_start_group ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    IO CString

{- |
Returns the name of the start group of the file.

/Since: 2.6/
-}
keyFileGetStartGroup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> m T.Text
    {- ^ __Returns:__ The start group of the key file. -}
keyFileGetStartGroup keyFile = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    result <- g_key_file_get_start_group keyFile'
    checkUnexpectedReturnNULL "keyFileGetStartGroup" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr keyFile
    return result'

#if ENABLE_OVERLOADING
data KeyFileGetStartGroupMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo KeyFileGetStartGroupMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetStartGroup

#endif

-- method KeyFile::get_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_string" g_key_file_get_string ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Returns the string value associated with /@key@/ under /@groupName@/.
Unlike 'GI.GLib.Structs.KeyFile.keyFileGetValue', this function handles escape sequences
like \\s.

In the event the key cannot be found, 'Nothing' is returned and
/@error@/ is set to @/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@.  In the
event that the /@groupName@/ cannot be found, 'Nothing' is returned
and /@error@/ is set to @/G_KEY_FILE_ERROR_GROUP_NOT_FOUND/@.

/Since: 2.6/
-}
keyFileGetString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string or 'Nothing' if the specified
  key cannot be found. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetString keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    onException (do
        result <- propagateGError $ g_key_file_get_string keyFile' groupName' key'
        checkUnexpectedReturnNULL "keyFileGetString" result
        result' <- cstringToText result
        freeMem result
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        return result'
     ) (do
        freeMem groupName'
        freeMem key'
     )

#if ENABLE_OVERLOADING
data KeyFileGetStringMethodInfo
instance (signature ~ (T.Text -> T.Text -> m T.Text), MonadIO m) => O.MethodInfo KeyFileGetStringMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetString

#endif

-- method KeyFile::get_string_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the number of returned strings, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) 3 (TBasicType TUTF8))
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_string_list" g_key_file_get_string_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CString)

{- |
Returns the values associated with /@key@/ under /@groupName@/.

In the event the key cannot be found, 'Nothing' is returned and
/@error@/ is set to @/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@.  In the
event that the /@groupName@/ cannot be found, 'Nothing' is returned
and /@error@/ is set to @/G_KEY_FILE_ERROR_GROUP_NOT_FOUND/@.

/Since: 2.6/
-}
keyFileGetStringList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m (([T.Text], Word64))
    {- ^ __Returns:__ 
 a 'Nothing'-terminated string array or 'Nothing' if the specified
 key cannot be found. The array should be freed with 'GI.GLib.Functions.strfreev'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetStringList keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_key_file_get_string_list keyFile' groupName' key' length_
        checkUnexpectedReturnNULL "keyFileGetStringList" result
        result' <- unpackZeroTerminatedUTF8CArray result
        mapZeroTerminatedCArray freeMem result
        freeMem result
        length_' <- peek length_
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        freeMem length_
        return (result', length_')
     ) (do
        freeMem groupName'
        freeMem key'
        freeMem length_
     )

#if ENABLE_OVERLOADING
data KeyFileGetStringListMethodInfo
instance (signature ~ (T.Text -> T.Text -> m (([T.Text], Word64))), MonadIO m) => O.MethodInfo KeyFileGetStringListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetStringList

#endif

-- method KeyFile::get_uint64
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a non-%NULL #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a non-%NULL group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a non-%NULL key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_uint64" g_key_file_get_uint64 ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO Word64

{- |
Returns the value associated with /@key@/ under /@groupName@/ as an unsigned
64-bit integer. This is similar to 'GI.GLib.Structs.KeyFile.keyFileGetInteger' but can return
large positive results without truncation.

/Since: 2.26/
-}
keyFileGetUint64 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a non-'Nothing' 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a non-'Nothing' group name -}
    -> T.Text
    {- ^ /@key@/: a non-'Nothing' key -}
    -> m Word64
    {- ^ __Returns:__ the value associated with the key as an unsigned 64-bit integer,
or 0 if the key was not found or could not be parsed. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetUint64 keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    onException (do
        result <- propagateGError $ g_key_file_get_uint64 keyFile' groupName' key'
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        return result
     ) (do
        freeMem groupName'
        freeMem key'
     )

#if ENABLE_OVERLOADING
data KeyFileGetUint64MethodInfo
instance (signature ~ (T.Text -> T.Text -> m Word64), MonadIO m) => O.MethodInfo KeyFileGetUint64MethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetUint64

#endif

-- method KeyFile::get_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_get_value" g_key_file_get_value ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Returns the raw value associated with /@key@/ under /@groupName@/.
Use 'GI.GLib.Structs.KeyFile.keyFileGetString' to retrieve an unescaped UTF-8 string.

In the event the key cannot be found, 'Nothing' is returned and
/@error@/ is set to @/G_KEY_FILE_ERROR_KEY_NOT_FOUND/@.  In the
event that the /@groupName@/ cannot be found, 'Nothing' is returned
and /@error@/ is set to @/G_KEY_FILE_ERROR_GROUP_NOT_FOUND/@.

/Since: 2.6/
-}
keyFileGetValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string or 'Nothing' if the specified
 key cannot be found. /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileGetValue keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    onException (do
        result <- propagateGError $ g_key_file_get_value keyFile' groupName' key'
        checkUnexpectedReturnNULL "keyFileGetValue" result
        result' <- cstringToText result
        freeMem result
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        return result'
     ) (do
        freeMem groupName'
        freeMem key'
     )

#if ENABLE_OVERLOADING
data KeyFileGetValueMethodInfo
instance (signature ~ (T.Text -> T.Text -> m T.Text), MonadIO m) => O.MethodInfo KeyFileGetValueMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileGetValue

#endif

-- method KeyFile::has_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_has_group" g_key_file_has_group ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    IO CInt

{- |
Looks whether the key file has the group /@groupName@/.

/Since: 2.6/
-}
keyFileHasGroup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@groupName@/ is a part of /@keyFile@/, 'False'
otherwise. -}
keyFileHasGroup keyFile groupName = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    result <- g_key_file_has_group keyFile' groupName'
    let result' = (/= 0) result
    touchManagedPtr keyFile
    freeMem groupName'
    return result'

#if ENABLE_OVERLOADING
data KeyFileHasGroupMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo KeyFileHasGroupMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileHasGroup

#endif

-- method KeyFile::load_from_bytes
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an empty #GKeyFile struct", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "bytes", argType = TInterface (Name {namespace = "GLib", name = "Bytes"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GBytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GLib", name = "KeyFileFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags from #GKeyFileFlags", 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 "g_key_file_load_from_bytes" g_key_file_load_from_bytes ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    Ptr GLib.Bytes.Bytes ->                 -- bytes : TInterface (Name {namespace = "GLib", name = "Bytes"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "GLib", name = "KeyFileFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Loads a key file from the data in /@bytes@/ into an empty 'GI.GLib.Structs.KeyFile.KeyFile' structure.
If the object cannot be created then @/error/@ is set to a 'GI.GLib.Enums.KeyFileError'.

/Since: 2.50/
-}
keyFileLoadFromBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: an empty 'GI.GLib.Structs.KeyFile.KeyFile' struct -}
    -> GLib.Bytes.Bytes
    {- ^ /@bytes@/: a 'GI.GLib.Structs.Bytes.Bytes' -}
    -> [GLib.Flags.KeyFileFlags]
    {- ^ /@flags@/: flags from 'GI.GLib.Flags.KeyFileFlags' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileLoadFromBytes keyFile bytes flags = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    bytes' <- unsafeManagedPtrGetPtr bytes
    let flags' = gflagsToWord flags
    onException (do
        _ <- propagateGError $ g_key_file_load_from_bytes keyFile' bytes' flags'
        touchManagedPtr keyFile
        touchManagedPtr bytes
        return ()
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
data KeyFileLoadFromBytesMethodInfo
instance (signature ~ (GLib.Bytes.Bytes -> [GLib.Flags.KeyFileFlags] -> m ()), MonadIO m) => O.MethodInfo KeyFileLoadFromBytesMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileLoadFromBytes

#endif

-- method KeyFile::load_from_data
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an empty #GKeyFile struct", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "key file loaded in memory", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @data in bytes (or (gsize)-1 if data is nul-terminated)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GLib", name = "KeyFileFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags from #GKeyFileFlags", 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 "g_key_file_load_from_data" g_key_file_load_from_data ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- data : TBasicType TUTF8
    Word64 ->                               -- length : TBasicType TUInt64
    CUInt ->                                -- flags : TInterface (Name {namespace = "GLib", name = "KeyFileFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Loads a key file from memory into an empty 'GI.GLib.Structs.KeyFile.KeyFile' structure.
If the object cannot be created then @/error/@ is set to a 'GI.GLib.Enums.KeyFileError'.

/Since: 2.6/
-}
keyFileLoadFromData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: an empty 'GI.GLib.Structs.KeyFile.KeyFile' struct -}
    -> T.Text
    {- ^ /@data@/: key file loaded in memory -}
    -> Word64
    {- ^ /@length@/: the length of /@data@/ in bytes (or (gsize)-1 if data is nul-terminated) -}
    -> [GLib.Flags.KeyFileFlags]
    {- ^ /@flags@/: flags from 'GI.GLib.Flags.KeyFileFlags' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileLoadFromData keyFile data_ length_ flags = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    data_' <- textToCString data_
    let flags' = gflagsToWord flags
    onException (do
        _ <- propagateGError $ g_key_file_load_from_data keyFile' data_' length_ flags'
        touchManagedPtr keyFile
        freeMem data_'
        return ()
     ) (do
        freeMem data_'
     )

#if ENABLE_OVERLOADING
data KeyFileLoadFromDataMethodInfo
instance (signature ~ (T.Text -> Word64 -> [GLib.Flags.KeyFileFlags] -> m ()), MonadIO m) => O.MethodInfo KeyFileLoadFromDataMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileLoadFromData

#endif

-- method KeyFile::load_from_data_dirs
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an empty #GKeyFile struct", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a relative path to a filename to open and parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "full_path", argType = TBasicType TFileName, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for a string containing the full path\n  of the file, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GLib", name = "KeyFileFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags from #GKeyFileFlags", 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 "g_key_file_load_from_data_dirs" g_key_file_load_from_data_dirs ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- file : TBasicType TFileName
    Ptr CString ->                          -- full_path : TBasicType TFileName
    CUInt ->                                -- flags : TInterface (Name {namespace = "GLib", name = "KeyFileFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
This function looks for a key file named /@file@/ in the paths
returned from 'GI.GLib.Functions.getUserDataDir' and 'GI.GLib.Functions.getSystemDataDirs',
loads the file into /@keyFile@/ and returns the file\'s full path in
/@fullPath@/.  If the file could not be loaded then an @/error/@ is
set to either a 'GI.GLib.Enums.FileError' or 'GI.GLib.Enums.KeyFileError'.

/Since: 2.6/
-}
keyFileLoadFromDataDirs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: an empty 'GI.GLib.Structs.KeyFile.KeyFile' struct -}
    -> [Char]
    {- ^ /@file@/: a relative path to a filename to open and parse -}
    -> [GLib.Flags.KeyFileFlags]
    {- ^ /@flags@/: flags from 'GI.GLib.Flags.KeyFileFlags' -}
    -> m ([Char])
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileLoadFromDataDirs keyFile file flags = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    file' <- stringToCString file
    fullPath <- allocMem :: IO (Ptr CString)
    let flags' = gflagsToWord flags
    onException (do
        _ <- propagateGError $ g_key_file_load_from_data_dirs keyFile' file' fullPath flags'
        fullPath' <- peek fullPath
        fullPath'' <- cstringToString fullPath'
        freeMem fullPath'
        touchManagedPtr keyFile
        freeMem file'
        freeMem fullPath
        return fullPath''
     ) (do
        freeMem file'
        freeMem fullPath
     )

#if ENABLE_OVERLOADING
data KeyFileLoadFromDataDirsMethodInfo
instance (signature ~ ([Char] -> [GLib.Flags.KeyFileFlags] -> m ([Char])), MonadIO m) => O.MethodInfo KeyFileLoadFromDataDirsMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileLoadFromDataDirs

#endif

-- method KeyFile::load_from_dirs
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an empty #GKeyFile struct", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a relative path to a filename to open and parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "search_dirs", argType = TCArray True (-1) (-1) (TBasicType TFileName), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%NULL-terminated array of directories to search", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "full_path", argType = TBasicType TFileName, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for a string containing the full path\n  of the file, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GLib", name = "KeyFileFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags from #GKeyFileFlags", 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 "g_key_file_load_from_dirs" g_key_file_load_from_dirs ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- file : TBasicType TFileName
    Ptr CString ->                          -- search_dirs : TCArray True (-1) (-1) (TBasicType TFileName)
    Ptr CString ->                          -- full_path : TBasicType TFileName
    CUInt ->                                -- flags : TInterface (Name {namespace = "GLib", name = "KeyFileFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
This function looks for a key file named /@file@/ in the paths
specified in /@searchDirs@/, loads the file into /@keyFile@/ and
returns the file\'s full path in /@fullPath@/.

If the file could not be found in any of the /@searchDirs@/,
'GI.GLib.Enums.KeyFileErrorNotFound' is returned. If
the file is found but the OS returns an error when opening or reading the
file, a @/G_FILE_ERROR/@ is returned. If there is a problem parsing the file, a
@/G_KEY_FILE_ERROR/@ is returned.

/Since: 2.14/
-}
keyFileLoadFromDirs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: an empty 'GI.GLib.Structs.KeyFile.KeyFile' struct -}
    -> [Char]
    {- ^ /@file@/: a relative path to a filename to open and parse -}
    -> [[Char]]
    {- ^ /@searchDirs@/: 'Nothing'-terminated array of directories to search -}
    -> [GLib.Flags.KeyFileFlags]
    {- ^ /@flags@/: flags from 'GI.GLib.Flags.KeyFileFlags' -}
    -> m ([Char])
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileLoadFromDirs keyFile file searchDirs flags = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    file' <- stringToCString file
    searchDirs' <- packZeroTerminatedFileNameArray searchDirs
    fullPath <- allocMem :: IO (Ptr CString)
    let flags' = gflagsToWord flags
    onException (do
        _ <- propagateGError $ g_key_file_load_from_dirs keyFile' file' searchDirs' fullPath flags'
        fullPath' <- peek fullPath
        fullPath'' <- cstringToString fullPath'
        freeMem fullPath'
        touchManagedPtr keyFile
        freeMem file'
        mapZeroTerminatedCArray freeMem searchDirs'
        freeMem searchDirs'
        freeMem fullPath
        return fullPath''
     ) (do
        freeMem file'
        mapZeroTerminatedCArray freeMem searchDirs'
        freeMem searchDirs'
        freeMem fullPath
     )

#if ENABLE_OVERLOADING
data KeyFileLoadFromDirsMethodInfo
instance (signature ~ ([Char] -> [[Char]] -> [GLib.Flags.KeyFileFlags] -> m ([Char])), MonadIO m) => O.MethodInfo KeyFileLoadFromDirsMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileLoadFromDirs

#endif

-- method KeyFile::load_from_file
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an empty #GKeyFile struct", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the path of a filename to load, in the GLib filename encoding", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GLib", name = "KeyFileFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags from #GKeyFileFlags", 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 "g_key_file_load_from_file" g_key_file_load_from_file ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- file : TBasicType TFileName
    CUInt ->                                -- flags : TInterface (Name {namespace = "GLib", name = "KeyFileFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Loads a key file into an empty 'GI.GLib.Structs.KeyFile.KeyFile' structure.

If the OS returns an error when opening or reading the file, a
@/G_FILE_ERROR/@ is returned. If there is a problem parsing the file, a
@/G_KEY_FILE_ERROR/@ is returned.

This function will never return a 'GI.GLib.Enums.KeyFileErrorNotFound' error. If the
/@file@/ is not found, 'GI.GLib.Enums.FileErrorNoent' is returned.

/Since: 2.6/
-}
keyFileLoadFromFile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: an empty 'GI.GLib.Structs.KeyFile.KeyFile' struct -}
    -> [Char]
    {- ^ /@file@/: the path of a filename to load, in the GLib filename encoding -}
    -> [GLib.Flags.KeyFileFlags]
    {- ^ /@flags@/: flags from 'GI.GLib.Flags.KeyFileFlags' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileLoadFromFile keyFile file flags = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    file' <- stringToCString file
    let flags' = gflagsToWord flags
    onException (do
        _ <- propagateGError $ g_key_file_load_from_file keyFile' file' flags'
        touchManagedPtr keyFile
        freeMem file'
        return ()
     ) (do
        freeMem file'
     )

#if ENABLE_OVERLOADING
data KeyFileLoadFromFileMethodInfo
instance (signature ~ ([Char] -> [GLib.Flags.KeyFileFlags] -> m ()), MonadIO m) => O.MethodInfo KeyFileLoadFromFileMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileLoadFromFile

#endif

-- method KeyFile::remove_comment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a group name, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a key", 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 "g_key_file_remove_comment" g_key_file_remove_comment ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Removes a comment above /@key@/ from /@groupName@/.
If /@key@/ is 'Nothing' then /@comment@/ will be removed above /@groupName@/.
If both /@key@/ and /@groupName@/ are 'Nothing', then /@comment@/ will
be removed above the first group in the file.

/Since: 2.6/
-}
keyFileRemoveComment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> Maybe (T.Text)
    {- ^ /@groupName@/: a group name, or 'Nothing' -}
    -> Maybe (T.Text)
    {- ^ /@key@/: a key -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileRemoveComment keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    maybeGroupName <- case groupName of
        Nothing -> return nullPtr
        Just jGroupName -> do
            jGroupName' <- textToCString jGroupName
            return jGroupName'
    maybeKey <- case key of
        Nothing -> return nullPtr
        Just jKey -> do
            jKey' <- textToCString jKey
            return jKey'
    onException (do
        _ <- propagateGError $ g_key_file_remove_comment keyFile' maybeGroupName maybeKey
        touchManagedPtr keyFile
        freeMem maybeGroupName
        freeMem maybeKey
        return ()
     ) (do
        freeMem maybeGroupName
        freeMem maybeKey
     )

#if ENABLE_OVERLOADING
data KeyFileRemoveCommentMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (T.Text) -> m ()), MonadIO m) => O.MethodInfo KeyFileRemoveCommentMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileRemoveComment

#endif

-- method KeyFile::remove_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", 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 "g_key_file_remove_group" g_key_file_remove_group ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Removes the specified group, /@groupName@/,
from the key file.

/Since: 2.6/
-}
keyFileRemoveGroup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileRemoveGroup keyFile groupName = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    onException (do
        _ <- propagateGError $ g_key_file_remove_group keyFile' groupName'
        touchManagedPtr keyFile
        freeMem groupName'
        return ()
     ) (do
        freeMem groupName'
     )

#if ENABLE_OVERLOADING
data KeyFileRemoveGroupMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo KeyFileRemoveGroupMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileRemoveGroup

#endif

-- method KeyFile::remove_key
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key name to remove", 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 "g_key_file_remove_key" g_key_file_remove_key ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Removes /@key@/ in /@groupName@/ from the key file.

/Since: 2.6/
-}
keyFileRemoveKey ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key name to remove -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileRemoveKey keyFile groupName key = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    onException (do
        _ <- propagateGError $ g_key_file_remove_key keyFile' groupName' key'
        touchManagedPtr keyFile
        freeMem groupName'
        freeMem key'
        return ()
     ) (do
        freeMem groupName'
        freeMem key'
     )

#if ENABLE_OVERLOADING
data KeyFileRemoveKeyMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo KeyFileRemoveKeyMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileRemoveKey

#endif

-- method KeyFile::save_to_file
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the file to write to", 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 "g_key_file_save_to_file" g_key_file_save_to_file ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- filename : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Writes the contents of /@keyFile@/ to /@filename@/ using
'GI.GLib.Functions.fileSetContents'.

This function can fail for any of the reasons that
'GI.GLib.Functions.fileSetContents' may fail.

/Since: 2.40/
-}
keyFileSaveToFile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@filename@/: the name of the file to write to -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileSaveToFile keyFile filename = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    filename' <- textToCString filename
    onException (do
        _ <- propagateGError $ g_key_file_save_to_file keyFile' filename'
        touchManagedPtr keyFile
        freeMem filename'
        return ()
     ) (do
        freeMem filename'
     )

#if ENABLE_OVERLOADING
data KeyFileSaveToFileMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo KeyFileSaveToFileMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSaveToFile

#endif

-- method KeyFile::set_boolean
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE or %FALSE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_boolean" g_key_file_set_boolean ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CInt ->                                 -- value : TBasicType TBoolean
    IO ()

{- |
Associates a new boolean value with /@key@/ under /@groupName@/.
If /@key@/ cannot be found then it is created.

/Since: 2.6/
-}
keyFileSetBoolean ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> Bool
    {- ^ /@value@/: 'True' or 'False' -}
    -> m ()
keyFileSetBoolean keyFile groupName key value = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    let value' = (fromIntegral . fromEnum) value
    g_key_file_set_boolean keyFile' groupName' key' value'
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetBooleanMethodInfo
instance (signature ~ (T.Text -> T.Text -> Bool -> m ()), MonadIO m) => O.MethodInfo KeyFileSetBooleanMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetBoolean

#endif

-- method KeyFile::set_boolean_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "list", argType = TCArray False (-1) 4 (TBasicType TBoolean), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an array of boolean values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_boolean_list" g_key_file_set_boolean_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr CInt ->                             -- list : TCArray False (-1) 4 (TBasicType TBoolean)
    Word64 ->                               -- length : TBasicType TUInt64
    IO ()

{- |
Associates a list of boolean values with /@key@/ under /@groupName@/.
If /@key@/ cannot be found then it is created.
If /@groupName@/ is 'Nothing', the start_group is used.

/Since: 2.6/
-}
keyFileSetBooleanList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> [Bool]
    {- ^ /@list@/: an array of boolean values -}
    -> m ()
keyFileSetBooleanList keyFile groupName key list = liftIO $ do
    let length_ = fromIntegral $ length list
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    list' <- (packMapStorableArray (fromIntegral . fromEnum)) list
    g_key_file_set_boolean_list keyFile' groupName' key' list' length_
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    freeMem list'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetBooleanListMethodInfo
instance (signature ~ (T.Text -> T.Text -> [Bool] -> m ()), MonadIO m) => O.MethodInfo KeyFileSetBooleanListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetBooleanList

#endif

-- method KeyFile::set_comment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a group name, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "comment", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a comment", 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 "g_key_file_set_comment" g_key_file_set_comment ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- comment : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Places a comment above /@key@/ from /@groupName@/.

If /@key@/ is 'Nothing' then /@comment@/ will be written above /@groupName@/.
If both /@key@/ and /@groupName@/  are 'Nothing', then /@comment@/ will be
written above the first group in the file.

Note that this function prepends a \'#\' comment marker to
each line of /@comment@/.

/Since: 2.6/
-}
keyFileSetComment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> Maybe (T.Text)
    {- ^ /@groupName@/: a group name, or 'Nothing' -}
    -> Maybe (T.Text)
    {- ^ /@key@/: a key -}
    -> T.Text
    {- ^ /@comment@/: a comment -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileSetComment keyFile groupName key comment = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    maybeGroupName <- case groupName of
        Nothing -> return nullPtr
        Just jGroupName -> do
            jGroupName' <- textToCString jGroupName
            return jGroupName'
    maybeKey <- case key of
        Nothing -> return nullPtr
        Just jKey -> do
            jKey' <- textToCString jKey
            return jKey'
    comment' <- textToCString comment
    onException (do
        _ <- propagateGError $ g_key_file_set_comment keyFile' maybeGroupName maybeKey comment'
        touchManagedPtr keyFile
        freeMem maybeGroupName
        freeMem maybeKey
        freeMem comment'
        return ()
     ) (do
        freeMem maybeGroupName
        freeMem maybeKey
        freeMem comment'
     )

#if ENABLE_OVERLOADING
data KeyFileSetCommentMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (T.Text) -> T.Text -> m ()), MonadIO m) => O.MethodInfo KeyFileSetCommentMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetComment

#endif

-- method KeyFile::set_double
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an double value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_double" g_key_file_set_double ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CDouble ->                              -- value : TBasicType TDouble
    IO ()

{- |
Associates a new double value with /@key@/ under /@groupName@/.
If /@key@/ cannot be found then it is created.

/Since: 2.12/
-}
keyFileSetDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> Double
    {- ^ /@value@/: an double value -}
    -> m ()
keyFileSetDouble keyFile groupName key value = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    let value' = realToFrac value
    g_key_file_set_double keyFile' groupName' key' value'
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetDoubleMethodInfo
instance (signature ~ (T.Text -> T.Text -> Double -> m ()), MonadIO m) => O.MethodInfo KeyFileSetDoubleMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetDouble

#endif

-- method KeyFile::set_double_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "list", argType = TCArray False (-1) 4 (TBasicType TDouble), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an array of double values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of double values in @list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of double values in @list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_double_list" g_key_file_set_double_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr CDouble ->                          -- list : TCArray False (-1) 4 (TBasicType TDouble)
    Word64 ->                               -- length : TBasicType TUInt64
    IO ()

{- |
Associates a list of double values with /@key@/ under
/@groupName@/.  If /@key@/ cannot be found then it is created.

/Since: 2.12/
-}
keyFileSetDoubleList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> [Double]
    {- ^ /@list@/: an array of double values -}
    -> m ()
keyFileSetDoubleList keyFile groupName key list = liftIO $ do
    let length_ = fromIntegral $ length list
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    list' <- (packMapStorableArray realToFrac) list
    g_key_file_set_double_list keyFile' groupName' key' list' length_
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    freeMem list'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetDoubleListMethodInfo
instance (signature ~ (T.Text -> T.Text -> [Double] -> m ()), MonadIO m) => O.MethodInfo KeyFileSetDoubleListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetDoubleList

#endif

-- method KeyFile::set_int64
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an integer value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_int64" g_key_file_set_int64 ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Int64 ->                                -- value : TBasicType TInt64
    IO ()

{- |
Associates a new integer value with /@key@/ under /@groupName@/.
If /@key@/ cannot be found then it is created.

/Since: 2.26/
-}
keyFileSetInt64 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> Int64
    {- ^ /@value@/: an integer value -}
    -> m ()
keyFileSetInt64 keyFile groupName key value = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    g_key_file_set_int64 keyFile' groupName' key' value
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetInt64MethodInfo
instance (signature ~ (T.Text -> T.Text -> Int64 -> m ()), MonadIO m) => O.MethodInfo KeyFileSetInt64MethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetInt64

#endif

-- method KeyFile::set_integer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an integer value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_integer" g_key_file_set_integer ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Int32 ->                                -- value : TBasicType TInt
    IO ()

{- |
Associates a new integer value with /@key@/ under /@groupName@/.
If /@key@/ cannot be found then it is created.

/Since: 2.6/
-}
keyFileSetInteger ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> Int32
    {- ^ /@value@/: an integer value -}
    -> m ()
keyFileSetInteger keyFile groupName key value = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    g_key_file_set_integer keyFile' groupName' key' value
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetIntegerMethodInfo
instance (signature ~ (T.Text -> T.Text -> Int32 -> m ()), MonadIO m) => O.MethodInfo KeyFileSetIntegerMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetInteger

#endif

-- method KeyFile::set_integer_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "list", argType = TCArray False (-1) 4 (TBasicType TInt), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an array of integer values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of integer values in @list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of integer values in @list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_integer_list" g_key_file_set_integer_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr Int32 ->                            -- list : TCArray False (-1) 4 (TBasicType TInt)
    Word64 ->                               -- length : TBasicType TUInt64
    IO ()

{- |
Associates a list of integer values with /@key@/ under /@groupName@/.
If /@key@/ cannot be found then it is created.

/Since: 2.6/
-}
keyFileSetIntegerList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> [Int32]
    {- ^ /@list@/: an array of integer values -}
    -> m ()
keyFileSetIntegerList keyFile groupName key list = liftIO $ do
    let length_ = fromIntegral $ length list
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    list' <- packStorableArray list
    g_key_file_set_integer_list keyFile' groupName' key' list' length_
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    freeMem list'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetIntegerListMethodInfo
instance (signature ~ (T.Text -> T.Text -> [Int32] -> m ()), MonadIO m) => O.MethodInfo KeyFileSetIntegerListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetIntegerList

#endif

-- method KeyFile::set_list_separator
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "separator", argType = TBasicType TInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the separator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_list_separator" g_key_file_set_list_separator ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    Int8 ->                                 -- separator : TBasicType TInt8
    IO ()

{- |
Sets the character which is used to separate
values in lists. Typically \';\' or \',\' are used
as separators. The default list separator is \';\'.

/Since: 2.6/
-}
keyFileSetListSeparator ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> Int8
    {- ^ /@separator@/: the separator -}
    -> m ()
keyFileSetListSeparator keyFile separator = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    g_key_file_set_list_separator keyFile' separator
    touchManagedPtr keyFile
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetListSeparatorMethodInfo
instance (signature ~ (Int8 -> m ()), MonadIO m) => O.MethodInfo KeyFileSetListSeparatorMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetListSeparator

#endif

-- method KeyFile::set_locale_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "locale", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a locale identifier", 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 "a string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_locale_string" g_key_file_set_locale_string ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- locale : TBasicType TUTF8
    CString ->                              -- string : TBasicType TUTF8
    IO ()

{- |
Associates a string value for /@key@/ and /@locale@/ under /@groupName@/.
If the translation for /@key@/ cannot be found then it is created.

/Since: 2.6/
-}
keyFileSetLocaleString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> T.Text
    {- ^ /@locale@/: a locale identifier -}
    -> T.Text
    {- ^ /@string@/: a string -}
    -> m ()
keyFileSetLocaleString keyFile groupName key locale string = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    locale' <- textToCString locale
    string' <- textToCString string
    g_key_file_set_locale_string keyFile' groupName' key' locale' string'
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    freeMem locale'
    freeMem string'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetLocaleStringMethodInfo
instance (signature ~ (T.Text -> T.Text -> T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo KeyFileSetLocaleStringMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetLocaleString

#endif

-- method KeyFile::set_locale_string_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "locale", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a locale identifier", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "list", argType = TCArray True (-1) 5 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a %NULL-terminated array of locale string values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_locale_string_list" g_key_file_set_locale_string_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- locale : TBasicType TUTF8
    Ptr CString ->                          -- list : TCArray True (-1) 5 (TBasicType TUTF8)
    Word64 ->                               -- length : TBasicType TUInt64
    IO ()

{- |
Associates a list of string values for /@key@/ and /@locale@/ under
/@groupName@/.  If the translation for /@key@/ cannot be found then
it is created.

/Since: 2.6/
-}
keyFileSetLocaleStringList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> T.Text
    {- ^ /@locale@/: a locale identifier -}
    -> [T.Text]
    {- ^ /@list@/: a 'Nothing'-terminated array of locale string values -}
    -> Word64
    {- ^ /@length@/: the length of /@list@/ -}
    -> m ()
keyFileSetLocaleStringList keyFile groupName key locale list length_ = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    locale' <- textToCString locale
    list' <- packZeroTerminatedUTF8CArray list
    g_key_file_set_locale_string_list keyFile' groupName' key' locale' list' length_
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    freeMem locale'
    mapZeroTerminatedCArray freeMem list'
    freeMem list'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetLocaleStringListMethodInfo
instance (signature ~ (T.Text -> T.Text -> T.Text -> [T.Text] -> Word64 -> m ()), MonadIO m) => O.MethodInfo KeyFileSetLocaleStringListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetLocaleStringList

#endif

-- method KeyFile::set_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", 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 "a string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_string" g_key_file_set_string ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- string : TBasicType TUTF8
    IO ()

{- |
Associates a new string value with /@key@/ under /@groupName@/.
If /@key@/ cannot be found then it is created.
If /@groupName@/ cannot be found then it is created.
Unlike 'GI.GLib.Structs.KeyFile.keyFileSetValue', this function handles characters
that need escaping, such as newlines.

/Since: 2.6/
-}
keyFileSetString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> T.Text
    {- ^ /@string@/: a string -}
    -> m ()
keyFileSetString keyFile groupName key string = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    string' <- textToCString string
    g_key_file_set_string keyFile' groupName' key' string'
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    freeMem string'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetStringMethodInfo
instance (signature ~ (T.Text -> T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo KeyFileSetStringMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetString

#endif

-- method KeyFile::set_string_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "list", argType = TCArray True (-1) 4 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an array of string values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of string values in @list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_string_list" g_key_file_set_string_list ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Ptr CString ->                          -- list : TCArray True (-1) 4 (TBasicType TUTF8)
    Word64 ->                               -- length : TBasicType TUInt64
    IO ()

{- |
Associates a list of string values for /@key@/ under /@groupName@/.
If /@key@/ cannot be found then it is created.
If /@groupName@/ cannot be found then it is created.

/Since: 2.6/
-}
keyFileSetStringList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> [T.Text]
    {- ^ /@list@/: an array of string values -}
    -> Word64
    {- ^ /@length@/: number of string values in /@list@/ -}
    -> m ()
keyFileSetStringList keyFile groupName key list length_ = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    list' <- packZeroTerminatedUTF8CArray list
    g_key_file_set_string_list keyFile' groupName' key' list' length_
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    mapZeroTerminatedCArray freeMem list'
    freeMem list'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetStringListMethodInfo
instance (signature ~ (T.Text -> T.Text -> [T.Text] -> Word64 -> m ()), MonadIO m) => O.MethodInfo KeyFileSetStringListMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetStringList

#endif

-- method KeyFile::set_uint64
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an integer value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_uint64" g_key_file_set_uint64 ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    Word64 ->                               -- value : TBasicType TUInt64
    IO ()

{- |
Associates a new integer value with /@key@/ under /@groupName@/.
If /@key@/ cannot be found then it is created.

/Since: 2.26/
-}
keyFileSetUint64 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> Word64
    {- ^ /@value@/: an integer value -}
    -> m ()
keyFileSetUint64 keyFile groupName key value = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    g_key_file_set_uint64 keyFile' groupName' key' value
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetUint64MethodInfo
instance (signature ~ (T.Text -> T.Text -> Word64 -> m ()), MonadIO m) => O.MethodInfo KeyFileSetUint64MethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetUint64

#endif

-- method KeyFile::set_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a group name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a key", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_set_value" g_key_file_set_value ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    CString ->                              -- group_name : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    CString ->                              -- value : TBasicType TUTF8
    IO ()

{- |
Associates a new value with /@key@/ under /@groupName@/.

If /@key@/ cannot be found then it is created. If /@groupName@/ cannot
be found then it is created. To set an UTF-8 string which may contain
characters that need escaping (such as newlines or spaces), use
'GI.GLib.Structs.KeyFile.keyFileSetString'.

/Since: 2.6/
-}
keyFileSetValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> T.Text
    {- ^ /@groupName@/: a group name -}
    -> T.Text
    {- ^ /@key@/: a key -}
    -> T.Text
    {- ^ /@value@/: a string -}
    -> m ()
keyFileSetValue keyFile groupName key value = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    groupName' <- textToCString groupName
    key' <- textToCString key
    value' <- textToCString value
    g_key_file_set_value keyFile' groupName' key' value'
    touchManagedPtr keyFile
    freeMem groupName'
    freeMem key'
    freeMem value'
    return ()

#if ENABLE_OVERLOADING
data KeyFileSetValueMethodInfo
instance (signature ~ (T.Text -> T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo KeyFileSetValueMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileSetValue

#endif

-- method KeyFile::to_data
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "key_file", argType = TInterface (Name {namespace = "GLib", name = "KeyFile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GKeyFile", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the length of the\n  returned string, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_key_file_to_data" g_key_file_to_data ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
This function outputs /@keyFile@/ as a string.

Note that this function never reports an error,
so it is safe to pass 'Nothing' as /@error@/.

/Since: 2.6/
-}
keyFileToData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> m ((T.Text, Word64))
    {- ^ __Returns:__ a newly allocated string holding
  the contents of the 'GI.GLib.Structs.KeyFile.KeyFile' /(Can throw 'Data.GI.Base.GError.GError')/ -}
keyFileToData keyFile = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    length_ <- allocMem :: IO (Ptr Word64)
    onException (do
        result <- propagateGError $ g_key_file_to_data keyFile' length_
        checkUnexpectedReturnNULL "keyFileToData" result
        result' <- cstringToText result
        freeMem result
        length_' <- peek length_
        touchManagedPtr keyFile
        freeMem length_
        return (result', length_')
     ) (do
        freeMem length_
     )

#if ENABLE_OVERLOADING
data KeyFileToDataMethodInfo
instance (signature ~ (m ((T.Text, Word64))), MonadIO m) => O.MethodInfo KeyFileToDataMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileToData

#endif

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

foreign import ccall "g_key_file_unref" g_key_file_unref ::
    Ptr KeyFile ->                          -- key_file : TInterface (Name {namespace = "GLib", name = "KeyFile"})
    IO ()

{- |
Decreases the reference count of /@keyFile@/ by 1. If the reference count
reaches zero, frees the key file and all its allocated memory.

/Since: 2.32/
-}
keyFileUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    KeyFile
    {- ^ /@keyFile@/: a 'GI.GLib.Structs.KeyFile.KeyFile' -}
    -> m ()
keyFileUnref keyFile = liftIO $ do
    keyFile' <- unsafeManagedPtrGetPtr keyFile
    g_key_file_unref keyFile'
    touchManagedPtr keyFile
    return ()

#if ENABLE_OVERLOADING
data KeyFileUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo KeyFileUnrefMethodInfo KeyFile signature where
    overloadedMethod _ = keyFileUnref

#endif

-- method KeyFile::error_quark
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_key_file_error_quark" g_key_file_error_quark ::
    IO Word32

{- |
/No description available in the introspection data./
-}
keyFileErrorQuark ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
keyFileErrorQuark  = liftIO $ do
    result <- g_key_file_error_quark
    return result

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveKeyFileMethod (t :: Symbol) (o :: *) :: * where
    ResolveKeyFileMethod "hasGroup" o = KeyFileHasGroupMethodInfo
    ResolveKeyFileMethod "loadFromBytes" o = KeyFileLoadFromBytesMethodInfo
    ResolveKeyFileMethod "loadFromData" o = KeyFileLoadFromDataMethodInfo
    ResolveKeyFileMethod "loadFromDataDirs" o = KeyFileLoadFromDataDirsMethodInfo
    ResolveKeyFileMethod "loadFromDirs" o = KeyFileLoadFromDirsMethodInfo
    ResolveKeyFileMethod "loadFromFile" o = KeyFileLoadFromFileMethodInfo
    ResolveKeyFileMethod "removeComment" o = KeyFileRemoveCommentMethodInfo
    ResolveKeyFileMethod "removeGroup" o = KeyFileRemoveGroupMethodInfo
    ResolveKeyFileMethod "removeKey" o = KeyFileRemoveKeyMethodInfo
    ResolveKeyFileMethod "saveToFile" o = KeyFileSaveToFileMethodInfo
    ResolveKeyFileMethod "toData" o = KeyFileToDataMethodInfo
    ResolveKeyFileMethod "unref" o = KeyFileUnrefMethodInfo
    ResolveKeyFileMethod "getBoolean" o = KeyFileGetBooleanMethodInfo
    ResolveKeyFileMethod "getBooleanList" o = KeyFileGetBooleanListMethodInfo
    ResolveKeyFileMethod "getComment" o = KeyFileGetCommentMethodInfo
    ResolveKeyFileMethod "getDouble" o = KeyFileGetDoubleMethodInfo
    ResolveKeyFileMethod "getDoubleList" o = KeyFileGetDoubleListMethodInfo
    ResolveKeyFileMethod "getGroups" o = KeyFileGetGroupsMethodInfo
    ResolveKeyFileMethod "getInt64" o = KeyFileGetInt64MethodInfo
    ResolveKeyFileMethod "getInteger" o = KeyFileGetIntegerMethodInfo
    ResolveKeyFileMethod "getIntegerList" o = KeyFileGetIntegerListMethodInfo
    ResolveKeyFileMethod "getKeys" o = KeyFileGetKeysMethodInfo
    ResolveKeyFileMethod "getLocaleForKey" o = KeyFileGetLocaleForKeyMethodInfo
    ResolveKeyFileMethod "getLocaleString" o = KeyFileGetLocaleStringMethodInfo
    ResolveKeyFileMethod "getLocaleStringList" o = KeyFileGetLocaleStringListMethodInfo
    ResolveKeyFileMethod "getStartGroup" o = KeyFileGetStartGroupMethodInfo
    ResolveKeyFileMethod "getString" o = KeyFileGetStringMethodInfo
    ResolveKeyFileMethod "getStringList" o = KeyFileGetStringListMethodInfo
    ResolveKeyFileMethod "getUint64" o = KeyFileGetUint64MethodInfo
    ResolveKeyFileMethod "getValue" o = KeyFileGetValueMethodInfo
    ResolveKeyFileMethod "setBoolean" o = KeyFileSetBooleanMethodInfo
    ResolveKeyFileMethod "setBooleanList" o = KeyFileSetBooleanListMethodInfo
    ResolveKeyFileMethod "setComment" o = KeyFileSetCommentMethodInfo
    ResolveKeyFileMethod "setDouble" o = KeyFileSetDoubleMethodInfo
    ResolveKeyFileMethod "setDoubleList" o = KeyFileSetDoubleListMethodInfo
    ResolveKeyFileMethod "setInt64" o = KeyFileSetInt64MethodInfo
    ResolveKeyFileMethod "setInteger" o = KeyFileSetIntegerMethodInfo
    ResolveKeyFileMethod "setIntegerList" o = KeyFileSetIntegerListMethodInfo
    ResolveKeyFileMethod "setListSeparator" o = KeyFileSetListSeparatorMethodInfo
    ResolveKeyFileMethod "setLocaleString" o = KeyFileSetLocaleStringMethodInfo
    ResolveKeyFileMethod "setLocaleStringList" o = KeyFileSetLocaleStringListMethodInfo
    ResolveKeyFileMethod "setString" o = KeyFileSetStringMethodInfo
    ResolveKeyFileMethod "setStringList" o = KeyFileSetStringListMethodInfo
    ResolveKeyFileMethod "setUint64" o = KeyFileSetUint64MethodInfo
    ResolveKeyFileMethod "setValue" o = KeyFileSetValueMethodInfo
    ResolveKeyFileMethod l o = O.MethodResolutionFailed l o

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

#endif