Fix #8032 - speed up add remove of errors from tree
[roobuilder] / src / Builder4 / WindowLeftProps.bjs
index 657d9b1..7df8fe4 100644 (file)
@@ -3,6 +3,7 @@
  "gen_extended" : false,
  "items" : [
   {
+   "# Gee.ArrayList<Gtk.Widget>? error_widgets" : "null",
    "# JsRender.JsRender file" : "",
    "# JsRender.Node node" : "",
    "# Xcls_MainWindow main_window" : "null",
    ],
    "| void removeErrors" : [
     "() {",
-    "\tvar  child = this.view.el.get_first_child(); ",
-    " ",
-    "\tvar reading_header = true;",
-    " ",
-    "\twhile (child != null) {",
-    "\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
-    "\t   ",
-    "\t   if (reading_header) {",
-    "\t\t\t",
-    "",
-    "\t\t\tif (child.get_type().name() != \"GtkColumnListView\") {",
-    "\t\t\t   ",
-    "\t\t\t\tchild = child.get_next_sibling();",
-    "\t\t\t\tcontinue;",
-    "\t\t\t}",
-    "\t\t\t// should be columnlistview",
-    "\t\t\tchild = child.get_first_child(); ",
-    "\t\t ",
-    "\t\t ",
-    "\t\t\t",
-    "\t\t\treading_header = false;",
-    "\t\t\tcontinue;",
-    "\t    }",
-    "\t    ",
-    "\t  \tif (child.has_css_class(\"node-err\")) {",
+    "\t\tif (this.error_widgets == null || this.error_widgets.size < 1) {",
+    " \t\treturn;",
+    "\t}",
+    "\tforeach(var child in this.error_widgets) {",
+    "\t",
+    "\t\tif (child.has_css_class(\"node-err\")) {",
     "\t\t\tchild.remove_css_class(\"node-err\");",
     "\t\t}",
     "\t\tif (child.has_css_class(\"node-warn\")) {",
     "\t\tif (child.has_css_class(\"node-depr\")) {",
     "\t\t\tchild.remove_css_class(\"node-depr\");",
     "\t\t}",
-    "\t\t",
-    "        child = child.get_next_sibling(); ",
     "\t}",
+    "\tthis.error_widgets  = null;",
+    "\treturn;",
     "\t//GLib.debug(\"Rturning null\");",
     "     ",
     "}"
     "\t\treturn;",
     "\t}",
     "\tthis.removeErrors();",
-    "\t",
+    "\tthis.error_widgets = new Gee.ArrayList<Gtk.Widget>();",
     "\tforeach(var diag in ar) { ",
     "\t",
     "\t\t ",
     "    \tif (w == null) {",
     "    \t\treturn;",
     "\t\t}",
-    "\t  \t\tvar ed = diag.category.down();",
+    "",
+    "\t\t",
+    "  \t\tvar ed = diag.category.down();",
     "\t\tif (ed != \"err\" && w.has_css_class(\"node-err\")) {",
     "\t\t\tcontinue;",
     "\t\t}",
+    "\t\tthis.error_widgets.add(w);\t\t",
     "\t\tif (ed == \"err\" && w.has_css_class(\"node-warn\")) {",
     "\t\t\tw.remove_css_class(\"node-warn\");",
     "\t\t}",