| Top |
| GtkSourceBuffer * | buffer | Read / Write / Construct Only |
| GtkSourceCompressionType | compression-type | Read / Write / Construct |
| GtkSourceEncoding * | encoding | Read / Write / Construct |
| GtefFile * | file | Read / Write / Construct Only |
| GtefFileSaverFlags | flags | Read / Write / Construct |
| GFile * | location | Read / Write / Construct Only |
| GtkSourceNewlineType | newline-type | Read / Write / Construct |
| GtefFileSaver | |
| #define | GTEF_FILE_SAVER_ERROR |
| enum | GtefFileSaverError |
| enum | GtefFileSaverFlags |
GEnum ╰── GtefFileSaverError GFlags ╰── GtefFileSaverFlags GObject ╰── GtefFileSaver
A GtefFileSaver object permits to save a GtefBuffer into a GFile.
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 gtef_file_saver_save_async().
GtefFileSaver is a non-modified fork of GtkSourceFileSaver. See the description of GtefFile for more background on why a fork was needed.
GtefFileSaver * gtef_file_saver_new (GtefBuffer *buffer,GtefFile *file);
Creates a new GtefFileSaver object. The buffer
will be saved to the
GtefFile's location.
This constructor is suitable for a simple "save" operation, when the file
already contains a non-NULL “location”.
Since: 1.0
GtefFileSaver * gtef_file_saver_new_with_target (GtefBuffer *buffer,GtefFile *file,GFile *target_location);
Creates a new GtefFileSaver object with a target location. When the
file saving is finished successfully, target_location
is set to the file
's
“location” property. If an error occurs, the previous valid
location is still available in GtefFile.
This constructor is suitable for a "save as" operation, or for saving a new buffer for the first time.
buffer |
the GtefBuffer to save. |
|
file |
the GtefFile. |
|
target_location |
the GFile where to save the buffer to. |
Since: 1.0
GtefBuffer *
gtef_file_saver_get_buffer (GtefFileSaver *saver);
Since: 1.0
GFile *
gtef_file_saver_get_location (GtefFileSaver *saver);
Since: 1.0
void gtef_file_saver_set_encoding (GtefFileSaver *saver,const GtkSourceEncoding *encoding);
Sets the encoding. If encoding
is NULL, the UTF-8 encoding will be set.
By default the encoding is taken from the GtefFile.
Since: 1.0
const GtkSourceEncoding *
gtef_file_saver_get_encoding (GtefFileSaver *saver);
Since: 1.0
void gtef_file_saver_set_newline_type (GtefFileSaver *saver,GtkSourceNewlineType newline_type);
Sets the newline type. By default the newline type is taken from the GtefFile.
Since: 1.0
GtkSourceNewlineType
gtef_file_saver_get_newline_type (GtefFileSaver *saver);
Since: 1.0
void gtef_file_saver_set_compression_type (GtefFileSaver *saver,GtkSourceCompressionType compression_type);
Sets the compression type. By default the compression type is taken from the GtefFile.
Since: 1.0
GtkSourceCompressionType
gtef_file_saver_get_compression_type (GtefFileSaver *saver);
Since: 1.0
void gtef_file_saver_set_flags (GtefFileSaver *saver,GtefFileSaverFlags flags);
Since: 1.0
GtefFileSaverFlags
gtef_file_saver_get_flags (GtefFileSaver *saver);
Since: 1.0
void gtef_file_saver_save_async (GtefFileSaver *saver,gint io_priority,GCancellable *cancellable,GFileProgressCallback progress_callback,gpointer progress_callback_data,GDestroyNotify progress_callback_notify,GAsyncReadyCallback callback,gpointer user_data);
Saves asynchronously the buffer into the file. See the GAsyncResult documentation to know how to use this function.
saver |
||
io_priority |
the I/O priority of the request. E.g. |
|
cancellable |
optional GCancellable object, |
[nullable] |
progress_callback |
function to call back with
progress information, or |
[scope notified][nullable] |
progress_callback_data |
user data to pass to |
[closure] |
progress_callback_notify |
function to call on
|
[nullable] |
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
[scope async] |
user_data |
user data to pass to |
Since: 1.0
gboolean gtef_file_saver_save_finish (GtefFileSaver *saver,GAsyncResult *result,GError **error);
Finishes a file saving started with gtef_file_saver_save_async().
If the file has been saved successfully, the following GtefFile properties will be updated: the location, the encoding, the newline type and the compression type.
gtk_text_buffer_set_modified() is called with FALSE if the file has been
saved successfully.
Since: 1.0
An error code used with the GTEF_FILE_SAVER_ERROR domain.
Since: 1.0
“buffer” property“buffer” GtkSourceBuffer *
The GtefBuffer to save. The GtefFileSaver object has a weak reference to the buffer.
Flags: Read / Write / Construct Only
Since: 1.0
“compression-type” property“compression-type” GtkSourceCompressionType
The compression type.
Flags: Read / Write / Construct
Default value: GTK_SOURCE_COMPRESSION_TYPE_NONE
Since: 1.0
“encoding” property“encoding” GtkSourceEncoding *
The file's encoding.
Flags: Read / Write / Construct
Since: 1.0
“file” property“file” GtefFile *
The GtefFile. The GtefFileSaver object has a weak reference to the file.
Flags: Read / Write / Construct Only
Since: 1.0
“flags” property“flags” GtefFileSaverFlags
File saving flags.
Flags: Read / Write / Construct
Since: 1.0
“location” property“location” GFile *
The GFile where to save the buffer. By default the location is taken from the GtefFile at construction time.
Flags: Read / Write / Construct Only
Since: 1.0
“newline-type” property“newline-type” GtkSourceNewlineType
The newline type.
Flags: Read / Write / Construct
Default value: GTK_SOURCE_NEWLINE_TYPE_LF
Since: 1.0