FileLoader

open class FileLoader(pointer: <Error class: unknown class><<Error class: unknown class>>)

Load a file into a GtkSourceBuffer.

A GtkSourceFileLoader object permits to load the contents of a iface@Gio.File or a class@Gio.InputStream into a class@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 method@FileLoader.load_async.

Running a GtkSourceFileLoader is an undoable action for the class@Buffer.

After a file loading, the buffer is reset to the contents provided by the iface@Gio.File or class@Gio.InputStream, so the buffer is set as “unmodified”, that is, method@Gtk.TextBuffer.set_modified is called with false. If the contents isn't saved somewhere (for example if you load from stdin), then you should probably call method@Gtk.TextBuffer.set_modified with true after calling method@FileLoader.load_finish.

Skipped during bindings generation

  • parameter callback: Gio.AsyncReadyCallback

Constructors

Link copied to clipboard
constructor(buffer: Buffer, file: File)

Creates a new GtkSourceFileLoader object. The contents is read from the class@File's location.

constructor(buffer: Buffer, file: File, stream: <Error class: unknown class>)

Creates a new #GtkSourceFileLoader object. The contents is read from @stream.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val buffer: Buffer

The #GtkSourceBuffer to load the contents into. The #GtkSourceFileLoader object has a weak reference to the buffer.

Link copied to clipboard
open val file: File

The #GtkSourceFile. The #GtkSourceFileLoader object has a weak reference to the file.

Link copied to clipboard
val gtksourceFileLoaderPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val inputStream: <Error class: unknown class>?

The #GInputStream to load. Useful for reading stdin. If this property is set, the #GtkSourceFileLoader:location property is ignored.

Link copied to clipboard
open val location: <Error class: unknown class>?

The #GFile to load. If the #GtkSourceFileLoader:input-stream is null, by default the location is taken from the #GtkSourceFile at construction time.

Functions

Link copied to clipboard
open fun getBuffer(): Buffer
Link copied to clipboard
Link copied to clipboard
open fun getEncoding(): Encoding
Link copied to clipboard
open fun getFile(): File
Link copied to clipboard
open fun getInputStream(): <Error class: unknown class>?
Link copied to clipboard
open fun getLocation(): <Error class: unknown class>?
Link copied to clipboard
Link copied to clipboard
open fun loadFinish(result: <Error class: unknown class>): <Error class: unknown class><Boolean>

Finishes a file loading started with method@FileLoader.load_async.

Link copied to clipboard
open fun setCandidateEncodings(candidateEncodings: <Error class: unknown class>)

Sets the candidate encodings for the file loading.