GtkSource.File

g GObject.Object GObject.Object GtkSource.File GtkSource.File GObject.Object->GtkSource.File

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

check_file_on_disk ()

get_compression_type ()

get_encoding ()

get_location ()

get_newline_type ()

is_deleted ()

is_externally_modified ()

is_local ()

is_readonly ()

set_location (location)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

compression-type

GtkSource.CompressionType

r

encoding

GtkSource.Encoding

r

location

Gio.File

r/w/c

newline-type

GtkSource.NewlineType

r

read-only

bool

r

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class GtkSource.File(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GtkSource.FileClass

classmethod new()
Returns:

a new GtkSource.File object.

Return type:

GtkSource.File

Added in version 3.14.

check_file_on_disk()

Checks synchronously the file on disk, to know whether the file is externally modified, or has been deleted, and whether the file is read-only.

GtkSource.File doesn’t create a Gio.FileMonitor to track those properties, so this function needs to be called instead. Creating lots of Gio.FileMonitor's would take lots of resources.

Since this function is synchronous, it is advised to call it only on local files. See GtkSource.File.is_local().

Added in version 3.18.

get_compression_type()
Returns:

the compression type.

Return type:

GtkSource.CompressionType

Added in version 3.14.

get_encoding()
Returns:

the character encoding.

Return type:

GtkSource.Encoding

The encoding is initially None. After a successful file loading or saving operation, the encoding is non-None.

Added in version 3.14.

get_location()
Returns:

the Gio.File.

Return type:

Gio.File

Added in version 3.14.

get_newline_type()
Returns:

the newline type.

Return type:

GtkSource.NewlineType

Added in version 3.14.

is_deleted()
Returns:

whether the file has been deleted.

Return type:

bool

Returns whether the file has been deleted. If the GtkSource.File :location is None, returns False.

To have an up-to-date value, you must first call GtkSource.File.check_file_on_disk().

Added in version 3.18.

is_externally_modified()
Returns:

whether the file is externally modified.

Return type:

bool

Returns whether the file is externally modified. If the GtkSource.File :location is None, returns False.

To have an up-to-date value, you must first call GtkSource.File.check_file_on_disk().

Added in version 3.18.

is_local()
Returns:

whether the file is local.

Return type:

bool

Returns whether the file is local. If the GtkSource.File :location is None, returns False.

Added in version 3.18.

is_readonly()
Returns:

whether the file is read-only.

Return type:

bool

Returns whether the file is read-only. If the GtkSource.File :location is None, returns False.

To have an up-to-date value, you must first call GtkSource.File.check_file_on_disk().

Added in version 3.18.

set_location(location)
Parameters:

location (Gio.File or None) – the new Gio.File, or None.

Sets the location.

Added in version 3.14.

Property Details

GtkSource.File.props.compression_type
Name:

compression-type

Type:

GtkSource.CompressionType

Default Value:

GtkSource.CompressionType.NONE

Flags:

READABLE

The compression type.

Added in version 3.14.

GtkSource.File.props.encoding
Name:

encoding

Type:

GtkSource.Encoding

Default Value:

None

Flags:

READABLE

The character encoding, initially None. After a successful file loading or saving operation, the encoding is non-None.

Added in version 3.14.

GtkSource.File.props.location
Name:

location

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

The location.

Added in version 3.14.

GtkSource.File.props.newline_type
Name:

newline-type

Type:

GtkSource.NewlineType

Default Value:

GtkSource.NewlineType.LF

Flags:

READABLE

The line ending type.

Added in version 3.14.

GtkSource.File.props.read_only
Name:

read-only

Type:

bool

Default Value:

False

Flags:

READABLE

Whether the file is read-only or not. The value of this property is not updated automatically (there is no file monitors).

Added in version 3.18.