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

/No description available in the introspection data./
-}

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

module GI.GtkSource.Objects.FileLoader
    (

-- * Exported types
    FileLoader(..)                          ,
    IsFileLoader                            ,
    toFileLoader                            ,
    noFileLoader                            ,


 -- * Methods
-- ** getBuffer #method:getBuffer#

#if ENABLE_OVERLOADING
    FileLoaderGetBufferMethodInfo           ,
#endif
    fileLoaderGetBuffer                     ,


-- ** getCompressionType #method:getCompressionType#

#if ENABLE_OVERLOADING
    FileLoaderGetCompressionTypeMethodInfo  ,
#endif
    fileLoaderGetCompressionType            ,


-- ** getEncoding #method:getEncoding#

#if ENABLE_OVERLOADING
    FileLoaderGetEncodingMethodInfo         ,
#endif
    fileLoaderGetEncoding                   ,


-- ** getFile #method:getFile#

#if ENABLE_OVERLOADING
    FileLoaderGetFileMethodInfo             ,
#endif
    fileLoaderGetFile                       ,


-- ** getInputStream #method:getInputStream#

#if ENABLE_OVERLOADING
    FileLoaderGetInputStreamMethodInfo      ,
#endif
    fileLoaderGetInputStream                ,


-- ** getLocation #method:getLocation#

#if ENABLE_OVERLOADING
    FileLoaderGetLocationMethodInfo         ,
#endif
    fileLoaderGetLocation                   ,


-- ** getNewlineType #method:getNewlineType#

#if ENABLE_OVERLOADING
    FileLoaderGetNewlineTypeMethodInfo      ,
#endif
    fileLoaderGetNewlineType                ,


-- ** loadAsync #method:loadAsync#

#if ENABLE_OVERLOADING
    FileLoaderLoadAsyncMethodInfo           ,
#endif
    fileLoaderLoadAsync                     ,


-- ** loadFinish #method:loadFinish#

#if ENABLE_OVERLOADING
    FileLoaderLoadFinishMethodInfo          ,
#endif
    fileLoaderLoadFinish                    ,


-- ** new #method:new#

    fileLoaderNew                           ,


-- ** newFromStream #method:newFromStream#

    fileLoaderNewFromStream                 ,


-- ** setCandidateEncodings #method:setCandidateEncodings#

#if ENABLE_OVERLOADING
    FileLoaderSetCandidateEncodingsMethodInfo,
#endif
    fileLoaderSetCandidateEncodings         ,




 -- * Properties
-- ** buffer #attr:buffer#
{- | The 'GI.GtkSource.Objects.Buffer.Buffer' to load the contents into. The
'GI.GtkSource.Objects.FileLoader.FileLoader' object has a weak reference to the buffer.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileLoaderBufferPropertyInfo            ,
#endif
    constructFileLoaderBuffer               ,
#if ENABLE_OVERLOADING
    fileLoaderBuffer                        ,
#endif
    getFileLoaderBuffer                     ,


-- ** file #attr:file#
{- | The 'GI.GtkSource.Objects.File.File'. The 'GI.GtkSource.Objects.FileLoader.FileLoader' object has a weak
reference to the file.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileLoaderFilePropertyInfo              ,
#endif
    constructFileLoaderFile                 ,
#if ENABLE_OVERLOADING
    fileLoaderFile                          ,
#endif
    getFileLoaderFile                       ,


-- ** inputStream #attr:inputStream#
{- | The 'GI.Gio.Objects.InputStream.InputStream' to load. Useful for reading stdin. If this property
is set, the 'GI.GtkSource.Objects.FileLoader.FileLoader':@/location/@ property is ignored.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileLoaderInputStreamPropertyInfo       ,
#endif
    constructFileLoaderInputStream          ,
#if ENABLE_OVERLOADING
    fileLoaderInputStream                   ,
#endif
    getFileLoaderInputStream                ,


-- ** location #attr:location#
{- | The 'GI.Gio.Interfaces.File.File' to load. If the 'GI.GtkSource.Objects.FileLoader.FileLoader':@/input-stream/@ is
'Nothing', by default the location is taken from the 'GI.GtkSource.Objects.File.File' at
construction time.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileLoaderLocationPropertyInfo          ,
#endif
    constructFileLoaderLocation             ,
#if ENABLE_OVERLOADING
    fileLoaderLocation                      ,
#endif
    getFileLoaderLocation                   ,




    ) 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 qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.File as Gio.File
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.GtkSource.Enums as GtkSource.Enums
import {-# SOURCE #-} qualified GI.GtkSource.Objects.Buffer as GtkSource.Buffer
import {-# SOURCE #-} qualified GI.GtkSource.Objects.File as GtkSource.File
import {-# SOURCE #-} qualified GI.GtkSource.Structs.Encoding as GtkSource.Encoding

-- | Memory-managed wrapper type.
newtype FileLoader = FileLoader (ManagedPtr FileLoader)
foreign import ccall "gtk_source_file_loader_get_type"
    c_gtk_source_file_loader_get_type :: IO GType

instance GObject FileLoader where
    gobjectType = c_gtk_source_file_loader_get_type


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

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

-- | Cast to `FileLoader`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toFileLoader :: (MonadIO m, IsFileLoader o) => o -> m FileLoader
toFileLoader = liftIO . unsafeCastTo FileLoader

-- | A convenience alias for `Nothing` :: `Maybe` `FileLoader`.
noFileLoader :: Maybe FileLoader
noFileLoader = Nothing

#if ENABLE_OVERLOADING
type family ResolveFileLoaderMethod (t :: Symbol) (o :: *) :: * where
    ResolveFileLoaderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveFileLoaderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveFileLoaderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveFileLoaderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveFileLoaderMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveFileLoaderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveFileLoaderMethod "loadAsync" o = FileLoaderLoadAsyncMethodInfo
    ResolveFileLoaderMethod "loadFinish" o = FileLoaderLoadFinishMethodInfo
    ResolveFileLoaderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveFileLoaderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveFileLoaderMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveFileLoaderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveFileLoaderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveFileLoaderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveFileLoaderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveFileLoaderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveFileLoaderMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveFileLoaderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveFileLoaderMethod "getBuffer" o = FileLoaderGetBufferMethodInfo
    ResolveFileLoaderMethod "getCompressionType" o = FileLoaderGetCompressionTypeMethodInfo
    ResolveFileLoaderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveFileLoaderMethod "getEncoding" o = FileLoaderGetEncodingMethodInfo
    ResolveFileLoaderMethod "getFile" o = FileLoaderGetFileMethodInfo
    ResolveFileLoaderMethod "getInputStream" o = FileLoaderGetInputStreamMethodInfo
    ResolveFileLoaderMethod "getLocation" o = FileLoaderGetLocationMethodInfo
    ResolveFileLoaderMethod "getNewlineType" o = FileLoaderGetNewlineTypeMethodInfo
    ResolveFileLoaderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveFileLoaderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveFileLoaderMethod "setCandidateEncodings" o = FileLoaderSetCandidateEncodingsMethodInfo
    ResolveFileLoaderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveFileLoaderMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveFileLoaderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveFileLoaderMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveFileLoaderMethod t FileLoader, O.MethodInfo info FileLoader p) => OL.IsLabel t (FileLoader -> 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

-- VVV Prop "buffer"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "Buffer"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@buffer@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' fileLoader #buffer
@
-}
getFileLoaderBuffer :: (MonadIO m, IsFileLoader o) => o -> m GtkSource.Buffer.Buffer
getFileLoaderBuffer obj = liftIO $ checkUnexpectedNothing "getFileLoaderBuffer" $ B.Properties.getObjectPropertyObject obj "buffer" GtkSource.Buffer.Buffer

{- |
Construct a `GValueConstruct` with valid value for the “@buffer@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructFileLoaderBuffer :: (IsFileLoader o, GtkSource.Buffer.IsBuffer a) => a -> IO (GValueConstruct o)
constructFileLoaderBuffer val = B.Properties.constructObjectPropertyObject "buffer" (Just val)

#if ENABLE_OVERLOADING
data FileLoaderBufferPropertyInfo
instance AttrInfo FileLoaderBufferPropertyInfo where
    type AttrAllowedOps FileLoaderBufferPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileLoaderBufferPropertyInfo = GtkSource.Buffer.IsBuffer
    type AttrBaseTypeConstraint FileLoaderBufferPropertyInfo = IsFileLoader
    type AttrGetType FileLoaderBufferPropertyInfo = GtkSource.Buffer.Buffer
    type AttrLabel FileLoaderBufferPropertyInfo = "buffer"
    type AttrOrigin FileLoaderBufferPropertyInfo = FileLoader
    attrGet _ = getFileLoaderBuffer
    attrSet _ = undefined
    attrConstruct _ = constructFileLoaderBuffer
    attrClear _ = undefined
#endif

-- VVV Prop "file"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "File"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@file@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' fileLoader #file
@
-}
getFileLoaderFile :: (MonadIO m, IsFileLoader o) => o -> m GtkSource.File.File
getFileLoaderFile obj = liftIO $ checkUnexpectedNothing "getFileLoaderFile" $ B.Properties.getObjectPropertyObject obj "file" GtkSource.File.File

{- |
Construct a `GValueConstruct` with valid value for the “@file@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructFileLoaderFile :: (IsFileLoader o, GtkSource.File.IsFile a) => a -> IO (GValueConstruct o)
constructFileLoaderFile val = B.Properties.constructObjectPropertyObject "file" (Just val)

#if ENABLE_OVERLOADING
data FileLoaderFilePropertyInfo
instance AttrInfo FileLoaderFilePropertyInfo where
    type AttrAllowedOps FileLoaderFilePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileLoaderFilePropertyInfo = GtkSource.File.IsFile
    type AttrBaseTypeConstraint FileLoaderFilePropertyInfo = IsFileLoader
    type AttrGetType FileLoaderFilePropertyInfo = GtkSource.File.File
    type AttrLabel FileLoaderFilePropertyInfo = "file"
    type AttrOrigin FileLoaderFilePropertyInfo = FileLoader
    attrGet _ = getFileLoaderFile
    attrSet _ = undefined
    attrConstruct _ = constructFileLoaderFile
    attrClear _ = undefined
#endif

-- VVV Prop "input-stream"
   -- Type: TInterface (Name {namespace = "Gio", name = "InputStream"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just True,Nothing)

{- |
Get the value of the “@input-stream@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' fileLoader #inputStream
@
-}
getFileLoaderInputStream :: (MonadIO m, IsFileLoader o) => o -> m (Maybe Gio.InputStream.InputStream)
getFileLoaderInputStream obj = liftIO $ B.Properties.getObjectPropertyObject obj "input-stream" Gio.InputStream.InputStream

{- |
Construct a `GValueConstruct` with valid value for the “@input-stream@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructFileLoaderInputStream :: (IsFileLoader o, Gio.InputStream.IsInputStream a) => a -> IO (GValueConstruct o)
constructFileLoaderInputStream val = B.Properties.constructObjectPropertyObject "input-stream" (Just val)

#if ENABLE_OVERLOADING
data FileLoaderInputStreamPropertyInfo
instance AttrInfo FileLoaderInputStreamPropertyInfo where
    type AttrAllowedOps FileLoaderInputStreamPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileLoaderInputStreamPropertyInfo = Gio.InputStream.IsInputStream
    type AttrBaseTypeConstraint FileLoaderInputStreamPropertyInfo = IsFileLoader
    type AttrGetType FileLoaderInputStreamPropertyInfo = (Maybe Gio.InputStream.InputStream)
    type AttrLabel FileLoaderInputStreamPropertyInfo = "input-stream"
    type AttrOrigin FileLoaderInputStreamPropertyInfo = FileLoader
    attrGet _ = getFileLoaderInputStream
    attrSet _ = undefined
    attrConstruct _ = constructFileLoaderInputStream
    attrClear _ = undefined
#endif

-- VVV Prop "location"
   -- Type: TInterface (Name {namespace = "Gio", name = "File"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just True,Nothing)

{- |
Get the value of the “@location@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' fileLoader #location
@
-}
getFileLoaderLocation :: (MonadIO m, IsFileLoader o) => o -> m (Maybe Gio.File.File)
getFileLoaderLocation obj = liftIO $ B.Properties.getObjectPropertyObject obj "location" Gio.File.File

{- |
Construct a `GValueConstruct` with valid value for the “@location@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructFileLoaderLocation :: (IsFileLoader o, Gio.File.IsFile a) => a -> IO (GValueConstruct o)
constructFileLoaderLocation val = B.Properties.constructObjectPropertyObject "location" (Just val)

#if ENABLE_OVERLOADING
data FileLoaderLocationPropertyInfo
instance AttrInfo FileLoaderLocationPropertyInfo where
    type AttrAllowedOps FileLoaderLocationPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileLoaderLocationPropertyInfo = Gio.File.IsFile
    type AttrBaseTypeConstraint FileLoaderLocationPropertyInfo = IsFileLoader
    type AttrGetType FileLoaderLocationPropertyInfo = (Maybe Gio.File.File)
    type AttrLabel FileLoaderLocationPropertyInfo = "location"
    type AttrOrigin FileLoaderLocationPropertyInfo = FileLoader
    attrGet _ = getFileLoaderLocation
    attrSet _ = undefined
    attrConstruct _ = constructFileLoaderLocation
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList FileLoader
type instance O.AttributeList FileLoader = FileLoaderAttributeList
type FileLoaderAttributeList = ('[ '("buffer", FileLoaderBufferPropertyInfo), '("file", FileLoaderFilePropertyInfo), '("inputStream", FileLoaderInputStreamPropertyInfo), '("location", FileLoaderLocationPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
fileLoaderBuffer :: AttrLabelProxy "buffer"
fileLoaderBuffer = AttrLabelProxy

fileLoaderFile :: AttrLabelProxy "file"
fileLoaderFile = AttrLabelProxy

fileLoaderInputStream :: AttrLabelProxy "inputStream"
fileLoaderInputStream = AttrLabelProxy

fileLoaderLocation :: AttrLabelProxy "location"
fileLoaderLocation = AttrLabelProxy

#endif

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

#endif

-- method FileLoader::new
-- method type : Constructor
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GtkSourceBuffer to load the contents into.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "FileLoader"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_new" gtk_source_file_loader_new ::
    Ptr GtkSource.Buffer.Buffer ->          -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr GtkSource.File.File ->              -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    IO (Ptr FileLoader)

{- |
Creates a new 'GI.GtkSource.Objects.FileLoader.FileLoader' object. The contents is read from the
'GI.GtkSource.Objects.File.File'\'s location. If not already done, call
'GI.GtkSource.Objects.File.fileSetLocation' before calling this constructor. The previous
location is anyway not needed, because as soon as the file loading begins,
the /@buffer@/ is emptied.

/Since: 3.14/
-}
fileLoaderNew ::
    (B.CallStack.HasCallStack, MonadIO m, GtkSource.Buffer.IsBuffer a, GtkSource.File.IsFile b) =>
    a
    {- ^ /@buffer@/: the 'GI.GtkSource.Objects.Buffer.Buffer' to load the contents into. -}
    -> b
    {- ^ /@file@/: the 'GI.GtkSource.Objects.File.File'. -}
    -> m FileLoader
    {- ^ __Returns:__ a new 'GI.GtkSource.Objects.FileLoader.FileLoader' object. -}
fileLoaderNew buffer file = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    file' <- unsafeManagedPtrCastPtr file
    result <- gtk_source_file_loader_new buffer' file'
    checkUnexpectedReturnNULL "fileLoaderNew" result
    result' <- (wrapObject FileLoader) result
    touchManagedPtr buffer
    touchManagedPtr file
    return result'

#if ENABLE_OVERLOADING
#endif

-- method FileLoader::new_from_stream
-- method type : Constructor
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GtkSourceBuffer to load the contents into.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TInterface (Name {namespace = "GtkSource", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GtkSourceFile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stream", argType = TInterface (Name {namespace = "Gio", name = "InputStream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GInputStream to load, e.g. stdin.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "FileLoader"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_new_from_stream" gtk_source_file_loader_new_from_stream ::
    Ptr GtkSource.Buffer.Buffer ->          -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr GtkSource.File.File ->              -- file : TInterface (Name {namespace = "GtkSource", name = "File"})
    Ptr Gio.InputStream.InputStream ->      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    IO (Ptr FileLoader)

{- |
Creates a new 'GI.GtkSource.Objects.FileLoader.FileLoader' object. The contents is read from /@stream@/.

/Since: 3.14/
-}
fileLoaderNewFromStream ::
    (B.CallStack.HasCallStack, MonadIO m, GtkSource.Buffer.IsBuffer a, GtkSource.File.IsFile b, Gio.InputStream.IsInputStream c) =>
    a
    {- ^ /@buffer@/: the 'GI.GtkSource.Objects.Buffer.Buffer' to load the contents into. -}
    -> b
    {- ^ /@file@/: the 'GI.GtkSource.Objects.File.File'. -}
    -> c
    {- ^ /@stream@/: the 'GI.Gio.Objects.InputStream.InputStream' to load, e.g. stdin. -}
    -> m FileLoader
    {- ^ __Returns:__ a new 'GI.GtkSource.Objects.FileLoader.FileLoader' object. -}
fileLoaderNewFromStream buffer file stream = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    file' <- unsafeManagedPtrCastPtr file
    stream' <- unsafeManagedPtrCastPtr stream
    result <- gtk_source_file_loader_new_from_stream buffer' file' stream'
    checkUnexpectedReturnNULL "fileLoaderNewFromStream" result
    result' <- (wrapObject FileLoader) result
    touchManagedPtr buffer
    touchManagedPtr file
    touchManagedPtr stream
    return result'

#if ENABLE_OVERLOADING
#endif

-- method FileLoader::get_buffer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Buffer"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_get_buffer" gtk_source_file_loader_get_buffer ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    IO (Ptr GtkSource.Buffer.Buffer)

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileLoaderGetBuffer ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> m GtkSource.Buffer.Buffer
    {- ^ __Returns:__ the 'GI.GtkSource.Objects.Buffer.Buffer' to load the contents into. -}
fileLoaderGetBuffer loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gtk_source_file_loader_get_buffer loader'
    checkUnexpectedReturnNULL "fileLoaderGetBuffer" result
    result' <- (newObject GtkSource.Buffer.Buffer) result
    touchManagedPtr loader
    return result'

#if ENABLE_OVERLOADING
data FileLoaderGetBufferMethodInfo
instance (signature ~ (m GtkSource.Buffer.Buffer), MonadIO m, IsFileLoader a) => O.MethodInfo FileLoaderGetBufferMethodInfo a signature where
    overloadedMethod _ = fileLoaderGetBuffer

#endif

-- method FileLoader::get_compression_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "CompressionType"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_get_compression_type" gtk_source_file_loader_get_compression_type ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    IO CUInt

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileLoaderGetCompressionType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> m GtkSource.Enums.CompressionType
    {- ^ __Returns:__ the detected compression type. -}
fileLoaderGetCompressionType loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gtk_source_file_loader_get_compression_type loader'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr loader
    return result'

#if ENABLE_OVERLOADING
data FileLoaderGetCompressionTypeMethodInfo
instance (signature ~ (m GtkSource.Enums.CompressionType), MonadIO m, IsFileLoader a) => O.MethodInfo FileLoaderGetCompressionTypeMethodInfo a signature where
    overloadedMethod _ = fileLoaderGetCompressionType

#endif

-- method FileLoader::get_encoding
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Encoding"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_get_encoding" gtk_source_file_loader_get_encoding ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    IO (Ptr GtkSource.Encoding.Encoding)

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileLoaderGetEncoding ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> m GtkSource.Encoding.Encoding
    {- ^ __Returns:__ the detected file encoding. -}
fileLoaderGetEncoding loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gtk_source_file_loader_get_encoding loader'
    checkUnexpectedReturnNULL "fileLoaderGetEncoding" result
    result' <- (newBoxed GtkSource.Encoding.Encoding) result
    touchManagedPtr loader
    return result'

#if ENABLE_OVERLOADING
data FileLoaderGetEncodingMethodInfo
instance (signature ~ (m GtkSource.Encoding.Encoding), MonadIO m, IsFileLoader a) => O.MethodInfo FileLoaderGetEncodingMethodInfo a signature where
    overloadedMethod _ = fileLoaderGetEncoding

#endif

-- method FileLoader::get_file
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "File"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_get_file" gtk_source_file_loader_get_file ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    IO (Ptr GtkSource.File.File)

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileLoaderGetFile ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> m GtkSource.File.File
    {- ^ __Returns:__ the 'GI.GtkSource.Objects.File.File'. -}
fileLoaderGetFile loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gtk_source_file_loader_get_file loader'
    checkUnexpectedReturnNULL "fileLoaderGetFile" result
    result' <- (newObject GtkSource.File.File) result
    touchManagedPtr loader
    return result'

#if ENABLE_OVERLOADING
data FileLoaderGetFileMethodInfo
instance (signature ~ (m GtkSource.File.File), MonadIO m, IsFileLoader a) => O.MethodInfo FileLoaderGetFileMethodInfo a signature where
    overloadedMethod _ = fileLoaderGetFile

#endif

-- method FileLoader::get_input_stream
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "InputStream"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_get_input_stream" gtk_source_file_loader_get_input_stream ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    IO (Ptr Gio.InputStream.InputStream)

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileLoaderGetInputStream ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> m (Maybe Gio.InputStream.InputStream)
    {- ^ __Returns:__ the 'GI.Gio.Objects.InputStream.InputStream' to load, or 'Nothing'
if a 'GI.Gio.Interfaces.File.File' is used. -}
fileLoaderGetInputStream loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gtk_source_file_loader_get_input_stream loader'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gio.InputStream.InputStream) result'
        return result''
    touchManagedPtr loader
    return maybeResult

#if ENABLE_OVERLOADING
data FileLoaderGetInputStreamMethodInfo
instance (signature ~ (m (Maybe Gio.InputStream.InputStream)), MonadIO m, IsFileLoader a) => O.MethodInfo FileLoaderGetInputStreamMethodInfo a signature where
    overloadedMethod _ = fileLoaderGetInputStream

#endif

-- method FileLoader::get_location
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "File"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_get_location" gtk_source_file_loader_get_location ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    IO (Ptr Gio.File.File)

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileLoaderGetLocation ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> m (Maybe Gio.File.File)
    {- ^ __Returns:__ the 'GI.Gio.Interfaces.File.File' to load, or 'Nothing'
if an input stream is used. -}
fileLoaderGetLocation loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gtk_source_file_loader_get_location loader'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gio.File.File) result'
        return result''
    touchManagedPtr loader
    return maybeResult

#if ENABLE_OVERLOADING
data FileLoaderGetLocationMethodInfo
instance (signature ~ (m (Maybe Gio.File.File)), MonadIO m, IsFileLoader a) => O.MethodInfo FileLoaderGetLocationMethodInfo a signature where
    overloadedMethod _ = fileLoaderGetLocation

#endif

-- method FileLoader::get_newline_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "NewlineType"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_get_newline_type" gtk_source_file_loader_get_newline_type ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    IO CUInt

{- |
/No description available in the introspection data./

/Since: 3.14/
-}
fileLoaderGetNewlineType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> m GtkSource.Enums.NewlineType
    {- ^ __Returns:__ the detected newline type. -}
fileLoaderGetNewlineType loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gtk_source_file_loader_get_newline_type loader'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr loader
    return result'

#if ENABLE_OVERLOADING
data FileLoaderGetNewlineTypeMethodInfo
instance (signature ~ (m GtkSource.Enums.NewlineType), MonadIO m, IsFileLoader a) => O.MethodInfo FileLoaderGetNewlineTypeMethodInfo a signature where
    overloadedMethod _ = fileLoaderGetNewlineType

#endif

-- method FileLoader::load_async
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "io_priority", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the I/O priority of the request. E.g. %G_PRIORITY_LOW,\n  %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "progress_callback", argType = TInterface (Name {namespace = "Gio", name = "FileProgressCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "function to call back with\n  progress information, or %NULL if progress information is not needed.", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 4, argDestroy = 5, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "progress_callback_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data to pass to @progress_callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "progress_callback_notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "function to call on\n  @progress_callback_data when the @progress_callback is no longer needed, or\n  %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback to call when the request is\n  satisfied.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 7, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data to pass to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_load_async" gtk_source_file_loader_load_async ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    Int32 ->                                -- io_priority : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_FileProgressCallback -> -- progress_callback : TInterface (Name {namespace = "Gio", name = "FileProgressCallback"})
    Ptr () ->                               -- progress_callback_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- progress_callback_notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
Loads asynchronously the file or input stream contents into the
'GI.GtkSource.Objects.Buffer.Buffer'. See the 'GI.Gio.Interfaces.AsyncResult.AsyncResult' documentation to know how to use this
function.

/Since: 3.14/
-}
fileLoaderLoadAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> Int32
    {- ^ /@ioPriority@/: the I\/O priority of the request. E.g. 'GI.GLib.Constants.PRIORITY_LOW',
  'GI.GLib.Constants.PRIORITY_DEFAULT' or 'GI.GLib.Constants.PRIORITY_HIGH'. -}
    -> Maybe (b)
    {- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
    -> Maybe (Gio.Callbacks.FileProgressCallback)
    {- ^ /@progressCallback@/: function to call back with
  progress information, or 'Nothing' if progress information is not needed. -}
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    {- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback' to call when the request is
  satisfied. -}
    -> m ()
fileLoaderLoadAsync loader ioPriority cancellable progressCallback callback = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    maybeCancellable <- case cancellable of
        Nothing -> return nullPtr
        Just jCancellable -> do
            jCancellable' <- unsafeManagedPtrCastPtr jCancellable
            return jCancellable'
    maybeProgressCallback <- case progressCallback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jProgressCallback -> do
            jProgressCallback' <- Gio.Callbacks.mk_FileProgressCallback (Gio.Callbacks.wrap_FileProgressCallback Nothing (Gio.Callbacks.drop_closures_FileProgressCallback jProgressCallback))
            return jProgressCallback'
    maybeCallback <- case callback of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jCallback -> do
            ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
            poke ptrcallback jCallback'
            return jCallback'
    let progressCallbackData = castFunPtrToPtr maybeProgressCallback
    let progressCallbackNotify = safeFreeFunPtrPtr
    let userData = nullPtr
    gtk_source_file_loader_load_async loader' ioPriority maybeCancellable maybeProgressCallback progressCallbackData progressCallbackNotify maybeCallback userData
    touchManagedPtr loader
    whenJust cancellable touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data FileLoaderLoadAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.FileProgressCallback) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFileLoader a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileLoaderLoadAsyncMethodInfo a signature where
    overloadedMethod _ = fileLoaderLoadAsync

#endif

-- method FileLoader::load_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_source_file_loader_load_finish" gtk_source_file_loader_load_finish ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Finishes a file loading started with 'GI.GtkSource.Objects.FileLoader.fileLoaderLoadAsync'.

If the contents has been loaded, the following 'GI.GtkSource.Objects.File.File' properties will
be updated: the location, the encoding, the newline type and the compression
type.

/Since: 3.14/
-}
fileLoaderLoadFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> b
    {- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
fileLoaderLoadFinish loader result_ = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ gtk_source_file_loader_load_finish loader' result_'
        touchManagedPtr loader
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
data FileLoaderLoadFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFileLoader a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileLoaderLoadFinishMethodInfo a signature where
    overloadedMethod _ = fileLoaderLoadFinish

#endif

-- method FileLoader::set_candidate_encodings
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GtkSource", name = "FileLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileLoader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "candidate_encodings", argType = TGSList (TInterface (Name {namespace = "GtkSource", name = "Encoding"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a list of\n  #GtkSourceEncoding<!-- -->s.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_loader_set_candidate_encodings" gtk_source_file_loader_set_candidate_encodings ::
    Ptr FileLoader ->                       -- loader : TInterface (Name {namespace = "GtkSource", name = "FileLoader"})
    Ptr (GSList (Ptr GtkSource.Encoding.Encoding)) -> -- candidate_encodings : TGSList (TInterface (Name {namespace = "GtkSource", name = "Encoding"}))
    IO ()

{- |
Sets the candidate encodings for the file loading. The encodings are tried in
the same order as the list.

For convenience, /@candidateEncodings@/ can contain duplicates. Only the first
occurrence of a duplicated encoding is kept in the list.

By default the candidate encodings are (in that order in the list):
1. If set, the 'GI.GtkSource.Objects.File.File'\'s encoding as returned by
'GI.GtkSource.Objects.File.fileGetEncoding'.
2. The default candidates as returned by
'GI.GtkSource.Functions.encodingGetDefaultCandidates'.

/Since: 3.14/
-}
fileLoaderSetCandidateEncodings ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileLoader a) =>
    a
    {- ^ /@loader@/: a 'GI.GtkSource.Objects.FileLoader.FileLoader'. -}
    -> [GtkSource.Encoding.Encoding]
    {- ^ /@candidateEncodings@/: a list of
  'GI.GtkSource.Structs.Encoding.Encoding'\<!-- -->s. -}
    -> m ()
fileLoaderSetCandidateEncodings loader candidateEncodings = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    candidateEncodings' <- mapM unsafeManagedPtrGetPtr candidateEncodings
    candidateEncodings'' <- packGSList candidateEncodings'
    gtk_source_file_loader_set_candidate_encodings loader' candidateEncodings''
    touchManagedPtr loader
    mapM_ touchManagedPtr candidateEncodings
    g_slist_free candidateEncodings''
    return ()

#if ENABLE_OVERLOADING
data FileLoaderSetCandidateEncodingsMethodInfo
instance (signature ~ ([GtkSource.Encoding.Encoding] -> m ()), MonadIO m, IsFileLoader a) => O.MethodInfo FileLoaderSetCandidateEncodingsMethodInfo a signature where
    overloadedMethod _ = fileLoaderSetCandidateEncodings

#endif