{- |
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.FileSaver
    (

-- * Exported types
    FileSaver(..)                           ,
    IsFileSaver                             ,
    toFileSaver                             ,
    noFileSaver                             ,


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

#if ENABLE_OVERLOADING
    FileSaverGetBufferMethodInfo            ,
#endif
    fileSaverGetBuffer                      ,


-- ** getCompressionType #method:getCompressionType#

#if ENABLE_OVERLOADING
    FileSaverGetCompressionTypeMethodInfo   ,
#endif
    fileSaverGetCompressionType             ,


-- ** getEncoding #method:getEncoding#

#if ENABLE_OVERLOADING
    FileSaverGetEncodingMethodInfo          ,
#endif
    fileSaverGetEncoding                    ,


-- ** getFile #method:getFile#

#if ENABLE_OVERLOADING
    FileSaverGetFileMethodInfo              ,
#endif
    fileSaverGetFile                        ,


-- ** getFlags #method:getFlags#

#if ENABLE_OVERLOADING
    FileSaverGetFlagsMethodInfo             ,
#endif
    fileSaverGetFlags                       ,


-- ** getLocation #method:getLocation#

#if ENABLE_OVERLOADING
    FileSaverGetLocationMethodInfo          ,
#endif
    fileSaverGetLocation                    ,


-- ** getNewlineType #method:getNewlineType#

#if ENABLE_OVERLOADING
    FileSaverGetNewlineTypeMethodInfo       ,
#endif
    fileSaverGetNewlineType                 ,


-- ** new #method:new#

    fileSaverNew                            ,


-- ** newWithTarget #method:newWithTarget#

    fileSaverNewWithTarget                  ,


-- ** saveAsync #method:saveAsync#

#if ENABLE_OVERLOADING
    FileSaverSaveAsyncMethodInfo            ,
#endif
    fileSaverSaveAsync                      ,


-- ** saveFinish #method:saveFinish#

#if ENABLE_OVERLOADING
    FileSaverSaveFinishMethodInfo           ,
#endif
    fileSaverSaveFinish                     ,


-- ** setCompressionType #method:setCompressionType#

#if ENABLE_OVERLOADING
    FileSaverSetCompressionTypeMethodInfo   ,
#endif
    fileSaverSetCompressionType             ,


-- ** setEncoding #method:setEncoding#

#if ENABLE_OVERLOADING
    FileSaverSetEncodingMethodInfo          ,
#endif
    fileSaverSetEncoding                    ,


-- ** setFlags #method:setFlags#

#if ENABLE_OVERLOADING
    FileSaverSetFlagsMethodInfo             ,
#endif
    fileSaverSetFlags                       ,


-- ** setNewlineType #method:setNewlineType#

#if ENABLE_OVERLOADING
    FileSaverSetNewlineTypeMethodInfo       ,
#endif
    fileSaverSetNewlineType                 ,




 -- * Properties
-- ** buffer #attr:buffer#
{- | The 'GI.GtkSource.Objects.Buffer.Buffer' to save. The 'GI.GtkSource.Objects.FileSaver.FileSaver' object has a
weak reference to the buffer.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileSaverBufferPropertyInfo             ,
#endif
    constructFileSaverBuffer                ,
#if ENABLE_OVERLOADING
    fileSaverBuffer                         ,
#endif
    getFileSaverBuffer                      ,


-- ** compressionType #attr:compressionType#
{- | The compression type.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileSaverCompressionTypePropertyInfo    ,
#endif
    constructFileSaverCompressionType       ,
#if ENABLE_OVERLOADING
    fileSaverCompressionType                ,
#endif
    getFileSaverCompressionType             ,
    setFileSaverCompressionType             ,


-- ** encoding #attr:encoding#
{- | The file\'s encoding.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileSaverEncodingPropertyInfo           ,
#endif
    clearFileSaverEncoding                  ,
    constructFileSaverEncoding              ,
#if ENABLE_OVERLOADING
    fileSaverEncoding                       ,
#endif
    getFileSaverEncoding                    ,
    setFileSaverEncoding                    ,


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

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileSaverFilePropertyInfo               ,
#endif
    constructFileSaverFile                  ,
#if ENABLE_OVERLOADING
    fileSaverFile                           ,
#endif
    getFileSaverFile                        ,


-- ** flags #attr:flags#
{- | File saving flags.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileSaverFlagsPropertyInfo              ,
#endif
    constructFileSaverFlags                 ,
#if ENABLE_OVERLOADING
    fileSaverFlags                          ,
#endif
    getFileSaverFlags                       ,
    setFileSaverFlags                       ,


-- ** location #attr:location#
{- | The 'GI.Gio.Interfaces.File.File' where to save the buffer. By default the location is taken
from the 'GI.GtkSource.Objects.File.File' at construction time.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileSaverLocationPropertyInfo           ,
#endif
    constructFileSaverLocation              ,
#if ENABLE_OVERLOADING
    fileSaverLocation                       ,
#endif
    getFileSaverLocation                    ,


-- ** newlineType #attr:newlineType#
{- | The newline type.

/Since: 3.14/
-}
#if ENABLE_OVERLOADING
    FileSaverNewlineTypePropertyInfo        ,
#endif
    constructFileSaverNewlineType           ,
#if ENABLE_OVERLOADING
    fileSaverNewlineType                    ,
#endif
    getFileSaverNewlineType                 ,
    setFileSaverNewlineType                 ,




    ) 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 {-# SOURCE #-} qualified GI.GtkSource.Enums as GtkSource.Enums
import {-# SOURCE #-} qualified GI.GtkSource.Flags as GtkSource.Flags
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 FileSaver = FileSaver (ManagedPtr FileSaver)
foreign import ccall "gtk_source_file_saver_get_type"
    c_gtk_source_file_saver_get_type :: IO GType

instance GObject FileSaver where
    gobjectType = c_gtk_source_file_saver_get_type


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

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `FileSaver`.
noFileSaver :: Maybe FileSaver
noFileSaver = Nothing

#if ENABLE_OVERLOADING
type family ResolveFileSaverMethod (t :: Symbol) (o :: *) :: * where
    ResolveFileSaverMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveFileSaverMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveFileSaverMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveFileSaverMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveFileSaverMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveFileSaverMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveFileSaverMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveFileSaverMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveFileSaverMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveFileSaverMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveFileSaverMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveFileSaverMethod "saveAsync" o = FileSaverSaveAsyncMethodInfo
    ResolveFileSaverMethod "saveFinish" o = FileSaverSaveFinishMethodInfo
    ResolveFileSaverMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveFileSaverMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveFileSaverMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveFileSaverMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveFileSaverMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveFileSaverMethod "getBuffer" o = FileSaverGetBufferMethodInfo
    ResolveFileSaverMethod "getCompressionType" o = FileSaverGetCompressionTypeMethodInfo
    ResolveFileSaverMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveFileSaverMethod "getEncoding" o = FileSaverGetEncodingMethodInfo
    ResolveFileSaverMethod "getFile" o = FileSaverGetFileMethodInfo
    ResolveFileSaverMethod "getFlags" o = FileSaverGetFlagsMethodInfo
    ResolveFileSaverMethod "getLocation" o = FileSaverGetLocationMethodInfo
    ResolveFileSaverMethod "getNewlineType" o = FileSaverGetNewlineTypeMethodInfo
    ResolveFileSaverMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveFileSaverMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveFileSaverMethod "setCompressionType" o = FileSaverSetCompressionTypeMethodInfo
    ResolveFileSaverMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveFileSaverMethod "setEncoding" o = FileSaverSetEncodingMethodInfo
    ResolveFileSaverMethod "setFlags" o = FileSaverSetFlagsMethodInfo
    ResolveFileSaverMethod "setNewlineType" o = FileSaverSetNewlineTypeMethodInfo
    ResolveFileSaverMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveFileSaverMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveFileSaverMethod t FileSaver, O.MethodInfo info FileSaver p) => OL.IsLabel t (FileSaver -> 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' fileSaver #buffer
@
-}
getFileSaverBuffer :: (MonadIO m, IsFileSaver o) => o -> m GtkSource.Buffer.Buffer
getFileSaverBuffer obj = liftIO $ checkUnexpectedNothing "getFileSaverBuffer" $ 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`.
-}
constructFileSaverBuffer :: (IsFileSaver o, GtkSource.Buffer.IsBuffer a) => a -> IO (GValueConstruct o)
constructFileSaverBuffer val = B.Properties.constructObjectPropertyObject "buffer" (Just val)

#if ENABLE_OVERLOADING
data FileSaverBufferPropertyInfo
instance AttrInfo FileSaverBufferPropertyInfo where
    type AttrAllowedOps FileSaverBufferPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileSaverBufferPropertyInfo = GtkSource.Buffer.IsBuffer
    type AttrBaseTypeConstraint FileSaverBufferPropertyInfo = IsFileSaver
    type AttrGetType FileSaverBufferPropertyInfo = GtkSource.Buffer.Buffer
    type AttrLabel FileSaverBufferPropertyInfo = "buffer"
    type AttrOrigin FileSaverBufferPropertyInfo = FileSaver
    attrGet _ = getFileSaverBuffer
    attrSet _ = undefined
    attrConstruct _ = constructFileSaverBuffer
    attrClear _ = undefined
#endif

-- VVV Prop "compression-type"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "CompressionType"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just False)

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

@
'Data.GI.Base.Attributes.get' fileSaver #compressionType
@
-}
getFileSaverCompressionType :: (MonadIO m, IsFileSaver o) => o -> m GtkSource.Enums.CompressionType
getFileSaverCompressionType obj = liftIO $ B.Properties.getObjectPropertyEnum obj "compression-type"

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

@
'Data.GI.Base.Attributes.set' fileSaver [ #compressionType 'Data.GI.Base.Attributes.:=' value ]
@
-}
setFileSaverCompressionType :: (MonadIO m, IsFileSaver o) => o -> GtkSource.Enums.CompressionType -> m ()
setFileSaverCompressionType obj val = liftIO $ B.Properties.setObjectPropertyEnum obj "compression-type" val

{- |
Construct a `GValueConstruct` with valid value for the “@compression-type@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructFileSaverCompressionType :: (IsFileSaver o) => GtkSource.Enums.CompressionType -> IO (GValueConstruct o)
constructFileSaverCompressionType val = B.Properties.constructObjectPropertyEnum "compression-type" val

#if ENABLE_OVERLOADING
data FileSaverCompressionTypePropertyInfo
instance AttrInfo FileSaverCompressionTypePropertyInfo where
    type AttrAllowedOps FileSaverCompressionTypePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint FileSaverCompressionTypePropertyInfo = (~) GtkSource.Enums.CompressionType
    type AttrBaseTypeConstraint FileSaverCompressionTypePropertyInfo = IsFileSaver
    type AttrGetType FileSaverCompressionTypePropertyInfo = GtkSource.Enums.CompressionType
    type AttrLabel FileSaverCompressionTypePropertyInfo = "compression-type"
    type AttrOrigin FileSaverCompressionTypePropertyInfo = FileSaver
    attrGet _ = getFileSaverCompressionType
    attrSet _ = setFileSaverCompressionType
    attrConstruct _ = constructFileSaverCompressionType
    attrClear _ = undefined
#endif

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

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

@
'Data.GI.Base.Attributes.get' fileSaver #encoding
@
-}
getFileSaverEncoding :: (MonadIO m, IsFileSaver o) => o -> m GtkSource.Encoding.Encoding
getFileSaverEncoding obj = liftIO $ checkUnexpectedNothing "getFileSaverEncoding" $ B.Properties.getObjectPropertyBoxed obj "encoding" GtkSource.Encoding.Encoding

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

@
'Data.GI.Base.Attributes.set' fileSaver [ #encoding 'Data.GI.Base.Attributes.:=' value ]
@
-}
setFileSaverEncoding :: (MonadIO m, IsFileSaver o) => o -> GtkSource.Encoding.Encoding -> m ()
setFileSaverEncoding obj val = liftIO $ B.Properties.setObjectPropertyBoxed obj "encoding" (Just val)

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

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

@
'Data.GI.Base.Attributes.clear' #encoding
@
-}
clearFileSaverEncoding :: (MonadIO m, IsFileSaver o) => o -> m ()
clearFileSaverEncoding obj = liftIO $ B.Properties.setObjectPropertyBoxed obj "encoding" (Nothing :: Maybe GtkSource.Encoding.Encoding)

#if ENABLE_OVERLOADING
data FileSaverEncodingPropertyInfo
instance AttrInfo FileSaverEncodingPropertyInfo where
    type AttrAllowedOps FileSaverEncodingPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileSaverEncodingPropertyInfo = (~) GtkSource.Encoding.Encoding
    type AttrBaseTypeConstraint FileSaverEncodingPropertyInfo = IsFileSaver
    type AttrGetType FileSaverEncodingPropertyInfo = GtkSource.Encoding.Encoding
    type AttrLabel FileSaverEncodingPropertyInfo = "encoding"
    type AttrOrigin FileSaverEncodingPropertyInfo = FileSaver
    attrGet _ = getFileSaverEncoding
    attrSet _ = setFileSaverEncoding
    attrConstruct _ = constructFileSaverEncoding
    attrClear _ = clearFileSaverEncoding
#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' fileSaver #file
@
-}
getFileSaverFile :: (MonadIO m, IsFileSaver o) => o -> m GtkSource.File.File
getFileSaverFile obj = liftIO $ checkUnexpectedNothing "getFileSaverFile" $ 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`.
-}
constructFileSaverFile :: (IsFileSaver o, GtkSource.File.IsFile a) => a -> IO (GValueConstruct o)
constructFileSaverFile val = B.Properties.constructObjectPropertyObject "file" (Just val)

#if ENABLE_OVERLOADING
data FileSaverFilePropertyInfo
instance AttrInfo FileSaverFilePropertyInfo where
    type AttrAllowedOps FileSaverFilePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileSaverFilePropertyInfo = GtkSource.File.IsFile
    type AttrBaseTypeConstraint FileSaverFilePropertyInfo = IsFileSaver
    type AttrGetType FileSaverFilePropertyInfo = GtkSource.File.File
    type AttrLabel FileSaverFilePropertyInfo = "file"
    type AttrOrigin FileSaverFilePropertyInfo = FileSaver
    attrGet _ = getFileSaverFile
    attrSet _ = undefined
    attrConstruct _ = constructFileSaverFile
    attrClear _ = undefined
#endif

-- VVV Prop "flags"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "FileSaverFlags"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just False)

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

@
'Data.GI.Base.Attributes.get' fileSaver #flags
@
-}
getFileSaverFlags :: (MonadIO m, IsFileSaver o) => o -> m [GtkSource.Flags.FileSaverFlags]
getFileSaverFlags obj = liftIO $ B.Properties.getObjectPropertyFlags obj "flags"

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

@
'Data.GI.Base.Attributes.set' fileSaver [ #flags 'Data.GI.Base.Attributes.:=' value ]
@
-}
setFileSaverFlags :: (MonadIO m, IsFileSaver o) => o -> [GtkSource.Flags.FileSaverFlags] -> m ()
setFileSaverFlags obj val = liftIO $ B.Properties.setObjectPropertyFlags obj "flags" val

{- |
Construct a `GValueConstruct` with valid value for the “@flags@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructFileSaverFlags :: (IsFileSaver o) => [GtkSource.Flags.FileSaverFlags] -> IO (GValueConstruct o)
constructFileSaverFlags val = B.Properties.constructObjectPropertyFlags "flags" val

#if ENABLE_OVERLOADING
data FileSaverFlagsPropertyInfo
instance AttrInfo FileSaverFlagsPropertyInfo where
    type AttrAllowedOps FileSaverFlagsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint FileSaverFlagsPropertyInfo = (~) [GtkSource.Flags.FileSaverFlags]
    type AttrBaseTypeConstraint FileSaverFlagsPropertyInfo = IsFileSaver
    type AttrGetType FileSaverFlagsPropertyInfo = [GtkSource.Flags.FileSaverFlags]
    type AttrLabel FileSaverFlagsPropertyInfo = "flags"
    type AttrOrigin FileSaverFlagsPropertyInfo = FileSaver
    attrGet _ = getFileSaverFlags
    attrSet _ = setFileSaverFlags
    attrConstruct _ = constructFileSaverFlags
    attrClear _ = undefined
#endif

-- VVV Prop "location"
   -- Type: TInterface (Name {namespace = "Gio", name = "File"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,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' fileSaver #location
@
-}
getFileSaverLocation :: (MonadIO m, IsFileSaver o) => o -> m Gio.File.File
getFileSaverLocation obj = liftIO $ checkUnexpectedNothing "getFileSaverLocation" $ 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`.
-}
constructFileSaverLocation :: (IsFileSaver o, Gio.File.IsFile a) => a -> IO (GValueConstruct o)
constructFileSaverLocation val = B.Properties.constructObjectPropertyObject "location" (Just val)

#if ENABLE_OVERLOADING
data FileSaverLocationPropertyInfo
instance AttrInfo FileSaverLocationPropertyInfo where
    type AttrAllowedOps FileSaverLocationPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint FileSaverLocationPropertyInfo = Gio.File.IsFile
    type AttrBaseTypeConstraint FileSaverLocationPropertyInfo = IsFileSaver
    type AttrGetType FileSaverLocationPropertyInfo = Gio.File.File
    type AttrLabel FileSaverLocationPropertyInfo = "location"
    type AttrOrigin FileSaverLocationPropertyInfo = FileSaver
    attrGet _ = getFileSaverLocation
    attrSet _ = undefined
    attrConstruct _ = constructFileSaverLocation
    attrClear _ = undefined
#endif

-- VVV Prop "newline-type"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "NewlineType"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just False)

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

@
'Data.GI.Base.Attributes.get' fileSaver #newlineType
@
-}
getFileSaverNewlineType :: (MonadIO m, IsFileSaver o) => o -> m GtkSource.Enums.NewlineType
getFileSaverNewlineType obj = liftIO $ B.Properties.getObjectPropertyEnum obj "newline-type"

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

@
'Data.GI.Base.Attributes.set' fileSaver [ #newlineType 'Data.GI.Base.Attributes.:=' value ]
@
-}
setFileSaverNewlineType :: (MonadIO m, IsFileSaver o) => o -> GtkSource.Enums.NewlineType -> m ()
setFileSaverNewlineType obj val = liftIO $ B.Properties.setObjectPropertyEnum obj "newline-type" val

{- |
Construct a `GValueConstruct` with valid value for the “@newline-type@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructFileSaverNewlineType :: (IsFileSaver o) => GtkSource.Enums.NewlineType -> IO (GValueConstruct o)
constructFileSaverNewlineType val = B.Properties.constructObjectPropertyEnum "newline-type" val

#if ENABLE_OVERLOADING
data FileSaverNewlineTypePropertyInfo
instance AttrInfo FileSaverNewlineTypePropertyInfo where
    type AttrAllowedOps FileSaverNewlineTypePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint FileSaverNewlineTypePropertyInfo = (~) GtkSource.Enums.NewlineType
    type AttrBaseTypeConstraint FileSaverNewlineTypePropertyInfo = IsFileSaver
    type AttrGetType FileSaverNewlineTypePropertyInfo = GtkSource.Enums.NewlineType
    type AttrLabel FileSaverNewlineTypePropertyInfo = "newline-type"
    type AttrOrigin FileSaverNewlineTypePropertyInfo = FileSaver
    attrGet _ = getFileSaverNewlineType
    attrSet _ = setFileSaverNewlineType
    attrConstruct _ = constructFileSaverNewlineType
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList FileSaver
type instance O.AttributeList FileSaver = FileSaverAttributeList
type FileSaverAttributeList = ('[ '("buffer", FileSaverBufferPropertyInfo), '("compressionType", FileSaverCompressionTypePropertyInfo), '("encoding", FileSaverEncodingPropertyInfo), '("file", FileSaverFilePropertyInfo), '("flags", FileSaverFlagsPropertyInfo), '("location", FileSaverLocationPropertyInfo), '("newlineType", FileSaverNewlineTypePropertyInfo)] :: [(Symbol, *)])
#endif

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

fileSaverCompressionType :: AttrLabelProxy "compressionType"
fileSaverCompressionType = AttrLabelProxy

fileSaverEncoding :: AttrLabelProxy "encoding"
fileSaverEncoding = AttrLabelProxy

fileSaverFile :: AttrLabelProxy "file"
fileSaverFile = AttrLabelProxy

fileSaverFlags :: AttrLabelProxy "flags"
fileSaverFlags = AttrLabelProxy

fileSaverLocation :: AttrLabelProxy "location"
fileSaverLocation = AttrLabelProxy

fileSaverNewlineType :: AttrLabelProxy "newlineType"
fileSaverNewlineType = AttrLabelProxy

#endif

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

#endif

-- method FileSaver::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 save.", 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 = "FileSaver"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_file_saver_new" gtk_source_file_saver_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 FileSaver)

{- |
Creates a new 'GI.GtkSource.Objects.FileSaver.FileSaver' object. The /@buffer@/ will be saved to the
'GI.GtkSource.Objects.File.File'\'s location.

This constructor is suitable for a simple \"save\" operation, when the /@file@/
already contains a non-'Nothing' 'GI.GtkSource.Objects.File.File':@/location/@.

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

#if ENABLE_OVERLOADING
#endif

-- method FileSaver::new_with_target
-- 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 save.", 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 = "target_location", argType = TInterface (Name {namespace = "Gio", name = "File"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GFile where to save the buffer to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "FileSaver"}))
-- throws : False
-- Skip return : False

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

{- |
Creates a new 'GI.GtkSource.Objects.FileSaver.FileSaver' object with a target location. When the
file saving is finished successfully, /@targetLocation@/ is set to the /@file@/\'s
'GI.GtkSource.Objects.File.File':@/location/@ property. If an error occurs, the previous valid
location is still available in 'GI.GtkSource.Objects.File.File'.

This constructor is suitable for a \"save as\" operation, or for saving a new
buffer for the first time.

/Since: 3.14/
-}
fileSaverNewWithTarget ::
    (B.CallStack.HasCallStack, MonadIO m, GtkSource.Buffer.IsBuffer a, GtkSource.File.IsFile b, Gio.File.IsFile c) =>
    a
    {- ^ /@buffer@/: the 'GI.GtkSource.Objects.Buffer.Buffer' to save. -}
    -> b
    {- ^ /@file@/: the 'GI.GtkSource.Objects.File.File'. -}
    -> c
    {- ^ /@targetLocation@/: the 'GI.Gio.Interfaces.File.File' where to save the buffer to. -}
    -> m FileSaver
    {- ^ __Returns:__ a new 'GI.GtkSource.Objects.FileSaver.FileSaver' object. -}
fileSaverNewWithTarget buffer file targetLocation = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    file' <- unsafeManagedPtrCastPtr file
    targetLocation' <- unsafeManagedPtrCastPtr targetLocation
    result <- gtk_source_file_saver_new_with_target buffer' file' targetLocation'
    checkUnexpectedReturnNULL "fileSaverNewWithTarget" result
    result' <- (wrapObject FileSaver) result
    touchManagedPtr buffer
    touchManagedPtr file
    touchManagedPtr targetLocation
    return result'

#if ENABLE_OVERLOADING
#endif

-- method FileSaver::get_buffer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", 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_saver_get_buffer" gtk_source_file_saver_get_buffer ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    IO (Ptr GtkSource.Buffer.Buffer)

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

/Since: 3.14/
-}
fileSaverGetBuffer ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> m GtkSource.Buffer.Buffer
    {- ^ __Returns:__ the 'GI.GtkSource.Objects.Buffer.Buffer' to save. -}
fileSaverGetBuffer saver = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    result <- gtk_source_file_saver_get_buffer saver'
    checkUnexpectedReturnNULL "fileSaverGetBuffer" result
    result' <- (newObject GtkSource.Buffer.Buffer) result
    touchManagedPtr saver
    return result'

#if ENABLE_OVERLOADING
data FileSaverGetBufferMethodInfo
instance (signature ~ (m GtkSource.Buffer.Buffer), MonadIO m, IsFileSaver a) => O.MethodInfo FileSaverGetBufferMethodInfo a signature where
    overloadedMethod _ = fileSaverGetBuffer

#endif

-- method FileSaver::get_compression_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", 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_saver_get_compression_type" gtk_source_file_saver_get_compression_type ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    IO CUInt

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

/Since: 3.14/
-}
fileSaverGetCompressionType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> m GtkSource.Enums.CompressionType
    {- ^ __Returns:__ the compression type. -}
fileSaverGetCompressionType saver = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    result <- gtk_source_file_saver_get_compression_type saver'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr saver
    return result'

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

#endif

-- method FileSaver::get_encoding
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", 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_saver_get_encoding" gtk_source_file_saver_get_encoding ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    IO (Ptr GtkSource.Encoding.Encoding)

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

/Since: 3.14/
-}
fileSaverGetEncoding ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> m GtkSource.Encoding.Encoding
    {- ^ __Returns:__ the encoding. -}
fileSaverGetEncoding saver = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    result <- gtk_source_file_saver_get_encoding saver'
    checkUnexpectedReturnNULL "fileSaverGetEncoding" result
    result' <- (newBoxed GtkSource.Encoding.Encoding) result
    touchManagedPtr saver
    return result'

#if ENABLE_OVERLOADING
data FileSaverGetEncodingMethodInfo
instance (signature ~ (m GtkSource.Encoding.Encoding), MonadIO m, IsFileSaver a) => O.MethodInfo FileSaverGetEncodingMethodInfo a signature where
    overloadedMethod _ = fileSaverGetEncoding

#endif

-- method FileSaver::get_file
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", 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_saver_get_file" gtk_source_file_saver_get_file ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    IO (Ptr GtkSource.File.File)

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

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

#if ENABLE_OVERLOADING
data FileSaverGetFileMethodInfo
instance (signature ~ (m GtkSource.File.File), MonadIO m, IsFileSaver a) => O.MethodInfo FileSaverGetFileMethodInfo a signature where
    overloadedMethod _ = fileSaverGetFile

#endif

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

foreign import ccall "gtk_source_file_saver_get_flags" gtk_source_file_saver_get_flags ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    IO CUInt

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

/Since: 3.14/
-}
fileSaverGetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> m [GtkSource.Flags.FileSaverFlags]
    {- ^ __Returns:__ the flags. -}
fileSaverGetFlags saver = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    result <- gtk_source_file_saver_get_flags saver'
    let result' = wordToGFlags result
    touchManagedPtr saver
    return result'

#if ENABLE_OVERLOADING
data FileSaverGetFlagsMethodInfo
instance (signature ~ (m [GtkSource.Flags.FileSaverFlags]), MonadIO m, IsFileSaver a) => O.MethodInfo FileSaverGetFlagsMethodInfo a signature where
    overloadedMethod _ = fileSaverGetFlags

#endif

-- method FileSaver::get_location
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", 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_saver_get_location" gtk_source_file_saver_get_location ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    IO (Ptr Gio.File.File)

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

/Since: 3.14/
-}
fileSaverGetLocation ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> m Gio.File.File
    {- ^ __Returns:__ the 'GI.Gio.Interfaces.File.File' where to save the buffer to. -}
fileSaverGetLocation saver = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    result <- gtk_source_file_saver_get_location saver'
    checkUnexpectedReturnNULL "fileSaverGetLocation" result
    result' <- (newObject Gio.File.File) result
    touchManagedPtr saver
    return result'

#if ENABLE_OVERLOADING
data FileSaverGetLocationMethodInfo
instance (signature ~ (m Gio.File.File), MonadIO m, IsFileSaver a) => O.MethodInfo FileSaverGetLocationMethodInfo a signature where
    overloadedMethod _ = fileSaverGetLocation

#endif

-- method FileSaver::get_newline_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", 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_saver_get_newline_type" gtk_source_file_saver_get_newline_type ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    IO CUInt

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

/Since: 3.14/
-}
fileSaverGetNewlineType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> m GtkSource.Enums.NewlineType
    {- ^ __Returns:__ the newline type. -}
fileSaverGetNewlineType saver = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    result <- gtk_source_file_saver_get_newline_type saver'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr saver
    return result'

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

#endif

-- method FileSaver::save_async
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", 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_saver_save_async" gtk_source_file_saver_save_async ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    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 ()

{- |
Saves asynchronously the buffer into the file. See the 'GI.Gio.Interfaces.AsyncResult.AsyncResult'
documentation to know how to use this function.

/Since: 3.14/
-}
fileSaverSaveAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a, Gio.Cancellable.IsCancellable b) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> 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 ()
fileSaverSaveAsync saver ioPriority cancellable progressCallback callback = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    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_saver_save_async saver' ioPriority maybeCancellable maybeProgressCallback progressCallbackData progressCallbackNotify maybeCallback userData
    touchManagedPtr saver
    whenJust cancellable touchManagedPtr
    return ()

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

#endif

-- method FileSaver::save_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", 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_saver_save_finish" gtk_source_file_saver_save_finish ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Finishes a file saving started with 'GI.GtkSource.Objects.FileSaver.fileSaverSaveAsync'.

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

Since the 3.20 version, 'GI.Gtk.Objects.TextBuffer.textBufferSetModified' is called with 'False'
if the file has been saved successfully.

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

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

#endif

-- method FileSaver::set_compression_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "compression_type", argType = TInterface (Name {namespace = "GtkSource", name = "CompressionType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new compression type.", 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_saver_set_compression_type" gtk_source_file_saver_set_compression_type ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    CUInt ->                                -- compression_type : TInterface (Name {namespace = "GtkSource", name = "CompressionType"})
    IO ()

{- |
Sets the compression type. By default the compression type is taken from the
'GI.GtkSource.Objects.File.File'.

/Since: 3.14/
-}
fileSaverSetCompressionType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> GtkSource.Enums.CompressionType
    {- ^ /@compressionType@/: the new compression type. -}
    -> m ()
fileSaverSetCompressionType saver compressionType = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    let compressionType' = (fromIntegral . fromEnum) compressionType
    gtk_source_file_saver_set_compression_type saver' compressionType'
    touchManagedPtr saver
    return ()

#if ENABLE_OVERLOADING
data FileSaverSetCompressionTypeMethodInfo
instance (signature ~ (GtkSource.Enums.CompressionType -> m ()), MonadIO m, IsFileSaver a) => O.MethodInfo FileSaverSetCompressionTypeMethodInfo a signature where
    overloadedMethod _ = fileSaverSetCompressionType

#endif

-- method FileSaver::set_encoding
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "encoding", argType = TInterface (Name {namespace = "GtkSource", name = "Encoding"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the new encoding, or %NULL for UTF-8.", 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_saver_set_encoding" gtk_source_file_saver_set_encoding ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    Ptr GtkSource.Encoding.Encoding ->      -- encoding : TInterface (Name {namespace = "GtkSource", name = "Encoding"})
    IO ()

{- |
Sets the encoding. If /@encoding@/ is 'Nothing', the UTF-8 encoding will be set.
By default the encoding is taken from the 'GI.GtkSource.Objects.File.File'.

/Since: 3.14/
-}
fileSaverSetEncoding ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> Maybe (GtkSource.Encoding.Encoding)
    {- ^ /@encoding@/: the new encoding, or 'Nothing' for UTF-8. -}
    -> m ()
fileSaverSetEncoding saver encoding = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    maybeEncoding <- case encoding of
        Nothing -> return nullPtr
        Just jEncoding -> do
            jEncoding' <- unsafeManagedPtrGetPtr jEncoding
            return jEncoding'
    gtk_source_file_saver_set_encoding saver' maybeEncoding
    touchManagedPtr saver
    whenJust encoding touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data FileSaverSetEncodingMethodInfo
instance (signature ~ (Maybe (GtkSource.Encoding.Encoding) -> m ()), MonadIO m, IsFileSaver a) => O.MethodInfo FileSaverSetEncodingMethodInfo a signature where
    overloadedMethod _ = fileSaverSetEncoding

#endif

-- method FileSaver::set_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaverFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new flags.", 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_saver_set_flags" gtk_source_file_saver_set_flags ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "GtkSource", name = "FileSaverFlags"})
    IO ()

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

/Since: 3.14/
-}
fileSaverSetFlags ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> [GtkSource.Flags.FileSaverFlags]
    {- ^ /@flags@/: the new flags. -}
    -> m ()
fileSaverSetFlags saver flags = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    let flags' = gflagsToWord flags
    gtk_source_file_saver_set_flags saver' flags'
    touchManagedPtr saver
    return ()

#if ENABLE_OVERLOADING
data FileSaverSetFlagsMethodInfo
instance (signature ~ ([GtkSource.Flags.FileSaverFlags] -> m ()), MonadIO m, IsFileSaver a) => O.MethodInfo FileSaverSetFlagsMethodInfo a signature where
    overloadedMethod _ = fileSaverSetFlags

#endif

-- method FileSaver::set_newline_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "saver", argType = TInterface (Name {namespace = "GtkSource", name = "FileSaver"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceFileSaver.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "newline_type", argType = TInterface (Name {namespace = "GtkSource", name = "NewlineType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new newline type.", 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_saver_set_newline_type" gtk_source_file_saver_set_newline_type ::
    Ptr FileSaver ->                        -- saver : TInterface (Name {namespace = "GtkSource", name = "FileSaver"})
    CUInt ->                                -- newline_type : TInterface (Name {namespace = "GtkSource", name = "NewlineType"})
    IO ()

{- |
Sets the newline type. By default the newline type is taken from the
'GI.GtkSource.Objects.File.File'.

/Since: 3.14/
-}
fileSaverSetNewlineType ::
    (B.CallStack.HasCallStack, MonadIO m, IsFileSaver a) =>
    a
    {- ^ /@saver@/: a 'GI.GtkSource.Objects.FileSaver.FileSaver'. -}
    -> GtkSource.Enums.NewlineType
    {- ^ /@newlineType@/: the new newline type. -}
    -> m ()
fileSaverSetNewlineType saver newlineType = liftIO $ do
    saver' <- unsafeManagedPtrCastPtr saver
    let newlineType' = (fromIntegral . fromEnum) newlineType
    gtk_source_file_saver_set_newline_type saver' newlineType'
    touchManagedPtr saver
    return ()

#if ENABLE_OVERLOADING
data FileSaverSetNewlineTypeMethodInfo
instance (signature ~ (GtkSource.Enums.NewlineType -> m ()), MonadIO m, IsFileSaver a) => O.MethodInfo FileSaverSetNewlineTypeMethodInfo a signature where
    overloadedMethod _ = fileSaverSetNewlineType

#endif