Fix #7996 - handle namespaces in glade, adw overlay for window selection and open
[roobuilder] / src / Builder4 / MainWindow.bjs
1 {
2  "build_module" : "builder",
3  "gen_extended" : false,
4  "items" : [
5   {
6    "# Project.Project project" : "null",
7    "# WindowState windowstate" : "",
8    "# bool winloading" : false,
9    "$ type" : "Gtk.WindowType.TOPLEVEL",
10    "$ xns" : "Gtk",
11    "* ctor" : "new Gtk.ApplicationWindow(BuilderApplication.singleton({}))",
12    "* init" : [
13     "",
14     "this.el.set_icon_name(\"roobuilder\");",
15     ""
16    ],
17    "border_width" : 0,
18    "default_height" : 850,
19    "default_width" : 1200,
20    "id" : "MainWindow",
21    "items" : [
22     {
23      "$ string title" : "\"Application Builder\"",
24      "$ xns" : "Gtk",
25      "* pack" : "set_titlebar",
26      "bool show_close_button" : true,
27      "id" : "headerbar",
28      "items" : [
29       {
30        "$ xns" : "Gtk",
31        "* pack" : "pack_start",
32        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
33        "items" : [
34         {
35          "$ xns" : "Gtk",
36          "* pack" : "append",
37          "bool has_frame" : false,
38          "listeners" : {
39           "clicked" : [
40            "  ( ) => {",
41            "  \t_this.splitview.el.show_sidebar = !_this.splitview.el.show_sidebar;",
42            "  \tif (_this.splitview.el.show_sidebar) {",
43            "  \t\t_this.filesearch.el.grab_focus();",
44            "  \t\t_this.winloading = true;",
45            "  \t\t_this.winmodel.el.remove_all();",
46            "  \t\t_this.filesearch.el.set_text(\"\");",
47            "  \t\tfor(var i = 0;i < BuilderApplication.windowlist.get_n_items(); i++) {",
48            "\t\t\t_this.winmodel.el.append( BuilderApplication.windowlist.get_item(i));",
49            "\t\t}",
50            "\t\t_this.winsel.selectCurrent();",
51            "\t\t_this.winloading = false;",
52            " \t}",
53            "}"
54           ]
55          },
56          "string icon_name" : "preferences-system-windows",
57          "tooltop_text" : "Manage Windows",
58          "xtype" : "Button"
59         }
60        ],
61        "xtype" : "Box"
62       }
63      ],
64      "xtype" : "HeaderBar"
65     },
66     {
67      "$ xns" : "Adw",
68      "* prop" : "child",
69      "bool collapsed" : true,
70      "bool show_sidebar" : false,
71      "double sidebar_width_fraction" : 0.40000000000000002,
72      "id" : "splitview",
73      "items" : [
74       {
75        "$ xns" : "Gtk",
76        "* prop" : "content",
77        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
78        "bool hexpand" : true,
79        "bool homogeneous" : false,
80        "bool vexpand" : false,
81        "id" : "vbox",
82        "int spacing" : 0,
83        "items" : [
84         {
85          "# int lastWidth" : 0,
86          "$ xns" : "Gtk",
87          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
88          "bool hexpand" : true,
89          "bool vexpand" : true,
90          "id" : "mainpane",
91          "items" : [
92           {
93            "$ xns" : "Gtk",
94            "* prop" : "start_child",
95            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
96            "bool hexpand" : true,
97            "bool vexpand" : true,
98            "id" : "leftpane",
99            "items" : [
100             {
101              "$ xns" : "Gtk",
102              "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
103              "id" : "editpane",
104              "items" : [
105               {
106                "$ xns" : "Gtk",
107                "* prop" : "start_child",
108                "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
109                "bool hexpand" : true,
110                "bool vexpand" : true,
111                "id" : "tree",
112                "xtype" : "Box"
113               },
114               {
115                "$ xns" : "Gtk",
116                "* prop" : "end_child",
117                "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
118                "bool hexpand" : true,
119                "bool vexpand" : true,
120                "id" : "props",
121                "xtype" : "Box"
122               }
123              ],
124              "listeners" : {
125               "accept_position" : [
126                "( ) => {",
127                "\t_this.windowstate.left_tree.onresize();",
128                "\treturn true;",
129                "}",
130                ""
131               ],
132               "move_handle" : [
133                "(scroll) => {",
134                "\tGLib.debug(\"Move handle\");",
135                "\treturn true;",
136                "}"
137               ]
138              },
139              "xtype" : "Paned"
140             }
141            ],
142            "xtype" : "Box"
143           },
144           {
145            "$ xns" : "Gtk",
146            "* prop" : "end_child",
147            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
148            "bool hexpand" : true,
149            "bool vexpand" : true,
150            "items" : [
151             {
152              "$ xns" : "Gtk",
153              "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
154              "bool hexpand" : true,
155              "bool vexpand" : true,
156              "id" : "rooviewbox",
157              "xtype" : "Box"
158             },
159             {
160              "$ xns" : "Gtk",
161              "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
162              "bool hexpand" : true,
163              "bool vexpand" : true,
164              "id" : "codeeditviewbox",
165              "xtype" : "Box"
166             }
167            ],
168            "xtype" : "Box"
169           }
170          ],
171          "listeners" : {
172           "accept_position" : [
173            "( ) => {",
174            "\t_this.windowstate.left_tree.onresize();",
175            "\treturn true;",
176            "}",
177            ""
178           ]
179          },
180          "position" : 400,
181          "xtype" : "Paned"
182         },
183         {
184          "$ xns" : "Gtk",
185          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
186          "bool homogeneous" : false,
187          "bool vexpand" : false,
188          "items" : [
189           {
190            "$ tooltip_text" : "\"Project Details\"",
191            "$ xns" : "Gtk",
192            "bool always_show_image" : true,
193            "listeners" : {
194             "clicked" : [
195              "  ( ) => {",
196              "     ",
197              "     _this.windowstate.projectPopoverShow(_this.el, null, null);",
198              "   ",
199              "  ",
200              "}"
201             ]
202            },
203            "string icon_name" : "emblem-system",
204            "string label" : "Edit Project Settings",
205            "xtype" : "Button"
206           },
207           {
208            "$ tooltip_text" : "\"File Details\"",
209            "$ xns" : "Gtk",
210            "bool always_show_image" : true,
211            "listeners" : {
212             "clicked" : [
213              "  ( ) => {",
214              "  ",
215              "    // create a new file in project..",
216              "    if (_this.project == null || _this.windowstate.file == null) {",
217              "        return  ;",
218              "    }",
219              "     _this.windowstate.file_details.show(",
220              "        _this.windowstate.file, _this.el, false",
221              "    );",
222              "     ",
223              "    return  ;    ",
224              "",
225              "",
226              "}"
227             ]
228            },
229            "string icon_name" : "document-properties",
230            "string label" : "Edit File Properties",
231            "xtype" : "Button"
232           },
233           {
234            "$ xns" : "Gtk",
235            "bool always_show_image" : true,
236            "items" : [
237             {
238              "$ xns" : "Gtk",
239              "* ctor" : "new Gtk.PopoverMenu.from_model(null)",
240              "* init" : [
241               "{",
242               "   // this.el.show();",
243               "}",
244               ""
245              ],
246              "* prop" : "popover",
247              "id" : "topbarmenu",
248              "items" : [
249               {
250                "$ xns" : "Gtk",
251                "* pack" : "set_child",
252                "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
253                "int spacing" : 0,
254                "items" : [
255                 {
256                  "$ xns" : "Gtk",
257                  "listeners" : {
258                   "activate" : [
259                    " ( ) => {",
260                    "         Resources.singleton().fetchStart();",
261                    "}"
262                   ]
263                  },
264                  "string label" : "Download updated Resources",
265                  "xtype" : "Button"
266                 },
267                 {
268                  "$ xns" : "Gtk",
269                  "listeners" : {
270                   "clicked" : [
271                    "() => {",
272                    "    About.singleton().el.show();",
273                    "    }"
274                   ]
275                  },
276                  "string label" : "About the Builder",
277                  "xtype" : "Button"
278                 }
279                ],
280                "xtype" : "Box"
281               }
282              ],
283              "xtype" : "PopoverMenu"
284             }
285            ],
286            "string icon_name" : "dialog-information",
287            "string label" : "About",
288            "xtype" : "MenuButton"
289           },
290           {
291            "$ xns" : "Gtk",
292            "bool hexpand" : true,
293            "string label" : "   ",
294            "xtype" : "Label"
295           },
296           {
297            "$ xns" : "Gtk",
298            "* init" : [
299             "{",
300             "     this.handler_id = Resources.singleton().updateProgress.connect((pos,total) => {",
301             "        if (pos < 1) {",
302             "            this.el.hide();",
303             "            _this.mainpane.el.set_sensitive(true);",
304             "            ",
305             "            return;",
306             "        }",
307             "         _this.mainpane.el.set_sensitive(false);",
308             "         this.el.show();",
309             "         this.el.set_fraction ((1.0f * pos) / (1.0f * total));",
310             "         this.el.set_text(\"Fetching Resource : %s/%s\".printf(pos.to_string(), total.to_string()));",
311             "       ",
312             "     });",
313             "}",
314             ""
315            ],
316            "bool show_text" : true,
317            "id" : "statusbar",
318            "ulong handler_id" : "-1",
319            "xtype" : "ProgressBar"
320           },
321           {
322            "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
323            "$ xns" : "Gtk",
324            "items" : [
325             {
326              "$ xns" : "Gtk",
327              "id" : "statusbar_compilestatus_label",
328              "int margin_end" : 4,
329              "int margin_start" : 4,
330              "string label" : "Compile Status:",
331              "xtype" : "Label"
332             },
333             {
334              "$ xns" : "Gtk",
335              "Xcls_ValaCompileErrors popup" : "",
336              "id" : "statusbar_errors",
337              "listeners" : {
338               "clicked" : [
339                "() => {",
340                " ",
341                "\tif (this.popup == null) {",
342                "\t\treturn;",
343                "\t}",
344                "   ",
345                "    this.popup.show();",
346                "  ",
347                "}"
348               ]
349              },
350              "string icon_name" : "dialog-error",
351              "string label" : "0 Errors",
352              "xtype" : "Button",
353              "| void setNotices" : [
354               "(GLib.ListStore nots, int ferrors ) {",
355               "    BuilderApplication.showSpinner(\"\");",
356               "     if (nots.get_n_items() < 1 ) {",
357               "    \tthis.el.hide();",
358               "    \tif (this.popup != null) {",
359               "    \t\tthis.popup.el.hide();",
360               "\t\t}",
361               "    \treturn;",
362               "    }",
363               "    ",
364               "    this.el.show();",
365               "    this.el.label = \"%d/%d Errors\".printf(ferrors,(int)nots.get_n_items());",
366               "",
367               "    ",
368               " ",
369               "\tif (this.popup == null) {",
370               "        this.popup = new Xcls_ValaCompileErrors();",
371               "        this.popup.window = _this;",
372               "      //    this.popup.el.set_transient_for( _this.el );",
373               "        this.popup.el.set_parent(this.el);",
374               "    }",
375               " ",
376               "\tthis.popup.updateNotices(nots);",
377               "\t ",
378               "}",
379               ""
380              ]
381             },
382             {
383              "$ xns" : "Gtk",
384              "Xcls_ValaCompileErrors popup" : "",
385              "id" : "statusbar_warnings",
386              "listeners" : {
387               "clicked" : [
388                "() => {",
389                " ",
390                "\tif (this.popup == null) {",
391                "\t\treturn;",
392                "\t}",
393                "   ",
394                "    this.popup.show();",
395                "    return;",
396                "}"
397               ]
398              },
399              "string icon_name" : "dialog-warning",
400              "string label" : "0 Warnings",
401              "xtype" : "Button",
402              "| void setNotices" : [
403               "(GLib.ListStore nots, int ferrs ) {",
404               "    ",
405               "     if (nots.get_n_items() < 1 ) {",
406               "    \tthis.el.hide();",
407               "    \tif (this.popup != null) {",
408               "    \t\tthis.popup.el.hide();",
409               "\t\t}",
410               "    \treturn;",
411               "    }",
412               "    ",
413               "    this.el.show();",
414               "    this.el.label = \"%d/%d Warnings\".printf(ferrs,(int)nots.get_n_items());",
415               "",
416               "    ",
417               " ",
418               "\tif (this.popup == null) {",
419               "        this.popup = new Xcls_ValaCompileErrors();",
420               "        this.popup.window = _this;",
421               "      //    this.popup.el.set_transient_for( _this.el );",
422               "        this.popup.el.set_parent(this.el);",
423               "    }",
424               "\tthis.popup.updateNotices(nots);",
425               "\t ",
426               "}",
427               ""
428              ]
429             },
430             {
431              "# GLib.ListStore notices" : "null",
432              "$ xns" : "Gtk",
433              "Xcls_ValaCompileErrors popup" : "",
434              "id" : "statusbar_depricated",
435              "listeners" : {
436               "clicked" : [
437                "() => {",
438                " ",
439                "\tif (this.popup == null) {",
440                "\t\treturn;",
441                "\t}",
442                "   ",
443                "    this.popup.show();",
444                "  ",
445                "}"
446               ]
447              },
448              "string icon_name" : "dialog-information",
449              "string label" : "0 Depricated",
450              "xtype" : "Button",
451              "| void setNotices" : [
452               "",
453               "(GLib.ListStore nots, int ferrs ) {",
454               "    ",
455               "     if (nots.get_n_items() < 1 ) {",
456               "    \tthis.el.hide();",
457               "    \tif (this.popup != null) {",
458               "    \t\tthis.popup.el.hide();",
459               "\t\t}",
460               "    \treturn;",
461               "    }",
462               "    ",
463               "    this.el.show();",
464               "    this.el.label = \"%d/%d Depricated\".printf(ferrs,(int)nots.get_n_items());",
465               "",
466               "    ",
467               " ",
468               "\tif (this.popup == null) {",
469               "        this.popup = new Xcls_ValaCompileErrors();",
470               "        this.popup.window = _this;",
471               "      //    this.popup.el.set_transient_for( _this.el );",
472               "        this.popup.el.set_parent(this.el);",
473               "    }",
474               "\tthis.popup.updateNotices(nots);",
475               "\t ",
476               "}",
477               ""
478              ]
479             },
480             {
481              "$ xns" : "Gtk",
482              "Palete.ValaCompileRequest? last_request" : "null",
483              "Xcls_ValaCompileErrors popup" : "",
484              "bool visible" : false,
485              "id" : "statusbar_run",
486              "listeners" : {
487               "clicked" : [
488                "() => {",
489                "   ",
490                "   if (_this.windowstate.file == null) {",
491                "\t\treturn;",
492                "\t}",
493                "   if (_this.statusbar_compile_spinner.el.spinning) {",
494                "    \t_this.windowstate.compile_results.el.set_parent(this.el);",
495                "\t    _this.windowstate.compile_results.el.show(); // show currently running.",
496                "    \treturn;",
497                "\t}",
498                "\t",
499                "\tif (this.last_request != null) {",
500                "\t\tthis.last_request.cancel();",
501                "\t\tif (this.last_request.terminal_pid > 0) {",
502                "\t\t\tthis.last_request.killChildren(this.last_request.terminal_pid);",
503                "\t\t}",
504                "\t}",
505                "\tvar pr = _this.windowstate.project as Project.Gtk;",
506                "\tif (pr == null) {",
507                "\t\treturn;",
508                "\t}",
509                "\t",
510                "\t",
511                "\tthis.last_request= new Palete.ValaCompileRequest(",
512                "\t\tpr,",
513                "\t\tpr.firstBuildModuleWith(_this.windowstate.file)",
514                "\t);",
515                "\tthis.last_request.onOutput.connect( ( str) => {",
516                "\t\t_this.windowstate.compile_results.addLine(str);",
517                "\t});",
518                "\tthis.last_request.run.begin( ( a, r) => {",
519                "\t\tthis.last_request.run.end(r);",
520                "\t});",
521                "\t if (_this.windowstate.compile_results.el.parent == null) {",
522                "\t\t_this.windowstate.compile_results.el.set_parent(this.el);",
523                "\t}",
524                "\t_this.windowstate.compile_results.show(this.el,true);",
525                "\t         ",
526                "}"
527               ]
528              },
529              "string icon_name" : "media-playback-start",
530              "string label" : "Run",
531              "xtype" : "Button"
532             }
533            ],
534            "xtype" : "Box"
535           },
536           {
537            "$ xns" : "Gtk",
538            "id" : "statusbar_compile_spinner",
539            "int margin_end" : 4,
540            "int margin_start" : 4,
541            "string tooltip_text" : "Compiling",
542            "xtype" : "Spinner",
543            "| void start" : [
544             "(string icon, string tooltip) {",
545             "",
546             "\tif (icon == \"spinner\") {",
547             "\t  this.el.show();",
548             "\t  this.el.start();  ",
549             "\t  this.el.tooltip_text = tooltip;",
550             "\t  _this.statusbar_compile_icon.el.hide();",
551             "  } else {",
552             "\t  this.el.hide();",
553             "\t//  GLib.debug(\"set status icon %s, %s\", icon, tooltip);",
554             "\t  _this.statusbar_compile_icon.el.tooltip_text = tooltip;",
555             "\t  _this.statusbar_compile_icon.el.icon_name = icon;",
556             "\t  _this.statusbar_compile_icon.el.show();\t  ",
557             "  }",
558             "  ",
559             "\t ",
560             "}",
561             ""
562            ],
563            "| void stop" : [
564             "() {",
565             " this.el.stop();",
566             "  this.el.hide();",
567             " _this.statusbar_compile_icon.el.hide();  ",
568             "}",
569             ""
570            ]
571           },
572           {
573            "$ xns" : "Gtk",
574            "Gtk.IconSize icon_size" : "Gtk.IconSize.NORMAL",
575            "id" : "statusbar_compile_icon",
576            "int margin_end" : 4,
577            "int margin_start" : 4,
578            "xtype" : "Image"
579           }
580          ],
581          "xtype" : "Box"
582         }
583        ],
584        "xtype" : "Box"
585       },
586       {
587        "$ xns" : "Gtk",
588        "* prop" : "sidebar",
589        "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
590        "int spacing" : 0,
591        "items" : [
592         {
593          "$ xns" : "Gtk",
594          "bool hexpand" : true,
595          "bool search_mode_enabled" : true,
596          "items" : [
597           {
598            "$ xns" : "Gtk",
599            "* prop" : "child",
600            "bool hexpand" : true,
601            "id" : "filesearch",
602            "listeners" : {
603             "search_changed" : [
604              "( ) => {",
605              "",
606              "\t_this.windowsearch.el.set_search(this.el.get_text());",
607              "}",
608              ""
609             ]
610            },
611            "string placeholder_text" : "Search for file",
612            "xtype" : "SearchEntry"
613           }
614          ],
615          "xtype" : "SearchBar"
616         },
617         {
618          "$ xns" : "Gtk",
619          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
620          "bool hexpand" : true,
621          "int spacing" : 0,
622          "items" : [
623           {
624            "$ xns" : "Gtk",
625            "bool hexpand" : true,
626            "id" : "open_projects_btn",
627            "items" : [
628             {
629              "$ xns" : "Gtk",
630              "* prop" : "child",
631              "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
632              "int spacing" : 0,
633              "items" : [
634               {
635                "$ xns" : "Gtk",
636                "int margin_end" : 4,
637                "string icon_name" : "document-open",
638                "xtype" : "Image"
639               },
640               {
641                "$ xns" : "Gtk",
642                "string label" : "Open File",
643                "xtype" : "Label"
644               }
645              ],
646              "xtype" : "Box"
647             }
648            ],
649            "listeners" : {
650             "clicked" : [
651              "  ( ) => {",
652              "  \t_this.windowstate.showPopoverFiles(this.el, _this.project, false);",
653              "}"
654             ]
655            },
656            "tooltop_text" : "\"Open File\"",
657            "xtype" : "Button"
658           },
659           {
660            "$ xns" : "Gtk",
661            "bool hexpand" : true,
662            "items" : [
663             {
664              "$ xns" : "Gtk",
665              "* prop" : "child",
666              "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
667              "int spacing" : 0,
668              "items" : [
669               {
670                "$ xns" : "Gtk",
671                "int margin_end" : 4,
672                "string icon_name" : "window-new",
673                "xtype" : "Image"
674               },
675               {
676                "$ xns" : "Gtk",
677                "string label" : "New Window",
678                "xtype" : "Label"
679               }
680              ],
681              "xtype" : "Box"
682             }
683            ],
684            "listeners" : {
685             "clicked" : [
686              "( ) => {",
687              "\t_this.splitview.el.show_sidebar = false;",
688              "\t_this.windowstate.showPopoverFiles(_this.el, _this.project, true);",
689              "}"
690             ]
691            },
692            "xtype" : "Button"
693           }
694          ],
695          "xtype" : "Box"
696         },
697         {
698          "$ xns" : "Gtk",
699          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
700          "bool vexpand" : true,
701          "items" : [
702           {
703            "$ xns" : "Gtk",
704            "* prop" : "start_child",
705            "items" : [
706             {
707              "$ xns" : "Gtk",
708              "* prop" : "child",
709              "items" : [
710               {
711                "$ xns" : "Gtk",
712                "* prop" : "model",
713                "bool autoselect" : false,
714                "bool can_unselect" : false,
715                "bool selecting" : false,
716                "id" : "winsel",
717                "items" : [
718                 {
719                  "$ xns" : "Gtk",
720                  "* prop" : "model",
721                  "items" : [
722                   {
723                    "$ xns" : "Gtk",
724                    "* prop" : "model",
725                    "id" : "winfilter",
726                    "items" : [
727                     {
728                      "$ xns" : "Gtk",
729                      "* prop" : "filter",
730                      "id" : "windowsearch",
731                      "items" : [
732                       {
733                        "$ xns" : "Gtk",
734                        "* prop" : "expression",
735                        "GLib.Type this_type" : "typeof(WindowState)",
736                        "string property_name" : "file_name",
737                        "xtype" : "PropertyExpression"
738                       }
739                      ],
740                      "xtype" : "StringFilter"
741                     },
742                     {
743                      "$ xns" : "GLib",
744                      "* prop" : "model",
745                      "GLib.Type item_type" : "typeof(WindowState)",
746                      "id" : "winmodel",
747                      "xtype" : "ListStore"
748                     }
749                    ],
750                    "xtype" : "FilterListModel"
751                   },
752                   {
753                    "$ xns" : "Gtk",
754                    "* prop" : "sorter",
755                    "bool ignore_case" : true,
756                    "items" : [
757                     {
758                      "$ xns" : "Gtk",
759                      "* prop" : "expression",
760                      "GLib.Type this_type" : "typeof(WindowState)",
761                      "string property_name" : "file_name",
762                      "xtype" : "PropertyExpression"
763                     }
764                    ],
765                    "xtype" : "StringSorter"
766                   }
767                  ],
768                  "xtype" : "SortListModel"
769                 }
770                ],
771                "listeners" : {
772                 "notify[\"selected\"]" : [
773                  "() => {",
774                  "\tif (_this.winloading || this.selecting || this.el.selected == Gtk.INVALID_LIST_POSITION) {",
775                  "\t\treturn;",
776                  "\t}",
777                  "\tvar ws = this.el.selected_item as WindowState;",
778                  "\tif (ws == null) {",
779                  "\t\treturn;",
780                  "\t}",
781                  "\tif (ws.file.path != _this.windowstate.file.path) {",
782                  "\t\t_this.windowstate.fileViewOpen(ws.file, ws.file_details.new_window,  -1);",
783                  "\t\t_this.splitview.el.show_sidebar = false;",
784                  "\t}",
785                  "\t",
786                  "\tthis.selectCurrent();",
787                  " }"
788                 ]
789                },
790                "xtype" : "SingleSelection",
791                "| void selectCurrent" : [
792                 "() {",
793                 "\tthis.selecting = true;",
794                 "\t ",
795                 "\tfor(var i = 0;i < this.el.get_n_items(); i++) {",
796                 "\t\tvar ws = this.el.get_item(i) as WindowState;",
797                 "\t\tif (ws.file.path == _this.windowstate.file.path) {",
798                 "\t\t  \tthis.el.selected = i;",
799                 "\t\t  \tbreak;",
800                 "\t  \t}",
801                 "\t}",
802                 "\tthis.selecting = false;",
803                 " ",
804                 "",
805                 "}"
806                ]
807               },
808               {
809                "$ xns" : "Gtk",
810                "bool expand" : true,
811                "bool resizable" : true,
812                "id" : "projcol",
813                "items" : [
814                 {
815                  "$ xns" : "Gtk",
816                  "* prop" : "factory",
817                  "listeners" : {
818                   "bind" : [
819                    "(listitem) => {",
820                    "\t var lb = (Gtk.Label) (listitem as Gtk.ListItem).get_child();",
821                    "\t var item =  (listitem as Gtk.ListItem).get_item() as WindowState;",
822                    "\t ",
823                    "\t lb.label = item.project.name;",
824                    "",
825                    "",
826                    "  ",
827                    "",
828                    "}",
829                    ""
830                   ],
831                   "setup" : [
832                    "(listitem) => {",
833                    "\tvar lbl = new Gtk.Label(\"\");",
834                    " \t(listitem as Gtk.ListItem).set_child(lbl);",
835                    " \tlbl.justify = Gtk.Justification.LEFT;",
836                    " \tlbl.xalign = 0;",
837                    " \tlbl.use_markup = true;",
838                    "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
839                    "  ",
840                    "\t(listitem as Gtk.ListItem).activatable = true;",
841                    "}",
842                    ""
843                   ]
844                  },
845                  "xtype" : "SignalListItemFactory"
846                 }
847                ],
848                "title" : "Project",
849                "xtype" : "ColumnViewColumn"
850               },
851               {
852                "$ xns" : "Gtk",
853                "* pack" : "append_column",
854                "bool expand" : true,
855                "bool resizable" : true,
856                "id" : "filecol",
857                "items" : [
858                 {
859                  "$ xns" : "Gtk",
860                  "* prop" : "factory",
861                  "listeners" : {
862                   "bind" : [
863                    "(listitem) => {",
864                    " var lb = (Gtk.Label) (listitem as Gtk.ListItem).get_child();",
865                    " var item =  (listitem as Gtk.ListItem).get_item() as WindowState;",
866                    " ",
867                    " lb.label = item.file.relpath;",
868                    "",
869                    "",
870                    "  ",
871                    "",
872                    "}",
873                    ""
874                   ],
875                   "setup" : [
876                    "(listitem) => {",
877                    "\tvar lbl = new Gtk.Label(\"\");",
878                    " \t(listitem as Gtk.ListItem).set_child(lbl);",
879                    " \tlbl.justify = Gtk.Justification.LEFT;",
880                    " \tlbl.xalign = 0;",
881                    " \tlbl.use_markup = true;",
882                    "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
883                    "  ",
884                    "\t(listitem as Gtk.ListItem).activatable = true;",
885                    "}",
886                    ""
887                   ]
888                  },
889                  "xtype" : "SignalListItemFactory"
890                 }
891                ],
892                "title" : "File",
893                "xtype" : "ColumnViewColumn"
894               }
895              ],
896              "xtype" : "ColumnView"
897             }
898            ],
899            "xtype" : "ScrolledWindow"
900           },
901           {
902            "* prop" : "end_child",
903            "bool hexpand" : true,
904            "bool vexpand" : true,
905            "items" : [
906             {
907              "$ xns" : "Gtk",
908              "* prop" : "child",
909              "bool hexpand" : true,
910              "bool vexpand" : true,
911              "items" : [
912               {
913                "$ xns" : "Gtk",
914                "* prop" : "model",
915                "bool autoselect" : false,
916                "bool can_unselect" : true,
917                "items" : [
918                 {
919                  "$ xns" : "Gtk",
920                  "* prop" : "model",
921                  "items" : [
922                   {
923                    "$ xns" : "Gtk",
924                    "* prop" : "model",
925                    "items" : [
926                     {
927                      "$ xns" : "GLib",
928                      "* prop" : "model",
929                      "GLib.Type item_type" : "typeof(WindowState)",
930                      "id" : "histmodel",
931                      "xtype" : "ListStore"
932                     },
933                     {
934                      "$ xns" : "Gtk",
935                      "* prop" : "filter",
936                      "id" : "histsearch",
937                      "items" : [
938                       {
939                        "$ xns" : "Gtk",
940                        "* prop" : "expression",
941                        "GLib.Type this_type" : "typeof(WindowState)",
942                        "string property_name" : "file_name",
943                        "xtype" : "PropertyExpression"
944                       }
945                      ],
946                      "xtype" : "StringFilter"
947                     }
948                    ],
949                    "xtype" : "FilterListModel"
950                   },
951                   {
952                    "$ xns" : "Gtk",
953                    "* prop" : "sorter",
954                    "bool ignore_case" : true,
955                    "items" : [
956                     {
957                      "$ xns" : "Gtk",
958                      "* prop" : "expression",
959                      "GLib.Type this_type" : "typeof(WindowState)",
960                      "string property_name" : "file_name",
961                      "xtype" : "PropertyExpression"
962                     }
963                    ],
964                    "xtype" : "StringSorter"
965                   }
966                  ],
967                  "xtype" : "SortListModel"
968                 }
969                ],
970                "xtype" : "SingleSelection"
971               },
972               {
973                "$ xns" : "Gtk",
974                "bool expand" : true,
975                "bool resizable" : true,
976                "items" : [
977                 {
978                  "$ xns" : "Gtk",
979                  "* prop" : "factory",
980                  "listeners" : {
981                   "bind" : [
982                    "(listitem) => {",
983                    "\t var lb = (Gtk.Label) (listitem as Gtk.ListItem).get_child();",
984                    "\t var item =  (listitem as Gtk.ListItem).get_item() as WindowState;",
985                    "\t ",
986                    "\t lb.label = item.project.name;",
987                    "",
988                    "",
989                    "  ",
990                    "",
991                    "}",
992                    ""
993                   ],
994                   "setup" : [
995                    "(listitem) => {",
996                    "\tvar lbl = new Gtk.Label(\"\");",
997                    " \t(listitem as Gtk.ListItem).set_child(lbl);",
998                    " \tlbl.justify = Gtk.Justification.LEFT;",
999                    " \tlbl.xalign = 1;",
1000                    " \tlbl.use_markup = true;",
1001                    "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
1002                    "  ",
1003                    "\t(listitem as Gtk.ListItem).activatable = true;",
1004                    "}",
1005                    ""
1006                   ]
1007                  },
1008                  "xtype" : "SignalListItemFactory"
1009                 }
1010                ],
1011                "title" : "Project",
1012                "xtype" : "ColumnViewColumn"
1013               },
1014               {
1015                "$ xns" : "Gtk",
1016                "* pack" : "append_column",
1017                "bool expand" : true,
1018                "bool resizable" : true,
1019                "items" : [
1020                 {
1021                  "$ xns" : "Gtk",
1022                  "* prop" : "factory",
1023                  "listeners" : {
1024                   "bind" : [
1025                    "(listitem) => {",
1026                    " var lb = (Gtk.Label) (listitem as Gtk.ListItem).get_child();",
1027                    " var item =  (listitem as Gtk.ListItem).get_item() as WindowState;",
1028                    " ",
1029                    " lb.label = item.file.relpath;",
1030                    "",
1031                    "",
1032                    "  ",
1033                    "",
1034                    "}",
1035                    ""
1036                   ],
1037                   "setup" : [
1038                    "(listitem) => {",
1039                    "\tvar lbl = new Gtk.Label(\"\");",
1040                    " \t(listitem as Gtk.ListItem).set_child(lbl);",
1041                    " \tlbl.justify = Gtk.Justification.LEFT;",
1042                    " \tlbl.xalign = 1;",
1043                    " \tlbl.use_markup = true;",
1044                    "\tlbl.ellipsize = Pango.EllipsizeMode.START;",
1045                    "  ",
1046                    "\t(listitem as Gtk.ListItem).activatable = true;",
1047                    "}",
1048                    ""
1049                   ]
1050                  },
1051                  "xtype" : "SignalListItemFactory"
1052                 }
1053                ],
1054                "title" : "File",
1055                "xtype" : "ColumnViewColumn"
1056               }
1057              ],
1058              "xtype" : "ColumnView"
1059             }
1060            ],
1061            "string xns" : "Gtk",
1062            "string xtype" : "ScrolledWindow"
1063           }
1064          ],
1065          "xtype" : "Paned"
1066         }
1067        ],
1068        "xtype" : "Box"
1069       }
1070      ],
1071      "xtype" : "OverlaySplitView"
1072     }
1073    ],
1074    "listeners" : {
1075     "close_request" : [
1076      "( ) => {",
1077      "\t Resources.singleton().disconnect(_this.statusbar.handler_id);",
1078      "\t ",
1079      "\t ",
1080      "\t this.windowstate.file.getLanguageServer().document_close(",
1081      "\t \tthis.windowstate.file",
1082      " \t);",
1083      "\t ",
1084      "\t BuilderApplication.removeWindow(this);",
1085      "\t ",
1086      "\t if (BuilderApplication.windows.size  < 1) {",
1087      "\t\tthis.windowstate.file.getLanguageServer().exit();",
1088      "\t\tBuilderApplication.singleton(  null ).quit();",
1089      "\t }",
1090      "\treturn true;",
1091      "}",
1092      ""
1093     ],
1094     "hide" : [
1095      "() =>  {",
1096      " ",
1097      " ",
1098      "",
1099      "}"
1100     ],
1101     "show" : [
1102      "  ( ) => {",
1103      "    // hide the file editing..",
1104      "   ",
1105      "    //this.hideViewEditing();",
1106      "    // this is updated by windowstate - we try and fill it in..",
1107      "     _this.statusbar.el.hide();",
1108      "     //_this.statusbar_errors.el.hide();",
1109      "    //_this.statusbar_warnings.el.hide();",
1110      "    //_this.statusbar_depricated.el.hide();",
1111      "    _this.statusbar_compile_spinner.el.hide();",
1112      "  ",
1113      "    Resources.singleton().checkResources();",
1114      "    ",
1115      "  ",
1116      "",
1117      "}"
1118     ]
1119    },
1120    "string title" : "Roo Application Builder",
1121    "xtype" : "ApplicationWindow",
1122    "| void initChildren" : [
1123     " () {",
1124     "    // this needs putting in a better place..",
1125     "    if (this.windowstate == null) {",
1126     "    \tthis.windowstate = new WindowState(this);",
1127     "    ",
1128     "    }",
1129     "     ",
1130     "",
1131     " ",
1132     "",
1133     "    ",
1134     "",
1135     "",
1136     "",
1137     "}",
1138     ""
1139    ],
1140    "| void openNewWindow" : [
1141     "() {",
1142     " ",
1143     "    var w = new Xcls_MainWindow();",
1144     "    w.ref();",
1145     "\tBuilderApplication.addWindow(w);",
1146     "    w.el.show();",
1147     "    w.initChildren();",
1148     "    w.windowstate.showPopoverFiles(w.open_projects_btn.el, _this.project, false);",
1149     "     ",
1150     "}",
1151     ""
1152    ],
1153    "| void setTitle" : [
1154     " () {",
1155     "    if (_this.windowstate.project == null || ",
1156     "\t    _this.windowstate.file == null",
1157     "    ) {",
1158     "    \tthis.el.set_title(\"Select File\");",
1159     "    \treturn;",
1160     "\t}",
1161     "    _this.el.set_title(",
1162     "    \t_this.windowstate.project.name + ",
1163     "    \t\" - \" +",
1164     "\t\t_this.windowstate.file.relpath);",
1165     "} "
1166    ],
1167    "| void show" : [
1168     "() {",
1169     "   ",
1170     "    this.el.show();",
1171     "    if (this.windowstate.file  == null) {",
1172     "    \tthis.windowstate.showPopoverFiles(this.open_projects_btn.el, null, false);",
1173     "    }",
1174     "}"
1175    ],
1176    "| void updateErrors" : [
1177     "() {",
1178     "",
1179     "",
1180     " \tGLib.debug(\"updateErrors\");",
1181     "\t",
1182     "\tvar pr = this.windowstate.project.getErrors(\"ERR\");",
1183     "\t",
1184     "\tthis.statusbar_errors.setNotices(",
1185     "\t\tpr,",
1186     "\t\tthis.windowstate.file.getErrorsTotal(\"ERR\")",
1187     "\t);",
1188     "\t",
1189     "\tthis.statusbar_warnings.setNotices(",
1190     "\t\tthis.windowstate.project.getErrors(\"WARN\"),",
1191     "\t\tthis.windowstate.file.getErrorsTotal(\"WARN\")",
1192     "\t);",
1193     "\tthis.statusbar_depricated.setNotices(",
1194     "\t\tthis.windowstate.project.getErrors(\"DEPR\"),",
1195     "\t\tthis.windowstate.file.getErrorsTotal(\"DEPR\")",
1196     "\t);",
1197     "",
1198     "\t_this.statusbar_run.el.hide();",
1199     "",
1200     "\tif (pr.get_n_items() < 1) {",
1201     "\t\t_this.statusbar_run.el.show();",
1202     "\t} ",
1203     "\t",
1204     "}"
1205    ]
1206   }
1207  ],
1208  "name" : "MainWindow"
1209 }