GtkSource.FileSaver¶
Subclasses: | None |
---|
Methods¶
Inherited: | GObject.Object (37) |
---|---|
Structs: | GObject.ObjectClass (5) |
class | new (buffer, file) |
class | new_with_target (buffer, file, target_location) |
get_buffer () |
|
get_compression_type () |
|
get_encoding () |
|
get_file () |
|
get_flags () |
|
get_location () |
|
get_newline_type () |
|
save_async (io_priority, cancellable, progress_callback, progress_callback_data, callback, *user_data) |
|
save_finish (result) |
|
set_compression_type (compression_type) |
|
set_encoding (encoding) |
|
set_flags (flags) |
|
set_newline_type (newline_type) |
Virtual Methods¶
Inherited: | GObject.Object (7) |
---|
Properties¶
Name | Type | Flags | Short Description |
---|---|---|---|
buffer |
GtkSource.Buffer |
r/w/co | |
compression-type |
GtkSource.CompressionType |
r/w/c | |
encoding |
GtkSource.Encoding |
r/w/c | |
file |
GtkSource.File |
r/w/co | |
flags |
GtkSource.FileSaverFlags |
r/w/c | |
location |
Gio.File |
r/w/co | |
newline-type |
GtkSource.NewlineType |
r/w/c |
Signals¶
Inherited: | GObject.Object (1) |
---|
Class Details¶
-
class
GtkSource.
FileSaver
(**kwargs)¶ Bases: GObject.Object
Abstract: No Structure: GtkSource.FileSaverClass
-
classmethod
new
(buffer, file)¶ Parameters: - buffer (
GtkSource.Buffer
) – theGtkSource.Buffer
to save. - file (
GtkSource.File
) – theGtkSource.File
.
Returns: a new
GtkSource.FileSaver
object.Return type: Creates a new
GtkSource.FileSaver
object. The buffer will be saved to theGtkSource.File
’s location.This constructor is suitable for a simple “save” operation, when the file already contains a non-
None
GtkSource.File
:location
.New in version 3.14.
- buffer (
-
classmethod
new_with_target
(buffer, file, target_location)¶ Parameters: - buffer (
GtkSource.Buffer
) – theGtkSource.Buffer
to save. - file (
GtkSource.File
) – theGtkSource.File
. - target_location (
Gio.File
) – theGio.File
where to save the buffer to.
Returns: a new
GtkSource.FileSaver
object.Return type: Creates a new
GtkSource.FileSaver
object with a target location. When the file saving is finished successfully, target_location is set to the file’sGtkSource.File
:location
property. If an error occurs, the previous valid location is still available inGtkSource.File
.This constructor is suitable for a “save as” operation, or for saving a new buffer for the first time.
New in version 3.14.
- buffer (
-
get_buffer
()¶ Returns: the GtkSource.Buffer
to save.Return type: GtkSource.Buffer
New in version 3.14.
-
get_compression_type
()¶ Returns: the compression type. Return type: GtkSource.CompressionType
New in version 3.14.
-
get_encoding
()¶ Returns: the encoding. Return type: GtkSource.Encoding
New in version 3.14.
-
get_file
()¶ Returns: the GtkSource.File
.Return type: GtkSource.File
New in version 3.14.
-
get_flags
()¶ Returns: the flags. Return type: GtkSource.FileSaverFlags
New in version 3.14.
-
get_location
()¶ Returns: the Gio.File
where to save the buffer to.Return type: Gio.File
New in version 3.14.
-
get_newline_type
()¶ Returns: the newline type. Return type: GtkSource.NewlineType
New in version 3.14.
-
save_async
(io_priority, cancellable, progress_callback, progress_callback_data, callback, *user_data)¶ Parameters: - io_priority (
int
) – the I/O priority of the request. E.g.GLib.PRIORITY_LOW
,GLib.PRIORITY_DEFAULT
orGLib.PRIORITY_HIGH
. - cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore. - progress_callback (
Gio.FileProgressCallback
orNone
) – function to call back with progress information, orNone
if progress information is not needed. - progress_callback_data (
object
orNone
) – user data to pass to progress_callback. - callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfied. - user_data (
object
orNone
) – user data to pass to callback.
Saves asynchronously the buffer into the file. See the
Gio.AsyncResult
documentation to know how to use this function.New in version 3.14.
- io_priority (
-
save_finish
(result)¶ Parameters: result ( Gio.AsyncResult
) – aGio.AsyncResult
.Raises: GLib.Error
Returns: whether the file was saved successfully. Return type: bool
Finishes a file saving started with
GtkSource.FileSaver.save_async
().If the file has been saved successfully, the following
GtkSource.File
properties will be updated: the location, the encoding, the newline type and the compression type.Since the 3.20 version,
Gtk.TextBuffer.set_modified
() is called withFalse
if the file has been saved successfully.New in version 3.14.
-
set_compression_type
(compression_type)¶ Parameters: compression_type ( GtkSource.CompressionType
) – the new compression type.Sets the compression type. By default the compression type is taken from the
GtkSource.File
.New in version 3.14.
-
set_encoding
(encoding)¶ Parameters: encoding ( GtkSource.Encoding
orNone
) – the new encoding, orNone
for UTF-8.Sets the encoding. If encoding is
None
, the UTF-8 encoding will be set. By default the encoding is taken from theGtkSource.File
.New in version 3.14.
-
set_flags
(flags)¶ Parameters: flags ( GtkSource.FileSaverFlags
) – the new flags.New in version 3.14.
-
set_newline_type
(newline_type)¶ Parameters: newline_type ( GtkSource.NewlineType
) – the new newline type.Sets the newline type. By default the newline type is taken from the
GtkSource.File
.New in version 3.14.
-
classmethod
Property Details¶
-
GtkSource.FileSaver.props.
buffer
¶ Name: buffer
Type: GtkSource.Buffer
Default Value: None
Flags: READABLE
,WRITABLE
,CONSTRUCT_ONLY
The
GtkSource.Buffer
to save. TheGtkSource.FileSaver
object has a weak reference to the buffer.New in version 3.14.
-
GtkSource.FileSaver.props.
compression_type
¶ Name: compression-type
Type: GtkSource.CompressionType
Default Value: GtkSource.CompressionType.NONE
Flags: READABLE
,WRITABLE
,CONSTRUCT
The compression type.
New in version 3.14.
-
GtkSource.FileSaver.props.
encoding
¶ Name: encoding
Type: GtkSource.Encoding
Default Value: None
Flags: READABLE
,WRITABLE
,CONSTRUCT
The file’s encoding.
New in version 3.14.
-
GtkSource.FileSaver.props.
file
¶ Name: file
Type: GtkSource.File
Default Value: None
Flags: READABLE
,WRITABLE
,CONSTRUCT_ONLY
The
GtkSource.File
. TheGtkSource.FileSaver
object has a weak reference to the file.New in version 3.14.
-
GtkSource.FileSaver.props.
flags
¶ Name: flags
Type: GtkSource.FileSaverFlags
Default Value: GtkSource.FileSaverFlags.NONE
Flags: READABLE
,WRITABLE
,CONSTRUCT
File saving flags.
New in version 3.14.
-
GtkSource.FileSaver.props.
location
¶ Name: location
Type: Gio.File
Default Value: None
Flags: READABLE
,WRITABLE
,CONSTRUCT_ONLY
The
Gio.File
where to save the buffer. By default the location is taken from theGtkSource.File
at construction time.New in version 3.14.
-
GtkSource.FileSaver.props.
newline_type
¶ Name: newline-type
Type: GtkSource.NewlineType
Default Value: GtkSource.NewlineType.LF
Flags: READABLE
,WRITABLE
,CONSTRUCT
The newline type.
New in version 3.14.