static void show_parsing_error (GtkCssProvider *provider, GtkCssSection *section, const GError *error, GtkTextBuffer *buffer) { GtkTextIter start, end; const char *tag_name; gtk_text_buffer_get_iter_at_line_index (buffer, &start, gtk_css_section_get_start_line (section), gtk_css_section_get_start_position (section)); gtk_text_buffer_get_iter_at_line_index (buffer, &end, gtk_css_section_get_end_line (section), gtk_css_section_get_end_position (section)); if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED)) tag_name = "warning"; else tag_name = "error"; gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end); }
static void ide_keybindings_parsing_error (GtkCssProvider *css_provider, GtkCssSection *section, GError *error, gpointer user_data) { g_autofree gchar *filename = NULL; GFile *file; guint start_line; guint end_line; file = gtk_css_section_get_file (section); filename = g_file_get_uri (file); start_line = gtk_css_section_get_start_line (section); end_line = gtk_css_section_get_end_line (section); g_warning ("CSS parsing error in %s between lines %u and %u", filename, start_line, end_line); }