Gtk.CssSection

Fields

None

Methods

class

new (file, start, end)

get_end_location ()

get_file ()

get_parent ()

get_start_location ()

print_ (string)

ref ()

to_string ()

unref ()

Details

class Gtk.CssSection

Defines a part of a CSS document.

Because sections are nested into one another, you can use [method`CssSection`.get_parent] to get the containing region.

classmethod new(file, start, end)[source]
Parameters:
Returns:

a new GtkCssSection

Return type:

Gtk.CssSection

Creates a new GtkCssSection referring to the section in the given file from the start location to the end location.

get_end_location()[source]
Returns:

The end location of this section

Return type:

Gtk.CssLocation

Returns the location in the CSS document where this section ends.

get_file()[source]
Returns:

the GFile from which the section was parsed

Return type:

Gio.File or None

Gets the file that self was parsed from.

If no such file exists, for example because the CSS was loaded via [method`Gtk`.CssProvider.load_from_data], then NULL is returned.

get_parent()[source]
Returns:

the parent section

Return type:

Gtk.CssSection or None

Gets the parent section for the given section.

The parent section is the section that contains this section. A special case are sections of type GTK_CSS_SECTION_DOCUMEN``T. Their parent will either be ``NULL if they are the original CSS document that was loaded by [method`Gtk`.CssProvider.load_from_file] or a section of type GTK_CSS_SECTION_IMPORT if it was loaded with an @import rule from a different file.

get_start_location()[source]
Returns:

The start location of this section

Return type:

Gtk.CssLocation

Returns the location in the CSS document where this section starts.

print_(string)[source]
Parameters:

string (GLib.String) – a GString to print to

Prints the section into string in a human-readable form.

This is a form like gtk.css:32:1-23 to denote line 32, characters 1 to 23 in the file gtk.css.

ref()[source]
Returns:

the CSS section itself.

Return type:

Gtk.CssSection

Increments the reference count on section.

to_string()[source]
Returns:

A new string.

Return type:

str

Prints the section into a human-readable text form using [method`Gtk`.CssSection.print].

unref()[source]

Decrements the reference count on section, freeing the structure if the reference count reaches 0.