gtksource.file_loader

Module for [FileLoader] class

Types 3

Load a file into a GtkSourceBuffer.

A gtksource.file_loader.FileLoader object permits to load the contents of a gio.file.File or a gio.input_stream.InputStream into a gtksource.buffer.Buffer.

A file loader should be used only for one load operation, including errors handling. If an error occurs, you can reconfigure the loader and relaunch the operation with gtksource.file_loader.FileLoader.loadAsync.

Running a gtksource.file_loader.FileLoader is an undoable action for the gtksource.buffer.Buffer.

After a file loading, the buffer is reset to the contents provided by the gio.file.File or gio.input_stream.InputStream, so the buffer is set as “unmodified”, that is, gtk.text_buffer.TextBuffer.setModified is called with false. If the contents isn't saved somewhere (for example if you load from stdin), then you should probably call gtk.text_buffer.TextBuffer.setModified with true after calling gtksource.file_loader.FileLoader.loadFinish.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
FileLoader self() nothrowReturns `this`, for use in `with` statements.
FileLoaderGidBuilder builder() static nothrowGet builder for [gtksource.file_loader.FileLoader] Returns: New builder object
gtksource.buffer.Buffer buffer() @property nothrowGet `buffer` property. Returns: The #GtkSourceBuffer to load the contents into. The #GtkSourceFileLoader object has a weak reference to the buffer.
gtksource.file.File file() @property nothrowGet `file` property. Returns: The #GtkSourceFile. The #GtkSourceFileLoader object has a weak reference to the file.
gio.input_stream.InputStream inputStream() @property nothrowGet `inputStream` property. Returns: The #GInputStream to load. Useful for reading stdin. If this property is set, the #GtkSourceFileLoader:location property is ignored.
gio.file.File location() @property nothrowGet `location` property. Returns: The #GFile to load. If the #GtkSourceFileLoader:input-stream is null, by default the location is taken from the #GtkSourceFile at construction time.
gtksource.file_loader.FileLoader newFromStream(gtksource.buffer.Buffer buffer, gtksource.file.File file, gio.input_stream.InputStream stream) static nothrowCreates a new #GtkSourceFileLoader object. The contents is read from stream.
void loadAsync(int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.FileProgressCallback progressCallback = null, gio.types.AsyncReadyCallback callback = null) nothrowLoads asynchronously the file or input stream contents into the [gtksource.buffer.Buffer].
bool loadFinish(gio.async_result.AsyncResult result)Finishes a file loading started with [gtksource.file_loader.FileLoader.loadAsync].
void setCandidateEncodings(gtksource.encoding.Encoding[] candidateEncodings) nothrowSets the candidate encodings for the file loading.
Constructors
this(void * ptr, Flag!"Take" take)
this(gtksource.buffer.Buffer buffer, gtksource.file.File file)Creates a new [gtksource.file_loader.FileLoader] object. The contents is read from the [gtksource.file.File]'s location.

Fluent builder implementation template for gtksource.file_loader.FileLoader

Methods
T buffer(gtksource.buffer.Buffer propval) nothrowSet `buffer` property. Params: propval = The #GtkSourceBuffer to load the contents into. The #GtkSourceFileLoader object has a weak reference to the buffer. Returns: Builder instance for fluent cha...
T file(gtksource.file.File propval) nothrowSet `file` property. Params: propval = The #GtkSourceFile. The #GtkSourceFileLoader object has a weak reference to the file. Returns: Builder instance for fluent chaining
T inputStream(gio.input_stream.InputStream propval) nothrowSet `inputStream` property. Params: propval = The #GInputStream to load. Useful for reading stdin. If this property is set, the #GtkSourceFileLoader:location property is ignored. Returns: Builder i...
T location(gio.file.File propval) nothrowSet `location` property. Params: propval = The #GFile to load. If the #GtkSourceFileLoader:input-stream is null, by default the location is taken from the #GtkSourceFile at construction time. Retur...
Methods
FileLoader build() nothrowCreate object from builder. Returns: New object