diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-11-16 22:21:27 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-11-16 23:27:44 -0500 |
commit | 121e61cf01e70d0791e3b661dca57de19ed94ef9 (patch) | |
tree | 5f3644b7beff891cc1346fac4756e952b6f7a0b4 /tests | |
parent | 2c9bf55eea71f1de0ee9dc93f030a4fd78200cc8 (diff) | |
download | gtk+-121e61cf01e70d0791e3b661dca57de19ed94ef9.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 'tests')
-rw-r--r-- | tests/rendernode.c | 23 | ||||
-rw-r--r-- | tests/showrendernode.c | 23 |
2 files changed, 34 insertions, 12 deletions
diff --git a/tests/rendernode.c b/tests/rendernode.c index 786cc6d050..d0e3230663 100644 --- a/tests/rendernode.c +++ b/tests/rendernode.c @@ -14,15 +14,26 @@ static GOptionEntry options[] = { }; 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) { - char *section_str = gtk_css_section_to_string (section); + GString *string = g_string_new ("<data>"); - g_warning ("Error at %s: %s", section_str, error->message); + 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_warning ("Error at %s: %s", string->str, error->message); - g_free (section_str); + g_string_free (string, TRUE); } diff --git a/tests/showrendernode.c b/tests/showrendernode.c index 92bc6d40eb..5fafd3c00e 100644 --- a/tests/showrendernode.c +++ b/tests/showrendernode.c @@ -102,15 +102,26 @@ gtk_node_view_class_init (GtkNodeViewClass *klass) } 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) { - char *section_str = gtk_css_section_to_string (section); + GString *string = g_string_new ("<data>"); - g_warning ("Error at %s: %s", section_str, error->message); + 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_warning ("Error at %s: %s", string->str, error->message); - g_free (section_str); + g_string_free (string, TRUE); } static void |