Example #1
0
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;
}
Example #2
0
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;
}
Example #3
0
/**
 * gtk_css_section_get_end_position:
 * @section: the section
 *
 * Returns the offset in bytes from the start of the current line
 * returned via gtk_css_section_get_end_line().
 * 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 offset in bytes from the start of the line.
 *
 * Since: 3.2
 **/
guint
gtk_css_section_get_end_position (const GtkCssSection *section)
{
  gtk_internal_return_val_if_fail (section != NULL, 0);

  if (section->parser)
    return _gtk_css_parser_get_position (section->parser);
  else
    return section->end_position;
}
Example #4
0
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;
}