summaryrefslogtreecommitdiff
path: root/testsuite/gsk/node-parser.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-11-16 22:21:27 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-11-16 23:27:44 -0500
commit121e61cf01e70d0791e3b661dca57de19ed94ef9 (patch)
tree5f3644b7beff891cc1346fac4756e952b6f7a0b4 /testsuite/gsk/node-parser.c
parent2c9bf55eea71f1de0ee9dc93f030a4fd78200cc8 (diff)
downloadgtk+-gsk-binding-api.tar.gz
gsk: Avoid using gtk css types in public apigsk-binding-api
Using GtkCssSection in public headers here may be ok from the C perspective, since it all ends up in the same library anyway. But it causes circular dependency problems for our gir files that are still split by namespace. To avoid this problem, copy the GtkCssLocation struct struct as GskParseLocation, and pass take two of them instead of a GtkCssSection in the error callback. Update all users. Fixes: #2454
Diffstat (limited to 'testsuite/gsk/node-parser.c')
-rw-r--r--testsuite/gsk/node-parser.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/testsuite/gsk/node-parser.c b/testsuite/gsk/node-parser.c
index cd3c930461..e7cf97887e 100644
--- a/testsuite/gsk/node-parser.c
+++ b/testsuite/gsk/node-parser.c
@@ -122,19 +122,26 @@ append_error_value (GString *string,
}
static void
-deserialize_error_func (const GtkCssSection *section,
- const GError *error,
- gpointer user_data)
+deserialize_error_func (const GskParseLocation *start,
+ const GskParseLocation *end,
+ const GError *error,
+ gpointer user_data)
{
GString *errors = user_data;
- char *section_string;
+ GString *string = g_string_new ("<data>");
- section_string = gtk_css_section_to_string (section);
+ g_string_append_printf (string, ":%zu:%zu",
+ start->lines + 1, start->line_chars + 1);
+ if (start->lines != end->lines || start->line_chars != end->line_chars)
+ {
+ g_string_append (string, "-");
+ if (start->lines != end->lines)
+ g_string_append_printf (string, "%zu:", end->lines + 1);
+ g_string_append_printf (string, "%zu", end->line_chars + 1);
+ }
- g_string_append_printf (errors,
- "%s: error: ",
- section_string);
- g_free (section_string);
+ g_string_append_printf (errors, "%s: error: ", string->str);
+ g_string_free (string, TRUE);
if (error->domain == GTK_CSS_PARSER_ERROR)
append_error_value (errors, GTK_TYPE_CSS_PARSER_ERROR, error->code);