gi-gtksource-5.0.0: GtkSource bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.GtkSource.Objects.FileSaver

Description

Save a [classbuffer] into a file.

A GtkSourceFileSaver object permits to save a [classbuffer] into a File.

A file saver should be used only for one save operation, including errors handling. If an error occurs, you can reconfigure the saver and relaunch the operation with [methodfileSaver.save_async].

Synopsis

Exported types

newtype FileSaver Source #

Memory-managed wrapper type.

Constructors

FileSaver (ManagedPtr FileSaver) 

Instances

Instances details
Eq FileSaver Source # 
Instance details

Defined in GI.GtkSource.Objects.FileSaver

GObject FileSaver Source # 
Instance details

Defined in GI.GtkSource.Objects.FileSaver

ManagedPtrNewtype FileSaver Source # 
Instance details

Defined in GI.GtkSource.Objects.FileSaver

Methods

toManagedPtr :: FileSaver -> ManagedPtr FileSaver

TypedObject FileSaver Source # 
Instance details

Defined in GI.GtkSource.Objects.FileSaver

Methods

glibType :: IO GType

HasParentTypes FileSaver Source # 
Instance details

Defined in GI.GtkSource.Objects.FileSaver

IsGValue (Maybe FileSaver) Source #

Convert FileSaver to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.GtkSource.Objects.FileSaver

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe FileSaver -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe FileSaver)

type ParentTypes FileSaver Source # 
Instance details

Defined in GI.GtkSource.Objects.FileSaver

type ParentTypes FileSaver = '[Object]

class (GObject o, IsDescendantOf FileSaver o) => IsFileSaver o Source #

Type class for types which can be safely cast to FileSaver, for instance with toFileSaver.

Instances

Instances details
(GObject o, IsDescendantOf FileSaver o) => IsFileSaver o Source # 
Instance details

Defined in GI.GtkSource.Objects.FileSaver

toFileSaver :: (MonadIO m, IsFileSaver o) => o -> m FileSaver Source #

Cast to FileSaver, for types for which this is known to be safe. For general casts, use castTo.

Methods

getBuffer

fileSaverGetBuffer Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> m Buffer

Returns: the Buffer to save.

No description available in the introspection data.

getCompressionType

fileSaverGetCompressionType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> m CompressionType

Returns: the compression type.

No description available in the introspection data.

getEncoding

fileSaverGetEncoding Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> m Encoding

Returns: the encoding.

No description available in the introspection data.

getFile

fileSaverGetFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> m File

Returns: the File.

No description available in the introspection data.

getFlags

fileSaverGetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> m [FileSaverFlags]

Returns: the flags.

No description available in the introspection data.

getLocation

fileSaverGetLocation Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> m File

Returns: the File where to save the buffer to.

No description available in the introspection data.

getNewlineType

fileSaverGetNewlineType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> m NewlineType

Returns: the newline type.

No description available in the introspection data.

new

fileSaverNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsBuffer a, IsFile b) 
=> a

buffer: the Buffer to save.

-> b

file: the File.

-> m FileSaver

Returns: a new FileSaver object.

Creates a new FileSaver object. The buffer will be saved to the [classfile]'s location.

This constructor is suitable for a simple "save" operation, when the file already contains a non-Nothing [propertyfile:location].

newWithTarget

fileSaverNewWithTarget Source #

Arguments

:: (HasCallStack, MonadIO m, IsBuffer a, IsFile b, IsFile c) 
=> a

buffer: the Buffer to save.

-> b

file: the File.

-> c

targetLocation: the File where to save the buffer to.

-> m FileSaver

Returns: a new FileSaver object.

Creates a new FileSaver object with a target location.

When the file saving is finished successfully, targetLocation is set to the file's [propertyfile:location] property. If an error occurs, the previous valid location is still available in [classfile].

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

saveAsync

fileSaverSaveAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a, IsCancellable b) 
=> a

saver: a FileSaver.

-> Int32

ioPriority: the I/O priority of the request. E.g. PRIORITY_LOW, PRIORITY_DEFAULT or PRIORITY_HIGH.

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe FileProgressCallback

progressCallback: function to call back with progress information, or Nothing if progress information is not needed.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback to call when the request is satisfied.

-> m () 

Saves asynchronously the buffer into the file.

See the AsyncResult documentation to know how to use this function.

saveFinish

fileSaverSaveFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a, IsAsyncResult b) 
=> a

saver: a FileSaver.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

Finishes a file saving started with [methodfileSaver.save_async].

If the file has been saved successfully, the following [classfile] properties will be updated: the location, the encoding, the newline type and the compression type.

Since the 3.20 version, textBufferSetModified is called with False if the file has been saved successfully.

setCompressionType

fileSaverSetCompressionType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> CompressionType

compressionType: the new compression type.

-> m () 

Sets the compression type. By default the compression type is taken from the File.

setEncoding

fileSaverSetEncoding Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> Maybe Encoding

encoding: the new encoding, or Nothing for UTF-8.

-> m () 

Sets the encoding. If encoding is Nothing, the UTF-8 encoding will be set.

By default the encoding is taken from the File.

setFlags

fileSaverSetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> [FileSaverFlags]

flags: the new flags.

-> m () 

No description available in the introspection data.

setNewlineType

fileSaverSetNewlineType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileSaver a) 
=> a

saver: a FileSaver.

-> NewlineType

newlineType: the new newline type.

-> m () 

Sets the newline type. By default the newline type is taken from the File.

Properties

buffer

The Buffer to save. The FileSaver object has a weak reference to the buffer.

constructFileSaverBuffer :: (IsFileSaver o, MonadIO m, IsBuffer a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “buffer” property. This is rarely needed directly, but it is used by new.

getFileSaverBuffer :: (MonadIO m, IsFileSaver o) => o -> m Buffer Source #

Get the value of the “buffer” property. When overloading is enabled, this is equivalent to

get fileSaver #buffer

compressionType

The compression type.

constructFileSaverCompressionType :: (IsFileSaver o, MonadIO m) => CompressionType -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “compression-type” property. This is rarely needed directly, but it is used by new.

getFileSaverCompressionType :: (MonadIO m, IsFileSaver o) => o -> m CompressionType Source #

Get the value of the “compression-type” property. When overloading is enabled, this is equivalent to

get fileSaver #compressionType

setFileSaverCompressionType :: (MonadIO m, IsFileSaver o) => o -> CompressionType -> m () Source #

Set the value of the “compression-type” property. When overloading is enabled, this is equivalent to

set fileSaver [ #compressionType := value ]

encoding

The file's encoding.

clearFileSaverEncoding :: (MonadIO m, IsFileSaver o) => o -> m () Source #

Set the value of the “encoding” property to Nothing. When overloading is enabled, this is equivalent to

clear #encoding

constructFileSaverEncoding :: (IsFileSaver o, MonadIO m) => Encoding -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “encoding” property. This is rarely needed directly, but it is used by new.

getFileSaverEncoding :: (MonadIO m, IsFileSaver o) => o -> m Encoding Source #

Get the value of the “encoding” property. When overloading is enabled, this is equivalent to

get fileSaver #encoding

setFileSaverEncoding :: (MonadIO m, IsFileSaver o) => o -> Encoding -> m () Source #

Set the value of the “encoding” property. When overloading is enabled, this is equivalent to

set fileSaver [ #encoding := value ]

file

The File. The FileSaver object has a weak reference to the file.

constructFileSaverFile :: (IsFileSaver o, MonadIO m, IsFile a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “file” property. This is rarely needed directly, but it is used by new.

getFileSaverFile :: (MonadIO m, IsFileSaver o) => o -> m File Source #

Get the value of the “file” property. When overloading is enabled, this is equivalent to

get fileSaver #file

flags

File saving flags.

constructFileSaverFlags :: (IsFileSaver o, MonadIO m) => [FileSaverFlags] -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “flags” property. This is rarely needed directly, but it is used by new.

getFileSaverFlags :: (MonadIO m, IsFileSaver o) => o -> m [FileSaverFlags] Source #

Get the value of the “flags” property. When overloading is enabled, this is equivalent to

get fileSaver #flags

setFileSaverFlags :: (MonadIO m, IsFileSaver o) => o -> [FileSaverFlags] -> m () Source #

Set the value of the “flags” property. When overloading is enabled, this is equivalent to

set fileSaver [ #flags := value ]

location

The File where to save the buffer. By default the location is taken from the File at construction time.

constructFileSaverLocation :: (IsFileSaver o, MonadIO m, IsFile a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “location” property. This is rarely needed directly, but it is used by new.

getFileSaverLocation :: (MonadIO m, IsFileSaver o) => o -> m File Source #

Get the value of the “location” property. When overloading is enabled, this is equivalent to

get fileSaver #location

newlineType

The newline type.

constructFileSaverNewlineType :: (IsFileSaver o, MonadIO m) => NewlineType -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “newline-type” property. This is rarely needed directly, but it is used by new.

getFileSaverNewlineType :: (MonadIO m, IsFileSaver o) => o -> m NewlineType Source #

Get the value of the “newline-type” property. When overloading is enabled, this is equivalent to

get fileSaver #newlineType

setFileSaverNewlineType :: (MonadIO m, IsFileSaver o) => o -> NewlineType -> m () Source #

Set the value of the “newline-type” property. When overloading is enabled, this is equivalent to

set fileSaver [ #newlineType := value ]