GtkCssSection * _gtk_css_section_new (GtkCssSection *parent, GtkCssSectionType type, GtkCssParser *parser, GFile *file) { GtkCssSection *section; g_return_val_if_fail (parser != NULL, NULL); g_return_val_if_fail (file == NULL || G_IS_FILE (file), NULL); section = g_slice_new0 (GtkCssSection); section->ref_count = 1; section->section_type = type; if (parent) section->parent = gtk_css_section_ref (parent); if (file) section->file = g_object_ref (file); section->start_line = _gtk_css_parser_get_line (parser); section->start_position = _gtk_css_parser_get_position (parser); section->parser = parser; return section; }
void _gtk_css_section_end (GtkCssSection *section) { gtk_internal_return_if_fail (section != NULL); gtk_internal_return_if_fail (section->parser != NULL); section->end_line = _gtk_css_parser_get_line (section->parser); section->end_position = _gtk_css_parser_get_position (section->parser); section->parser = NULL; }
/** * gtk_css_section_get_end_line: * @section: the section * * Returns the line in the CSS document where this section end. * The line number is 0-indexed, so the first line of the document * will return 0. * This value may change in future invocations of this function if * @section is not yet parsed completely. This will for example * happen in the GtkCssProvider::parsing-error signal. * The end position and line may be identical to the start * position and line for sections which failed to parse anything * successfully. * * Returns: the line number * * Since: 3.2 **/ guint gtk_css_section_get_end_line (const GtkCssSection *section) { gtk_internal_return_val_if_fail (section != NULL, 0); if (section->parser) return _gtk_css_parser_get_line (section->parser); else return section->end_line; }
GtkCssSection * _gtk_css_section_new (GtkCssSection *parent, GtkCssSectionType type, GtkCssParser *parser) { GtkCssSection *section; gtk_internal_return_val_if_fail (parser != NULL, NULL); section = g_slice_new0 (GtkCssSection); section->ref_count = 1; section->section_type = type; if (parent) section->parent = gtk_css_section_ref (parent); section->file = _gtk_css_parser_get_file (parser); if (section->file) g_object_ref (section->file); section->start_line = _gtk_css_parser_get_line (parser); section->start_position = _gtk_css_parser_get_position (parser); section->parser = parser; return section; }