GtkSource.FileLoader¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | new(buffer, file) | 
| class | new_from_stream(buffer, file, stream) | 
| get_buffer() | |
| get_compression_type() | |
| get_encoding() | |
| get_file() | |
| get_input_stream() | |
| get_location() | |
| get_newline_type() | |
| load_async(io_priority, cancellable, progress_callback, progress_callback_data, callback, *user_data) | |
| load_finish(result) | |
| set_candidate_encodings(candidate_encodings) | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
Properties¶
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| buffer | GtkSource.Buffer | r/w/co | |
| file | GtkSource.File | r/w/co | |
| input-stream | Gio.InputStream | r/w/co | |
| location | Gio.File | r/w/co | 
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class GtkSource.FileLoader(**kwargs)¶
- Bases: - GObject.Object- Abstract: - No - Structure: - GtkSource.FileLoaderClass- 
classmethod new(buffer, file)¶
- Parameters: - buffer (GtkSource.Buffer) – theGtkSource.Bufferto load the contents into.
- file (GtkSource.File) – theGtkSource.File.
 - Returns: - a new - GtkSource.FileLoaderobject.- Return type: - Creates a new - GtkSource.FileLoaderobject. The contents is read from the- GtkSource.File’s location. If not already done, call- GtkSource.File.set_location() before calling this constructor. The previous location is anyway not needed, because as soon as the file loading begins, the buffer is emptied.- New in version 3.14. 
- buffer (
 - 
classmethod new_from_stream(buffer, file, stream)¶
- Parameters: - buffer (GtkSource.Buffer) – theGtkSource.Bufferto load the contents into.
- file (GtkSource.File) – theGtkSource.File.
- stream (Gio.InputStream) – theGio.InputStreamto load, e.g. stdin.
 - Returns: - a new - GtkSource.FileLoaderobject.- Return type: - Creates a new - GtkSource.FileLoaderobject. The contents is read from stream.- New in version 3.14. 
- buffer (
 - 
get_buffer()¶
- Returns: - the - GtkSource.Bufferto load the contents into.- Return type: - GtkSource.Buffer- New in version 3.14. 
 - 
get_compression_type()¶
- Returns: - the detected compression type. - Return type: - GtkSource.CompressionType- New in version 3.14. 
 - 
get_encoding()¶
- Returns: - the detected file encoding. - Return type: - GtkSource.Encoding- New in version 3.14. 
 - 
get_file()¶
- Returns: - the - GtkSource.File.- Return type: - GtkSource.File- New in version 3.14. 
 - 
get_input_stream()¶
- Returns: - the - Gio.InputStreamto load, or- Noneif a- Gio.Fileis used.- Return type: - Gio.InputStreamor- None- New in version 3.14. 
 - 
get_location()¶
- Returns: - the - Gio.Fileto load, or- Noneif an input stream is used.- Return type: - Gio.Fileor- None- New in version 3.14. 
 - 
get_newline_type()¶
- Returns: - the detected newline type. - Return type: - GtkSource.NewlineType- New in version 3.14. 
 - 
load_async(io_priority, cancellable, progress_callback, progress_callback_data, callback, *user_data)¶
- Parameters: - io_priority (int) – the I/O priority of the request. E.g.GLib.PRIORITY_LOW,GLib.PRIORITY_DEFAULTorGLib.PRIORITY_HIGH.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore.
- progress_callback (Gio.FileProgressCallbackorNone) – function to call back with progress information, orNoneif progress information is not needed.
- progress_callback_data (objectorNone) – user data to pass to progress_callback.
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied.
- user_data (objectorNone) – user data to pass to callback.
 - Loads asynchronously the file or input stream contents into the - GtkSource.Buffer. See the- Gio.AsyncResultdocumentation to know how to use this function.- New in version 3.14. 
- io_priority (
 - 
load_finish(result)¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult.- Raises: - GLib.Error- Returns: - whether the contents has been loaded successfully. - Return type: - bool- Finishes a file loading started with - GtkSource.FileLoader.load_async().- If the contents has been loaded, the following - GtkSource.Fileproperties will be updated: the location, the encoding, the newline type and the compression type.- New in version 3.14. 
 - 
set_candidate_encodings(candidate_encodings)¶
- Parameters: - candidate_encodings ([ - GtkSource.Encoding]) – a list of- GtkSource.Encodings.- 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): - If set, the - GtkSource.File’s encoding as returned by- GtkSource.File.get_encoding().- The default candidates as returned by - GtkSource.Encoding.get_default_candidates().- New in version 3.14. 
 
- 
classmethod 
Property Details¶
- 
GtkSource.FileLoader.props.buffer¶
- Name: - buffer- Type: - GtkSource.Buffer- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The - GtkSource.Bufferto load the contents into. The- GtkSource.FileLoaderobject has a weak reference to the buffer.- New in version 3.14. 
- 
GtkSource.FileLoader.props.file¶
- Name: - file- Type: - GtkSource.File- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The - GtkSource.File. The- GtkSource.FileLoaderobject has a weak reference to the file.- New in version 3.14. 
- 
GtkSource.FileLoader.props.input_stream¶
- Name: - input-stream- Type: - Gio.InputStream- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The - Gio.InputStreamto load. Useful for reading stdin. If this property is set, the- GtkSource.FileLoader- :locationproperty is ignored.- New in version 3.14. 
- 
GtkSource.FileLoader.props.location¶
- Name: - location- Type: - Gio.File- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The - Gio.Fileto load. If the- GtkSource.FileLoader- :input-streamis- None, by default the location is taken from the- GtkSource.Fileat construction time.- New in version 3.14.