mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
css parser: Add bytes to sections
We will use this later to link sections back to the providers they come from.
This commit is contained in:
parent
7eca32edf0
commit
f2ef5d85ea
@ -26,6 +26,7 @@ struct _GtkCssSection
|
||||
int ref_count;
|
||||
GtkCssSection *parent;
|
||||
GFile *file;
|
||||
GBytes *bytes;
|
||||
GtkCssLocation start_location;
|
||||
GtkCssLocation end_location; /* end location if parser is %NULL */
|
||||
};
|
||||
@ -48,6 +49,15 @@ GtkCssSection *
|
||||
gtk_css_section_new (GFile *file,
|
||||
const GtkCssLocation *start,
|
||||
const GtkCssLocation *end)
|
||||
{
|
||||
return gtk_css_section_new_with_bytes (file, NULL,start, end);
|
||||
}
|
||||
|
||||
GtkCssSection *
|
||||
gtk_css_section_new_with_bytes (GFile *file,
|
||||
GBytes *bytes,
|
||||
const GtkCssLocation *start,
|
||||
const GtkCssLocation *end)
|
||||
{
|
||||
GtkCssSection *result;
|
||||
|
||||
@ -60,6 +70,8 @@ gtk_css_section_new (GFile *file,
|
||||
result->ref_count = 1;
|
||||
if (file)
|
||||
result->file = g_object_ref (file);
|
||||
if (bytes)
|
||||
result->bytes = g_bytes_ref (bytes);
|
||||
result->start_location = *start;
|
||||
result->end_location = *end;
|
||||
|
||||
@ -104,6 +116,8 @@ gtk_css_section_unref (GtkCssSection *section)
|
||||
gtk_css_section_unref (section->parent);
|
||||
if (section->file)
|
||||
g_object_unref (section->file);
|
||||
if (section->bytes)
|
||||
g_bytes_unref (section->bytes);
|
||||
|
||||
g_free (section);
|
||||
}
|
||||
@ -151,6 +165,14 @@ gtk_css_section_get_file (const GtkCssSection *section)
|
||||
return section->file;
|
||||
}
|
||||
|
||||
GBytes *
|
||||
gtk_css_section_get_bytes (const GtkCssSection *section)
|
||||
{
|
||||
g_return_val_if_fail (section != NULL, NULL);
|
||||
|
||||
return section->bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_css_section_get_start_location:
|
||||
* @section: the section
|
||||
|
@ -46,6 +46,11 @@ GDK_AVAILABLE_IN_ALL
|
||||
GtkCssSection * gtk_css_section_new (GFile *file,
|
||||
const GtkCssLocation *start,
|
||||
const GtkCssLocation *end);
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GtkCssSection * gtk_css_section_new_with_bytes (GFile *file,
|
||||
GBytes *bytes,
|
||||
const GtkCssLocation *start,
|
||||
const GtkCssLocation *end);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkCssSection * gtk_css_section_ref (GtkCssSection *section);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@ -61,6 +66,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
GtkCssSection * gtk_css_section_get_parent (const GtkCssSection *section);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GFile * gtk_css_section_get_file (const GtkCssSection *section);
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GBytes * gtk_css_section_get_bytes (const GtkCssSection *section);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const GtkCssLocation *
|
||||
gtk_css_section_get_start_location (const GtkCssSection *section);
|
||||
|
Loading…
Reference in New Issue
Block a user