Fix #8039 - library support and add back roopacker dependancy
[roobuilder] / src / Builder4 / ValaProjectSettingsPopover.bjs
1 {
2  "build_module" : "builder",
3  "gen_extended" : false,
4  "items" : [
5   {
6    "# Project.Gtk project" : "null",
7    "# Project.GtkValaSettings? selected_target" : "null",
8    "# Xcls_MainWindow window" : "null",
9    "# bool cg_loading" : false,
10    "# bool done" : false,
11    "$ Project.Callback doneObj" : "null",
12    "$ xns" : "Gtk",
13    "bool modal" : true,
14    "items" : [
15     {
16      "$ xns" : "Gtk",
17      "* prop" : "titlebar",
18      "* title" : "Edit Project Details",
19      "items" : [
20       {
21        "$ xns" : "Gtk",
22        "* prop" : "title_widget",
23        "string label" : "Change Vala  Compile settings",
24        "xtype" : "Label"
25       }
26      ],
27      "xtype" : "HeaderBar"
28     },
29     {
30      "$ xns" : "Gtk",
31      "* pack" : "set_child",
32      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
33      "bool hexpand" : true,
34      "bool vexpand" : true,
35      "items" : [
36       {
37        "$ xns" : "Gtk",
38        "bool vexpand" : true,
39        "id" : "notebook",
40        "items" : [
41         {
42          "$ xns" : "Gtk",
43          "* pack" : false,
44          "id" : "label_global",
45          "utf8 label" : "Global",
46          "xtype" : "Label"
47         },
48         {
49          "$ xns" : "Gtk",
50          "* pack" : false,
51          "id" : "label_targets",
52          "utf8 label" : "Targets",
53          "xtype" : "Label"
54         },
55         {
56          "$ xns" : "Gtk",
57          "* pack" : "append_page,_this.label_global.el",
58          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
59          "gboolean homogeneous" : false,
60          "items" : [
61           {
62            "$ xns" : "Gtk",
63            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
64            "int spacing" : 10,
65            "items" : [
66             {
67              "$ xns" : "Gtk",
68              "Gtk.Align halign" : "Gtk.Align.START",
69              "bool hexpand" : false,
70              "utf8 label" : "Compile flags:",
71              "xtype" : "Label"
72             },
73             {
74              "$ xns" : "Gtk",
75              "id" : "compile_flags",
76              "listeners" : {
77               "changed" : [
78                "() => {",
79                "    ",
80                "   _this.project.compile_flags = this.el.buffer.text;",
81                "   _this.project.save();",
82                "//    _this.project.save();",
83                "",
84                "}"
85               ]
86              },
87              "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR ",
88              "xtype" : "Entry"
89             },
90             {
91              "$ xns" : "Gtk",
92              "Gtk.Align halign" : "Gtk.Align.START",
93              "bool hexpand" : false,
94              "utf8 label" : "Version:",
95              "xtype" : "Label"
96             },
97             {
98              "$ xns" : "Gtk",
99              "id" : "version",
100              "listeners" : {
101               "changed" : [
102                "() => {",
103                "    ",
104                "   _this.project.version = this.el.buffer.text;",
105                "   _this.project.save();",
106                "//    _this.project.save();",
107                "",
108                "}"
109               ]
110              },
111              "utf8 placeholder_text" : "eg. 1.5",
112              "xtype" : "Entry"
113             },
114             {
115              "$ xns" : "Gtk",
116              "Gtk.Align halign" : "Gtk.Align.START",
117              "bool hexpand" : false,
118              "utf8 label" : "Licence:",
119              "xtype" : "Label"
120             },
121             {
122              "$ xns" : "Gtk",
123              "id" : "licence",
124              "listeners" : {
125               "changed" : [
126                "() => {",
127                "    ",
128                "   _this.project.licence = this.el.buffer.text;",
129                "   _this.project.save();",
130                "//    _this.project.save();",
131                "",
132                "}"
133               ]
134              },
135              "utf8 placeholder_text" : "eg. LGPL",
136              "xtype" : "Entry"
137             }
138            ],
139            "xtype" : "Box"
140           },
141           {
142            "$ xns" : "Gtk",
143            "Gtk.PolicyType hscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
144            "Gtk.PolicyType vscrollbar_policy" : "Gtk.PolicyType.AUTOMATIC",
145            "bool has_frame" : true,
146            "bool hexpand" : true,
147            "bool vexpand" : true,
148            "id" : "vapi_scroll",
149            "items" : [
150             {
151              "$ xns" : "Gtk",
152              "* prop" : "child",
153              "items" : [
154               {
155                "$ xns" : "Gtk",
156                "* prop" : "model",
157                "items" : [
158                 {
159                  "$ xns" : "Gtk",
160                  "* prop" : "model",
161                  "items" : [
162                   {
163                    "$ xns" : "Gtk",
164                    "* prop" : "model",
165                    "items" : [
166                     {
167                      "$ xns" : "GLib",
168                      "* prop" : "model",
169                      "GLib.Type item_type" : "typeof(Project.VapiSelection)",
170                      "id" : "vapimodel",
171                      "xtype" : "ListStore"
172                     },
173                     {
174                      "$ xns" : "Gtk",
175                      "* prop" : "sorter",
176                      "items" : [
177                       {
178                        "$ xns" : "Gtk",
179                        "* prop" : "expression",
180                        "GLib.Type this_type" : "typeof(Project.VapiSelection)",
181                        "string property_name" : "sortkey",
182                        "xtype" : "PropertyExpression"
183                       }
184                      ],
185                      "xtype" : "StringSorter"
186                     }
187                    ],
188                    "xtype" : "SortListModel"
189                   },
190                   {
191                    "$ xns" : "Gtk",
192                    "* prop" : "filter",
193                    "id" : "vapi_filter",
194                    "items" : [
195                     {
196                      "$ xns" : "Gtk",
197                      "* prop" : "expression",
198                      "GLib.Type this_type" : "typeof(Project.VapiSelection)",
199                      "string property_name" : "sortkey",
200                      "xtype" : "PropertyExpression"
201                     }
202                    ],
203                    "xtype" : "StringFilter"
204                   }
205                  ],
206                  "xtype" : "FilterListModel"
207                 }
208                ],
209                "xtype" : "NoSelection"
210               },
211               {
212                "$ xns" : "Gtk",
213                "* pack" : "append_column",
214                "bool expand" : true,
215                "items" : [
216                 {
217                  "$ xns" : "Gtk",
218                  "* prop" : "factory",
219                  "listeners" : {
220                   "bind" : [
221                    "(listitem) => {",
222                    " ",
223                    "\tvar lbl = (Gtk.Label)  ((Gtk.ListItem)listitem).get_child();",
224                    "\t   ",
225                    "\tvar item = (Project.VapiSelection)  ((Gtk.ListItem)listitem).get_item();",
226                    "",
227                    "\titem.bind_property(\"name\",",
228                    "                lbl, \"label\",",
229                    "           GLib.BindingFlags.SYNC_CREATE);",
230                    "",
231                    "\t  ",
232                    "}",
233                    ""
234                   ],
235                   "setup" : [
236                    "(item) => {",
237                    "\t//var j = (JsRender.JsRender) item;",
238                    "\tvar gi = (Gtk.ListItem)item;",
239                    "\t ",
240                    "\tvar lbl = new Gtk.Label(\"\");",
241                    "\tlbl.halign = Gtk.Align.START;",
242                    "\tgi.set_child(lbl);",
243                    "",
244                    "",
245                    "",
246                    "}",
247                    ""
248                   ]
249                  },
250                  "xtype" : "SignalListItemFactory"
251                 }
252                ],
253                "string title" : "Vapi Package",
254                "xtype" : "ColumnViewColumn"
255               },
256               {
257                "$ xns" : "Gtk",
258                "* pack" : "append_column",
259                "items" : [
260                 {
261                  "$ xns" : "Gtk",
262                  "* prop" : "factory",
263                  "listeners" : {
264                   "bind" : [
265                    "(listitem) => {",
266                    "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
267                    "\t",
268                    "\t",
269                    "\t",
270                    "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
271                    "\tvar btn = (Gtk.CheckButton)  ((Gtk.ListItem)listitem).get_child();",
272                    "\t  ",
273                    " ",
274                    "\tvar vs = (Project.VapiSelection)((Gtk.ListItem)listitem).get_item();",
275                    "",
276                    "\t//GLib.debug(\"change  %s to %s\", lbl.label, np.name);",
277                    "",
278                    "\tbtn.active = vs.selected; ",
279                    "\t",
280                    "\tvs.btn = btn;",
281                    " \t// bind image...",
282                    " \t",
283                    "}"
284                   ],
285                   "setup" : [
286                    "",
287                    "(listitem) => {",
288                    "",
289                    "\tvar btn = new Gtk.CheckButton();",
290                    " ",
291                    "\t((Gtk.ListItem)listitem).set_child(btn);",
292                    "\t",
293                    "\tbtn.toggled.connect(() =>  {",
294                    "\t ",
295                    "\t\tvar jr = (Project.VapiSelection) ((Gtk.ListItem)listitem).get_item();",
296                    "\t\tjr.selected = btn.active;",
297                    "\t});",
298                    "}",
299                    ""
300                   ]
301                  },
302                  "xtype" : "SignalListItemFactory"
303                 }
304                ],
305                "string title" : "use",
306                "xtype" : "ColumnViewColumn"
307               }
308              ],
309              "xtype" : "ColumnView"
310             }
311            ],
312            "xtype" : "ScrolledWindow"
313           },
314           {
315            "$ xns" : "Gtk",
316            "id" : "vapi_search",
317            "listeners" : {
318             "search_changed" : [
319              "( ) => {",
320              "",
321              " _this.vapi_filter.el.set_search(this.el.get_text());",
322              " ",
323              "}",
324              ""
325             ]
326            },
327            "string placeholder_text" : "Search Libraries (Vapi)",
328            "uint search_delay" : 500,
329            "xtype" : "SearchEntry"
330           }
331          ],
332          "xtype" : "Box"
333         },
334         {
335          "$ xns" : "Gtk",
336          "* pack" : "append_page,_this.label_targets.el",
337          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
338          "bool vexpand" : true,
339          "gint position" : 300,
340          "items" : [
341           {
342            "$ xns" : "Gtk",
343            "* pack" : "set_end_child",
344            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
345            "gboolean homogeneous" : false,
346            "id" : "set_vbox",
347            "items" : [
348             {
349              "$ xns" : "Gtk",
350              "bool vexpand" : true,
351              "items" : [
352               {
353                "$ xns" : "Gtk",
354                "* prop" : "child",
355                "id" : "treeview",
356                "items" : [
357                 {
358                  "$ xns" : "Gtk",
359                  "* prop" : "model",
360                  "id" : "treeselmodel",
361                  "items" : [
362                   {
363                    "$ xns" : "Gtk",
364                    "* prop" : "model",
365                    "items" : [
366                     {
367                      "$ xns" : "Gtk",
368                      "* init" : [
369                       "{",
370                       "\t//this.el.set_sorter(new Gtk.TreeListRowSorter(_this.treeview.el.sorter));",
371                       "}",
372                       ""
373                      ],
374                      "* prop" : "model",
375                      "id" : "treelistsort",
376                      "items" : [
377                       {
378                        "$ xns" : "Gtk",
379                        "* prop" : "model",
380                        "Gtk.TreeListModelCreateModelFunc create_func" : [
381                         "(item) => {",
382                         "\t//GLib.debug(\"liststore got %s\", item.get_type().name());",
383                         "\treturn ((JsRender.JsRender)item).childfiles;",
384                         "} "
385                        ],
386                        "bool autoexpand" : true,
387                        "bool passthrough" : false,
388                        "id" : "treelistmodel",
389                        "items" : [
390                         {
391                          "$ xns" : "GLib",
392                          "* prop" : "root",
393                          "GLib.Type item_type" : "typeof(JsRender.JsRender)",
394                          "id" : "treemodel",
395                          "xtype" : "ListStore"
396                         }
397                        ],
398                        "xtype" : "TreeListModel"
399                       },
400                       {
401                        "$ xns" : "Gtk",
402                        "* prop" : "sorter",
403                        "items" : [
404                         {
405                          "$ xns" : "Gtk",
406                          "* prop" : "sorter",
407                          "items" : [
408                           {
409                            "$ xns" : "Gtk",
410                            "* prop" : "expression",
411                            "GLib.Type this_type" : "typeof(JsRender.JsRender)",
412                            "string property_name" : "name",
413                            "xtype" : "PropertyExpression"
414                           }
415                          ],
416                          "xtype" : "StringSorter"
417                         }
418                        ],
419                        "xtype" : "TreeListRowSorter"
420                       }
421                      ],
422                      "xtype" : "SortListModel"
423                     },
424                     {
425                      "$ xns" : "Gtk",
426                      "* prop" : "filter",
427                      "Gtk.CustomFilterFunc match_func" : [
428                       "(item) => { ",
429                       "\t",
430                       "\tvar tr = ((Gtk.TreeListRow)item).get_item();",
431                       "\t//GLib.debug(\"filter %s\", tr.get_type().name());",
432                       "\tvar j =  (JsRender.JsRender) tr;",
433                       "\tif (j.xtype == \"Gtk\") {",
434                       "\t\treturn true;",
435                       "\t}",
436                       "\tif (j.xtype != \"Dir\") {",
437                       "\t\treturn j.path.has_suffix(\".vala\") ||  j.path.has_suffix(\".c\");",
438                       "\t}",
439                       "\t// dirs..",
440                       "\t ",
441                       "\tfor (var i =0 ; i < j.childfiles.n_items; i++) {",
442                       "\t\tvar f = (JsRender.JsRender) j.childfiles.get_item(i);",
443                       "\t\tif (f.xtype == \"Gtk\") {",
444                       "\t\t\treturn true;",
445                       "\t\t}",
446                       "\t\tif (f.path.has_suffix(\".vala\") ||  f.path.has_suffix(\".c\")) {",
447                       "\t\t\treturn true;",
448                       "\t\t}",
449                       "\t}",
450                       "\treturn false;",
451                       "",
452                       "}"
453                      ],
454                      "xtype" : "CustomFilter"
455                     }
456                    ],
457                    "xtype" : "FilterListModel"
458                   }
459                  ],
460                  "xtype" : "SingleSelection"
461                 },
462                 {
463                  "$ xns" : "Gtk",
464                  "* init" : [
465                   "{",
466                   "\t this.el.set_sorter(  new Gtk.StringSorter(",
467                   "\t \tnew Gtk.PropertyExpression(typeof(JsRender.JsRender), null, \"name\")",
468                   " \t));",
469                   "\t\t;",
470                   "\t\t",
471                   "}",
472                   ""
473                  ],
474                  "* pack" : "append_column",
475                  "bool expand" : true,
476                  "bool resizable" : true,
477                  "id" : "name",
478                  "items" : [
479                   {
480                    "$ xns" : "Gtk",
481                    "* prop" : "factory",
482                    "listeners" : {
483                     "bind" : [
484                      "(listitem) => {",
485                      "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
486                      "\t",
487                      "\t",
488                      "\t",
489                      "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
490                      "\tvar expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();",
491                      "\t  ",
492                      " ",
493                      "\tvar lbl = (Gtk.Label) expand.child;",
494                      "\t",
495                      "\t if (lbl.label != \"\") { // do not update",
496                      "\t \treturn;",
497                      " \t}",
498                      "\t",
499                      "",
500                      "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
501                      "\tvar jr = (JsRender.JsRender) lr.get_item();",
502                      "\t//GLib.debug(\"change  %s to %s\", lbl.label, np.name);",
503                      "\tlbl.label = jr.name; // for dir's we could hsow the sub path..",
504                      "\tlbl.tooltip_markup = jr.path;",
505                      "\t ",
506                      "    expand.set_hide_expander(  jr.childfiles.n_items < 1);",
507                      " \texpand.set_list_row(lr);",
508                      " ",
509                      "  \texpand.set_hide_expander(  jr.xtype != \"Dir\" );",
510                      " \t expand.set_list_row(lr);",
511                      " ",
512                      " \t// bind image...",
513                      " \t",
514                      "}",
515                      ""
516                     ],
517                     "setup" : [
518                      "(listitem) => {",
519                      "\t",
520                      "\tvar expand = new Gtk.TreeExpander();",
521                      "\t ",
522                      "\texpand.set_indent_for_depth(true);",
523                      "\texpand.set_indent_for_icon(true);",
524                      "\t ",
525                      "\tvar lbl = new Gtk.Label(\"\");",
526                      "\tlbl.use_markup = true;",
527                      "\t",
528                      "\t",
529                      " \tlbl.justify = Gtk.Justification.LEFT;",
530                      " \tlbl.xalign = 0;",
531                      "",
532                      " ",
533                      "\texpand.set_child(lbl);",
534                      "\t((Gtk.ListItem)listitem).set_child(expand);",
535                      "\t((Gtk.ListItem)listitem).activatable = false;",
536                      "}",
537                      ""
538                     ]
539                    },
540                    "xtype" : "SignalListItemFactory"
541                   }
542                  ],
543                  "string title" : "Other Files",
544                  "xtype" : "ColumnViewColumn"
545                 },
546                 {
547                  "$ xns" : "Gtk",
548                  "* pack" : "append_column",
549                  "items" : [
550                   {
551                    "$ xns" : "Gtk",
552                    "* prop" : "factory",
553                    "listeners" : {
554                     "bind" : [
555                      "(listitem) => {",
556                      "\t //GLib.debug(\"listitme is is %s\", ((Gtk.ListItem)listitem).get_type().name());",
557                      "\t",
558                      "\t",
559                      "\t",
560                      "\t//var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();",
561                      "\tvar btn = (Gtk.CheckButton)  ((Gtk.ListItem)listitem).get_child();",
562                      "\t  ",
563                      " ",
564                      "\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
565                      "\tvar jr = (JsRender.JsRender) lr.get_item();",
566                      "\t//GLib.debug(\"change  %s to %s\", lbl.label, np.name);",
567                      "",
568                      "\t//btn.active = jr.compile_group_selected;",
569                      "\tbtn.active = _this.selected_target.has_file(jr);",
570                      "\t",
571                      " \t//jr.bind_property(\"compile_group_selected\",",
572                      "    //                btn, \"active\",",
573                      "    //               GLib.BindingFlags.BIDIRECTIONAL); ",
574                      " \t// bind image...",
575                      " \t",
576                      "}"
577                     ],
578                     "setup" : [
579                      "(listitem) => {",
580                      "",
581                      "\tvar btn = new Gtk.CheckButton();",
582                      " ",
583                      "\t((Gtk.ListItem)listitem).set_child(btn);",
584                      "\t",
585                      "\tbtn.toggled.connect(() =>  {",
586                      "\t \tif (_this.cg_loading) {",
587                      "\t \t\treturn;",
588                      " \t\t}",
589                      "\t\tvar lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();",
590                      "\t\tvar jr = (JsRender.JsRender) lr.get_item();",
591                      "\t\tjr.compile_group_selected = btn.active;",
592                      "\t\t",
593                      "\t\t",
594                      "\t});",
595                      "}",
596                      ""
597                     ]
598                    },
599                    "xtype" : "SignalListItemFactory"
600                   }
601                  ],
602                  "string title" : "use",
603                  "xtype" : "ColumnViewColumn"
604                 }
605                ],
606                "xtype" : "ColumnView"
607               }
608              ],
609              "xtype" : "ScrolledWindow"
610             }
611            ],
612            "xtype" : "Box"
613           },
614           {
615            "$ xns" : "Gtk",
616            "* prop" : "start_child",
617            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
618            "int spacing" : 0,
619            "items" : [
620             {
621              "$ xns" : "Gtk",
622              "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
623              "bool hexpand" : true,
624              "int spacing" : 0,
625              "items" : [
626               {
627                "$ xns" : "Gtk",
628                "bool hexpand" : true,
629                "listeners" : {
630                 "clicked" : [
631                  "()  => {",
632                  "    ",
633                  "       if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {",
634                  "        return;",
635                  "    }",
636                  "    var cg = new Project.GtkValaSettings(_this.project, \"NEW GROUP\");",
637                  "    _this.project.compilegroups.set(cg.name, cg);",
638                  "     _this.project.loadTargetsIntoStore(_this.target_model.el);",
639                  "     //  select it.. ?? should load it??",
640                  "     for(var i =0;i < _this.target_model.el.n_items; i++) {",
641                  "     \tvar ncg = (Project.GtkValaSettings) _this.target_model.el.get_item(i);",
642                  "     \tif (ncg.name == cg.name) {",
643                  "     \t\t_this.target_sel.el.selected = i;",
644                  "     \t\t_this.target_sel.selectTarget(cg);",
645                  "     \t\tbreak;",
646                  " \t\t}",
647                  "\t} ",
648                  "\t",
649                  "\t",
650                  "\t ",
651                  "}"
652                 ]
653                },
654                "utf8 label" : "Add Compile Target",
655                "xtype" : "Button"
656               },
657               {
658                "$ xns" : "Gtk",
659                "bool hexpand" : true,
660                "listeners" : {
661                 "clicked" : [
662                  "()  => {",
663                  "    // load the new values.",
664                  "\tif (_this.target_sel.el.selected == Gtk.INVALID_LIST_POSITION) {",
665                  "\t\tGLib.debug(\"nothing selected\");",
666                  "\t\treturn;",
667                  "\t}",
668                  "\t",
669                  "\t ",
670                  "\t// add the directory..",
671                  "\tvar cg = (Project.GtkValaSettings) _this.target_model.el.get_item(_this.target_sel.el.selected);",
672                  "\t ",
673                  "\t ",
674                  "\tGLib.debug(\"remove: %s\\n\", cg.name);",
675                  "\tif (!_this.project.compilegroups.unset(cg.name)) {",
676                  "\t\tGLib.debug(\"remove failed\");",
677                  "\t}",
678                  " \t_this.project.loadTargetsIntoStore(_this.target_model.el);",
679                  "}"
680                 ]
681                },
682                "utf8 label" : "Remove Target",
683                "xtype" : "Button"
684               }
685              ],
686              "xtype" : "Box"
687             },
688             {
689              "$ xns" : "Gtk",
690              "* init" : [
691               "{  ",
692               "this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
693               "",
694               "}",
695               ""
696              ],
697              "bool vexpand" : true,
698              "items" : [
699               {
700                "$ xns" : "Gtk",
701                "* prop" : "child",
702                "items" : [
703                 {
704                  "$ xns" : "Gtk",
705                  "* prop" : "model",
706                  "id" : "target_sel",
707                  "items" : [
708                   {
709                    "$ xns" : "GLib",
710                    "* prop" : "model",
711                    "GLib.Type item_type" : "typeof(Project.GtkValaSettings)",
712                    "id" : "target_model",
713                    "xtype" : "ListStore"
714                   }
715                  ],
716                  "listeners" : {
717                   "selection_changed" : [
718                    "(position, n_items) => {",
719                    "",
720                    "\t ",
721                    "\t// load the new values.",
722                    "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
723                    "\t\tthis.selectTarget(null);",
724                    "\t\treturn;",
725                    "\t}",
726                    "\tthis.selectTarget(null);",
727                    "\t",
728                    " ",
729                    "",
730                    "\t// add the directory..",
731                    "\tvar cg = (Project.GtkValaSettings) _this.target_model.el.get_item(this.el.selected);",
732                    "\t",
733                    "\tthis.selectTarget(cg);",
734                    "   ",
735                    "}",
736                    ""
737                   ]
738                  },
739                  "xtype" : "SingleSelection",
740                  "| void selectTarget" : [
741                   "(Project.GtkValaSettings? cg) {",
742                   "// load the new values",
743                   "\t _this.selected_target = cg;  ",
744                   "\t _this.project.active_cg = cg;",
745                   "\t ",
746                   "",
747                   "\tif (cg == null) {",
748                   "\t\t ",
749                   "\t\t_this.set_vbox.el.hide();\t",
750                   "\t\t_this.set_vboxb.el.hide();\t",
751                   "\t\treturn;",
752                   "\t}",
753                   "\t",
754                   "\t",
755                   "\t_this.set_vbox.el.show();",
756                   "\t_this.set_vboxb.el.show();",
757                   "\t// add the directory..",
758                   " ",
759                   "\t ",
760                   "\t GLib.debug(\"loading dirs into project list\");",
761                   "\t cg.loading_ui = true;",
762                   "\t _this.cg_loading = true;",
763                   "",
764                   "\t  _this.treeview.el.set_model(new Gtk.SingleSelection(null));",
765                   "\t  _this.project.loadDirsIntoStore(_this.treemodel.el);",
766                   " \t  _this.treeview.el.set_model(_this.treeselmodel.el);",
767                   "\t  ",
768                   "\t cg.loading_ui = false;",
769                   "\t ",
770                   "\t _this.cg_loading = false;",
771                   "\t GLib.debug(\"Set name to %s\", cg.name);",
772                   "\t ",
773                   " \t_this.build_name.el.buffer.set_text(cg.name.data);",
774                   " \t_this.build_as_library.el.active = cg.is_library;",
775                   " ",
776                   "\t_this.build_execute_args.el.buffer.set_text(  cg.execute_args.data );",
777                   " ",
778                   "}",
779                   ""
780                  ]
781                 },
782                 {
783                  "$ xns" : "Gtk",
784                  "* pack" : "append_column",
785                  "bool expand" : true,
786                  "items" : [
787                   {
788                    "$ xns" : "Gtk",
789                    "* prop" : "factory",
790                    "listeners" : {
791                     "bind" : [
792                      "(listitem) => {",
793                      " ",
794                      "\tvar lbl = (Gtk.Label)  ((Gtk.ListItem)listitem).get_child();",
795                      "\t   ",
796                      "\tvar item = (Project.GtkValaSettings)  ((Gtk.ListItem)listitem).get_item();",
797                      "",
798                      "\titem.bind_property(\"name\",",
799                      "                lbl, \"label\",",
800                      "           GLib.BindingFlags.SYNC_CREATE);",
801                      "",
802                      "\t  ",
803                      "}",
804                      ""
805                     ],
806                     "setup" : [
807                      "(item) => {",
808                      "\t//var j = (JsRender.JsRender) item;",
809                      "\tvar gi = (Gtk.ListItem)item;",
810                      "\t ",
811                      "\tvar lbl = new Gtk.Label(\"\");",
812                      "\tlbl.halign = Gtk.Align.START;",
813                      "\tgi.set_child(lbl);",
814                      "",
815                      "",
816                      "",
817                      "}",
818                      ""
819                     ]
820                    },
821                    "xtype" : "SignalListItemFactory"
822                   }
823                  ],
824                  "string title" : "Build Target",
825                  "xtype" : "ColumnViewColumn"
826                 }
827                ],
828                "xtype" : "ColumnView"
829               }
830              ],
831              "xtype" : "ScrolledWindow"
832             },
833             {
834              "$ xns" : "Gtk",
835              "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
836              "id" : "set_vboxb",
837              "int spacing" : 0,
838              "items" : [
839               {
840                "$ xns" : "Gtk",
841                "utf8 label" : "Build Name (executable name)",
842                "xtype" : "Label"
843               },
844               {
845                "# bool in_insert" : false,
846                "$ xns" : "Gtk",
847                "* init" : [
848                 "",
849                 "var ed = (this.el.get_delegate() as Gtk.Editable);",
850                 "if (ed != null) {",
851                 "\ted.insert_text.connect((text, length, ref position) => {",
852                 "\t\tif (this.in_insert) {",
853                 "\t\t\treturn;",
854                 "\t\t}",
855                 "\t\tGLib.debug(\"got insert text %s\", text);",
856                 "\t\t",
857                 "\t\tvar nt = \"\";",
858                 "\t\tfor(var i = 0;i < text.length; i++){ ",
859                 "\t\t\tif (Posix.isupper(text[i]) ||Posix.islower(text[i])  ) {",
860                 "\t\t\t\tnt +=  text[i].to_string();",
861                 "\t\t\t}\t",
862                 "\t\t}",
863                 "\t\tif (nt.length < 1) {",
864                 "\t\t\tGLib.Signal.stop_emission_by_name(ed, \"insert_text\");",
865                 "\t\t\treturn;",
866                 "\t\t}",
867                 "",
868                 "\t\tthis.in_insert = true;",
869                 "\t ",
870                 "\t\tthis.el.insert_text(nt,nt.length, ref position);",
871                 "\t\tthis.in_insert = false;",
872                 "\t\tGLib.Signal.stop_emission_by_name(ed, \"insert_text\");",
873                 "\t});",
874                 "",
875                 "}"
876                ],
877                "id" : "build_name",
878                "listeners" : {
879                 "changed" : [
880                  "()  => {",
881                  "\tif (_this.selected_target == null) {",
882                  "\t\treturn;",
883                  "\t}",
884                  "\tvar name = this.el.text;",
885                  "\t// name ischanging.. probably always..",
886                  "\tif (_this.selected_target.name != name) {",
887                  "\t\t_this.project.compilegroups.unset(_this.selected_target.name);",
888                  "\t\t_this.project.compilegroups.set(name, _this.selected_target);",
889                  "\t}",
890                  "",
891                  "\t_this.selected_target.name = this.el.buffer.text;",
892                  "}"
893                 ],
894                 "insert_text" : [
895                  "(text, length, ref position) => {",
896                  "\tif (this.in_insert) {",
897                  "\t\treturn;",
898                  "\t}",
899                  "\tGLib.debug(\"got insert text %s\", text);",
900                  "\t",
901                  "\tvar nt = \"\";",
902                  "\tfor(var i = 0;i < text.length; i++){ ",
903                  "\t\tif (Posix.isalpha(text[i])) {",
904                  "\t\t\tnt +=  text[i].to_string();",
905                  "\t\t}\t",
906                  "\t}",
907                  "\tif (nt.length < 1) {",
908                  "\t\treturn;",
909                  "\t}",
910                  "",
911                  "\tthis.in_insert = true;",
912                  " ",
913                  "\tthis.el.insert_text(text,length, ref position);",
914                  "\tthis.in_insert = false;",
915                  "}",
916                  ""
917                 ]
918                },
919                "xtype" : "Entry"
920               },
921               {
922                "$ xns" : "Gtk",
923                "utf8 label" : "test argments - when run after a build",
924                "xtype" : "Label"
925               },
926               {
927                "$ xns" : "Gtk",
928                "id" : "build_execute_args",
929                "listeners" : {
930                 "changed" : [
931                  "() => {",
932                  "    if (_this.selected_target == null) {",
933                  "        return;",
934                  "    }",
935                  "    _this.selected_target.execute_args = this.el.buffer.text;",
936                  "    ",
937                  "}"
938                 ]
939                },
940                "string placeholder_text" : "eg.  -f somefile -g ",
941                "xtype" : "Entry"
942               },
943               {
944                "$ xns" : "Gtk",
945                "id" : "build_as_library",
946                "listeners" : {
947                 "notify[\"active\"]" : [
948                  "() => {",
949                  "    if (_this.selected_target == null) {",
950                  "        return;",
951                  "    }",
952                  "    _this.selected_target.is_library = this.el.active;",
953                  "    ",
954                  "}",
955                  ""
956                 ]
957                },
958                "string label" : "build as library",
959                "xtype" : "CheckButton"
960               }
961              ],
962              "xtype" : "Box"
963             }
964            ],
965            "xtype" : "Box"
966           }
967          ],
968          "xtype" : "Paned"
969         }
970        ],
971        "xtype" : "Notebook"
972       },
973       {
974        "$ Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
975        "$ xns" : "Gtk",
976        "bool hexpand" : true,
977        "int margin_bottom" : 4,
978        "int margin_end" : 4,
979        "int margin_start" : 4,
980        "int margin_top" : 4,
981        "items" : [
982         {
983          "$ xns" : "Gtk",
984          "listeners" : {
985           "clicked" : [
986            "() => { ",
987            "",
988            "  _this.done = true;",
989            "    _this.el.hide(); ",
990            "}"
991           ]
992          },
993          "string label" : "Cancel",
994          "xtype" : "Button"
995         },
996         {
997          "$ xns" : "Gtk",
998          "bool hexpand" : true,
999          "string label" : "",
1000          "xtype" : "Label"
1001         },
1002         {
1003          "$ xns" : "Gtk",
1004          "css_classes" : "{ \"suggested-action\" }",
1005          "id" : "save_btn",
1006          "listeners" : {
1007           "clicked" : [
1008            "( ) =>  { ",
1009            "",
1010            " ",
1011            "_this.project.save(); ",
1012            " ",
1013            "\t// what about .js ?",
1014            "_this.done = true;",
1015            "_this.el.hide();",
1016            "if (_this.doneObj != null) {",
1017            "\t_this.doneObj.call(_this.project);",
1018            "}",
1019            " ",
1020            "   ",
1021            "}"
1022           ]
1023          },
1024          "string label" : "Save",
1025          "xtype" : "Button"
1026         }
1027        ],
1028        "xtype" : "Box"
1029       }
1030      ],
1031      "xtype" : "Box"
1032     }
1033    ],
1034    "listeners" : {
1035     "close_request" : [
1036      "( ) => {",
1037      "\tif (!this.done) {",
1038      "\t\treturn true;",
1039      "\t}",
1040      "\treturn false;",
1041      "\t",
1042      "}",
1043      ""
1044     ],
1045     "hide" : [
1046      "() => {",
1047      "\t  if (!this.done) {",
1048      "    _this.el.show();",
1049      "  }",
1050      "}"
1051     ]
1052    },
1053    "uint border_width" : 0,
1054    "xtype" : "Window",
1055    "| void save" : [
1056     "()  {",
1057     "    this.project.save(); ",
1058     "}"
1059    ],
1060    "| void show" : [
1061     "(Gtk.Window pwin, Project.Gtk project, Project.Callback? doneObj) {",
1062     "     ",
1063     "    //print(\"ValaProjectSettings show\\n\");",
1064     "    this.doneObj = doneObj;",
1065     "    this.project=  project;",
1066     "\t ",
1067     "    this.compile_flags.el.buffer.set_text(",
1068     "    \tproject.compile_flags.data",
1069     "\t);",
1070     "   this.version.el.buffer.set_text(",
1071     "    \tproject.version.data",
1072     "\t);",
1073     "\t  this.licence.el.buffer.set_text(",
1074     "    \tproject.licence.data",
1075     "\t); ",
1076     "    project.loadVapiIntoStore(_this.vapimodel.el);",
1077     "     GLib.Timeout.add(500, () => {",
1078     " \t\t this.vapi_scroll.el.vadjustment.value  = 0;\t ",
1079     "\t     return false;",
1080     "     });",
1081     "    ",
1082     "   ",
1083     " \t",
1084     " \tproject.loadTargetsIntoStore(this.target_model.el);",
1085     "\t",
1086     " \t_this.target_sel.el.selected = Gtk.INVALID_LIST_POSITION;",
1087     "\t_this.target_sel.selectTarget(null);",
1088     "//\tGtk.Allocation rect;",
1089     "\t//btn.get_allocation(out rect);",
1090     " //   this.el.set_pointing_to(rect);",
1091     " this.el.application = pwin.application; // ??? make it modal?",
1092     "\t this.el.set_transient_for(pwin);",
1093     "\t ",
1094     "\t// window + header?",
1095     "\t// print(\"SHOWALL - POPIP\\n\");",
1096     "\tthis.el.set_size_request(800,800);",
1097     "\tthis.el.show();",
1098     "\tthis.notebook.el.page = 0; // first page.",
1099     "\t",
1100     "\t//this.view.el.grab_focus();",
1101     "",
1102     "}",
1103     ""
1104    ]
1105   }
1106  ],
1107  "name" : "ValaProjectSettingsPopover"
1108 }