GtkSource.Language

g GObject.Object GObject.Object GtkSource.Language GtkSource.Language GObject.Object->GtkSource.Language

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_globs ()

get_hidden ()

get_id ()

get_metadata (name)

get_mime_types ()

get_name ()

get_section ()

get_style_fallback (style_id)

get_style_ids ()

get_style_name (style_id)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

hidden

bool

r

Whether the language should be hidden from the user

id

str

r

Language id

name

str

r

Language name

section

str

r

Language section

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class GtkSource.Language(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GtkSource.LanguageClass

Represents a syntax highlighted language.

A GtkSourceLanguage represents a programming or markup language, affecting syntax highlighting and context classes.

Use [class`LanguageManager`] to obtain a GtkSourceLanguage instance, and [method`Buffer`.set_language] to apply it to a [class`Buffer`].

get_globs()
Returns:

a newly-allocated None terminated array containing the globs or None if no globs are found. The returned array must be freed with GLib.strfreev().

Return type:

[str] or None

Returns the globs associated to this language.

This is just an utility wrapper around [method`Language`.get_metadata] to retrieve the “globs” metadata property and split it into an array.

get_hidden()
Returns:

True if the language should be hidden, False otherwise.

Return type:

bool

Returns whether the language should be hidden from the user.

get_id()
Returns:

the ID of self.

Return type:

str

Returns the ID of the language.

The ID is not locale-dependent.The returned string is owned by self and should not be freed or modified.

get_metadata(name)
Parameters:

name (str) – metadata property name.

Returns:

value of property name stored in the metadata of self or None if language does not contain the specified metadata property. The returned string is owned by self and should not be freed or modified.

Return type:

str or None

get_mime_types()
Returns:

a newly-allocated None terminated array containing the mime types or None if no mime types are found. The returned array must be freed with GLib.strfreev().

Return type:

[str] or None

Returns the mime types associated to this language.

This is just an utility wrapper around [method`Language`.get_metadata] to retrieve the “mimetypes” metadata property and split it into an array.

get_name()
Returns:

the name of self.

Return type:

str

Returns the localized name of the language.

The returned string is owned by self and should not be freed or modified.

get_section()
Returns:

the section of self.

Return type:

str

Returns the localized section of the language.

Each language belong to a section (ex. HTML belongs to the Markup section). The returned string is owned by self and should not be freed or modified.

get_style_fallback(style_id)
Parameters:

style_id (str) – a style ID.

Returns:

the ID of the style to use if the specified style_id is not present in the current style scheme or None if the style has no fallback defined. The returned string is owned by the self and must not be modified.

Return type:

str or None

Returns the ID of the style to use if the specified style_id is not present in the current style scheme.

get_style_ids()
Returns:

a newly-allocated None terminated array containing ids of the styles defined by this self or None if no style is defined. The returned array must be freed with GLib.strfreev().

Return type:

[str] or None

Returns the ids of the styles defined by this self.

get_style_name(style_id)
Parameters:

style_id (str) – a style ID.

Returns:

the name of the style with ID style_id defined by this self or None if the style has no name or there is no style with ID style_id defined by this self. The returned string is owned by the self and must not be modified.

Return type:

str or None

Returns the name of the style with ID style_id defined by this self.

Property Details

GtkSource.Language.props.hidden
Name:

hidden

Type:

bool

Default Value:

False

Flags:

READABLE

Whether the language should be hidden from the user

GtkSource.Language.props.id
Name:

id

Type:

str

Default Value:

None

Flags:

READABLE

Language id

GtkSource.Language.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE

Language name

GtkSource.Language.props.section
Name:

section

Type:

str

Default Value:

None

Flags:

READABLE

Language section