Class: GtkSource::FileLoader

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Constructor Details

#initialize(buffer, file, stream) ⇒ GtkSource::FileLoader

Creates a new Gtk::SourceFileLoader object. The contents is read from stream.

Parameters:

  • buffer (GtkSource::Buffer)

    the Gtk::SourceBuffer to load the contents into.

  • file (GtkSource::File)

    the Gtk::SourceFile.

  • stream (Gio::InputStream)

    the GInput::Stream to load, e.g. stdin.

Instance Method Details

#bufferGtkSource::Buffer

The Gtk::SourceBuffer to load the contents into. The Gtk::SourceFileLoader object has a weak reference to the buffer.

Returns:

#buffer=(buffer) ⇒ GtkSource::Buffer

The Gtk::SourceBuffer to load the contents into. The Gtk::SourceFileLoader object has a weak reference to the buffer.

Parameters:

Returns:

#candidate_encodings=(candidate_encodings) ⇒ nil

Sets the candidate encodings for the file loading.

The encodings are tried in the same order as the list.

For convenience, candidate_encodings can contain duplicates. Only the first occurrence of a duplicated encoding is kept in the list.

By default the candidate encodings are (in that order in the list):

  1. If set, the [classFile]'s encoding as returned by [methodFile.get_encoding].
  2. The default candidates as returned by [funcEncoding.get_default_candidates].

Parameters:

  • candidate_encodings (GLib::SList<GtkSource::Encoding>)

    a list of Gtk::SourceEncodings.

Returns:

  • (nil)

#compression_typeGtkSource::CompressionType

Returns the detected compression type.

Returns:

#encodingGtkSource::Encoding

Returns the detected file encoding.

Returns:

  • (GtkSource::Encoding)

    the detected file encoding.

#fileGtkSource::File

The Gtk::SourceFile. The #GtkSourceFileLoader object has a weak reference to the file.

Returns:

#file=(file) ⇒ GtkSource::File

The Gtk::SourceFile. The #GtkSourceFileLoader object has a weak reference to the file.

Parameters:

Returns:

#input_streamGio::InputStream

The GInput::Stream to load. Useful for reading stdin. If this property is set, the Gtk::SourceFileLoader:location property is ignored.

Returns:

  • (Gio::InputStream)

    input-stream

#input_stream=(input_stream) ⇒ Gio::InputStream

The GInput::Stream to load. Useful for reading stdin. If this property is set, the Gtk::SourceFileLoader:location property is ignored.

Parameters:

  • input_stream (Gio::InputStream)

Returns:

  • (Gio::InputStream)

    input-stream

  • (Gio::InputStream)

    input-stream

#load_async(io_priority, cancellable, progress_callback, progress_callback_data, progress_callback_notify, callback, user_data) ⇒ nil

Loads asynchronously the file or input stream contents into the [classBuffer].

See the [ifaceGio.AsyncResult] documentation to know how to use this function.

Parameters:

  • io_priority (Integer)

    the I/O priority of the request. E.g. %G_PRIORITY_LOW, %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH.

  • cancellable (Gio::Cancellable)

    optional #GCancellable object, nil to ignore.

  • progress_callback (Gio::FileProgressCallback)

    function to call back with progress information, or nil if progress information is not needed.

  • progress_callback_data (GObject)

    user data to pass to progress_callback.

  • progress_callback_notify (GLib::DestroyNotify)

    function to call on progress_callback_data when the progress_callback is no longer needed, or nil.

  • callback (Gio::AsyncReadyCallback)

    a GAsync::ReadyCallback to call when the request is satisfied.

  • user_data (GObject)

    user data to pass to callback.

Returns:

  • (nil)

#load_finish(result) ⇒ Boolean

Finishes a file loading started with [methodFileLoader.load_async].

If the contents has been loaded, the following [classFile] properties will be updated: the location, the encoding, the newline type and the compression type.

Parameters:

  • result (Gio::AsyncResult)

    a GAsync::Result.

Returns:

  • (Boolean)

    whether the contents has been loaded successfully.

#locationGio::File

The #GFile to load. If the Gtk::SourceFileLoader:input-stream is nil, by default the location is taken from the Gtk::SourceFile at construction time.

Returns:

  • (Gio::File)

    location

#location=(location) ⇒ Gio::File

The #GFile to load. If the Gtk::SourceFileLoader:input-stream is nil, by default the location is taken from the Gtk::SourceFile at construction time.

Parameters:

  • location (Gio::File)

Returns:

  • (Gio::File)

    location

  • (Gio::File)

    location

#newline_typeGtkSource::NewlineType

Returns the detected newline type.

Returns: