| Top |  |  |  |  | 
Basic file loader that validates input for GtkTextView purposes:
Must not exceed a certain size (because all the content of a GtkTextBuffer is stored in memory).
Must be valid UTF-8 already (GTK in general accepts only UTF-8 only strings).
Must not contain very long lines (not well supported by the GtkTextView widget, there can be performance problems and freezes).
So:
No character encoding auto-detection and/or conversion.
No workarounds for problems found, just return an error without the possibility to re-configure the loading.
But this basic file loader offers a convenient API for the above: GFile loading with the intention to put its content into a GtkTextBuffer.
void gfls_loader_basic_load_async (GFile *file,gsize max_size,guint max_n_bytes_per_line,gint io_priority,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data);
Starts a basic file loading operation.
If the file
 content is not a valid UTF-8 string, or if the max_size
 or
max_n_bytes_per_line
 conditions are not satisfied, an error will be returned
without the file content.
See the GAsyncResult documentation to know how to use this function.
| file | a GFile. | |
| max_size | the maximum allowed number of bytes in total. | |
| max_n_bytes_per_line | the maximum allowed number of bytes per line, as per
 | |
| io_priority | the I/O priority of the request. E.g.  | |
| cancellable | optional GCancellable object,  | [nullable] | 
| callback | a GAsyncReadyCallback to call when the operation is finished. | [scope async] | 
| user_data | user data to pass to  | 
Since: 0.1
GBytes * gfls_loader_basic_load_finish (GFile *file,GAsyncResult *result,GError **error);
Finishes an operation started with gfls_loader_basic_load_async().
If everything went well, a GBytes with the GFile content (unmodified) is returned. It is guaranteed to be a valid UTF-8 string.
Otherwise an error is returned. The GFLS_LOADER_ERROR domain is used, among
others.
The data contained in the resulting GBytes is always zero-terminated, but
this is not included in the GBytes length. The resulting GBytes should be
freed with g_bytes_unref() when no longer in use.
Since: 0.1