Fix #7959 - new project flow - use void func to callback after each step, tidy up...
[roobuilder] / src / Builder4 / PopoverFileDetails.bjs
1 {
2  "build_module" : "builder",
3  "gen_extended" : false,
4  "items" : [
5   {
6    "# JsRender.JsRender file" : "null",
7    "# Project.Project project" : "",
8    "# bool new_window" : true,
9    "$ xns" : "Gtk",
10    "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
11    "Xcls_MainWindow mainwindow" : "null",
12    "bool done" : false,
13    "bool is_new" : true,
14    "bool modal" : true,
15    "id" : "PopoverFileDetails",
16    "items" : [
17     {
18      "$ pack" : "add",
19      "$ xns" : "Gtk",
20      "* pack" : "set_child",
21      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
22      "bool hexpand" : true,
23      "bool homogeneous" : false,
24      "int margin_bottom" : 4,
25      "int margin_end" : 4,
26      "int margin_start" : 4,
27      "int margin_top" : 4,
28      "items" : [
29       {
30        "$ xns" : "Gtk",
31        "* columns" : 2,
32        "* pack" : "append",
33        "bool hexpand" : true,
34        "id" : "grid",
35        "int column_spacing" : 4,
36        "int margin_end" : 4,
37        "int margin_start" : 4,
38        "items" : [
39         {
40          "$ justify" : "Gtk.Justification.RIGHT",
41          "$ xns" : "Gtk",
42          "id" : "filetype_lbl",
43          "label" : "File type",
44          "x_options" : 4,
45          "xalign" : 0.90000000000000002,
46          "xtype" : "Label"
47         },
48         {
49          "$ xns" : "Gtk",
50          "bool hexpand" : true,
51          "id" : "filetype",
52          "items" : [
53           {
54            "$ xns" : "Gtk",
55            "* prop" : "model",
56            "id" : "filetype_model",
57            "strings" : "{}",
58            "xtype" : "StringList",
59            "| void load" : [
60             "() {",
61             "    var el = this.el;",
62             "    ",
63             "    while (el.get_n_items() > 0) {",
64             "    \tel.remove(0);",
65             "\t}",
66             " \tel.append(\"bjs - User Interface File\");",
67             " ",
68             "    ",
69             " switch(_this.project.xtype) {",
70             " \tcase \"Roo\":",
71             " \t \tel.append(\"js - Javascript File\");",
72             " \t \tel.append(\"css - CSS File\");",
73             " \t \tel.append(\"php - Javascript File\");",
74             " \t \t",
75             "\t\tbreak;",
76             "",
77             "\tcase \"Gtk\":\t\t",
78             "\t\t\t",
79             " \t \tel.append(\"vala - Vala File\");",
80             " \t \tel.append(\"css - CSS File\");",
81             " \t \tel.append(\"other - Other Type\");",
82             " \t \tbreak;",
83             " \t default : ",
84             " \t \tbreak;",
85             "\t}",
86             "",
87             "\t",
88             "\t",
89             "\t",
90             "}"
91            ]
92           }
93          ],
94          "listeners" : {
95           "notify[\"selected\"]" : [
96            "() => {",
97            "",
98            " ",
99            "  ",
100            "    // directory is only available for non-bjs ",
101            "    this.showhide( );",
102            "",
103            " }"
104           ]
105          },
106          "xtype" : "DropDown",
107          "| string getValue" : [
108           "() {",
109           "\t",
110           "\tif (!_this.is_new) {",
111           "\t\treturn _this.file.xtype != \"Plainfile\" ? \"bjs\" :  _this.file.file_ext;",
112           "\t}",
113           "\t",
114           "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
115           "\t\treturn \"\";",
116           "\t}",
117           "\t",
118           "\treturn _this.filetype_model.el.get_string(this.el.selected).split(\" \")[0];",
119           "}"
120          ],
121          "| void setValue" : [
122           "(string cur) {",
123           "\tvar el  = _this.filetype_model.el;",
124           "\tfor(var i= 0; i < el.get_n_items();i++)  {",
125           "\t\tif (el.get_string(i).has_prefix(cur)) {",
126           "\t\t\tthis.el.selected = i;",
127           "\t\t\tbreak;",
128           "\t\t}",
129           "\t}",
130           "}"
131          ],
132          "| void showhide" : [
133           "()   {",
134           "\t ",
135           "",
136           "\t_this.path_lbl.el.hide();",
137           "    _this.path.el.hide();",
138           "    ",
139           "    ",
140           "    _this.name_lbl.el.hide();",
141           "    _this.name.el.hide();",
142           "    ",
143           "    _this.dir_dropdown_lbl.el.hide();",
144           "    _this.dir_dropdown.el.hide();",
145           "\t",
146           "\t_this.title_lbl.el.hide();",
147           "\t_this.title.el.hide();",
148           "\t",
149           "\t_this.region_lbl.el.hide();",
150           "\t_this.region.el.hide();",
151           "\t",
152           "\t_this.parent_lbl.el.hide();",
153           "\t_this.parent.el.hide();",
154           "\t",
155           "\t_this.permname_lbl.el.hide();",
156           "\t_this.permname.el.hide();",
157           "\t",
158           "\t_this.modOrder_lbl.el.hide();",
159           "\t_this.modOrder.el.hide();",
160           "\t",
161           "\t_this.build_module_lbl.el.hide();",
162           "\t_this.build_module.el.hide();",
163           "\t",
164           "\t_this.gen_lbl.el.hide();",
165           "\t_this.gen.el.hide();",
166           "\t",
167           "  ",
168           "\tvar sel = this.getValue();",
169           "",
170           "\tGLib.debug(\"showhide is new ? %s / sel = '%s'\" , _this.is_new ? \"YES\" :\"NO\", sel); ",
171           "\t",
172           "    if (_this.is_new) {",
173           "\t\tif (sel == \"\" &&  _this.project.xtype == \"Gtk\") {",
174           "\t\t\treturn;",
175           "\t\t}",
176           "\t\t ",
177           "\t  ",
178           "        _this.dir_dropdown_lbl.el.show();",
179           "\t    _this.dir_dropdown.el.show();",
180           "\t    ",
181           "        _this.name_lbl.el.show();",
182           "    \t_this.name.el.show();",
183           "",
184           "\t    ",
185           "\t    ",
186           "    }   else {",
187           "        _this.path.el.set_text(_this.file.relpath);",
188           "    }",
189           "    ",
190           "\t",
191           "\t",
192           "\t",
193           "\tswitch(_this.project.xtype) {",
194           "\t\tcase \"Roo\":",
195           "\t\t \t",
196           "\t\t\tif (sel == \"bjs\") {",
197           "\t\t\t\t_this.title_lbl.el.show();",
198           "\t\t\t\t_this.title.el.show();",
199           "\t\t\t\t",
200           "\t\t\t\t_this.region_lbl.el.show();",
201           "\t\t\t\t_this.region.el.show();",
202           "\t\t\t\t",
203           "\t\t\t\t_this.parent_lbl.el.show();",
204           "\t\t\t\t_this.parent.el.show();",
205           "\t\t\t\t",
206           "\t\t\t\t_this.permname_lbl.el.show();",
207           "\t\t\t\t_this.permname.el.show();",
208           "\t\t\t\t",
209           "\t\t\t\t_this.modOrder_lbl.el.show();",
210           "\t\t\t\t_this.modOrder.el.show();",
211           "\t\t\t",
212           "\t\t\t}",
213           "\t\t\t_this.build_module_model.load(null);",
214           "\t\t ",
215           "\t\t\t",
216           "\t\t\tbreak;",
217           "\t\tdefault: // vala..",
218           "\t\t",
219           "\t \t\t_this.build_module_lbl.el.show();",
220           "\t\t\t_this.build_module.el.show();",
221           "\t",
222           "\t\t\t ",
223           "\t\t\t",
224           "\t\t\tif (sel == \"bjs\" || sel == \"vala\") {",
225           "\t\t\t\t _this.project.loadDirsToStringList(_this.dir_model.el, \"/src\");",
226           "\t\t\t\t _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
227           "\t\t        _this.name_lbl.el.label = \"Component Name (Filename with-out extension)\";\t\t\t\t ",
228           "\t\t        ",
229           "\t\t        if (sel == \"bjs\") {",
230           "\t\t\t        _this.gen_lbl.el.show();",
231           "\t\t\t        _this.gen.el.show();",
232           "\t\t        }",
233           "\t\t        ",
234           "\t\t        ",
235           "\t\t        ",
236           "\t\t\t} else {",
237           "\t\t        _this.project.loadDirsToStringList(_this.dir_model.el, \"\");",
238           "\t\t        _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
239           "\t\t        _this.name_lbl.el.label = \"File Name (with extension)\";",
240           "\t        }",
241           "\t\t\tbreak;",
242           "\t}",
243           " ",
244           "    // load up the directories",
245           "    //??? why can we not create bjs files in other directories??",
246           "\t//if (!is_bjs && _this.file.path.length < 1) {",
247           "\t",
248           " ",
249           "\t\t",
250           "\t\t",
251           "\t//}",
252           "   ",
253           "    ",
254           "}",
255           ""
256          ]
257         },
258         {
259          "$ justify" : "Gtk.Justification.RIGHT",
260          "$ visible" : true,
261          "$ xns" : "Gtk",
262          "id" : "dir_dropdown_lbl",
263          "label" : "Create File in this Directory",
264          "x_options" : 4,
265          "xalign" : 0.90000000000000002,
266          "xtype" : "Label"
267         },
268         {
269          "$ xns" : "Gtk",
270          "id" : "dir_dropdown",
271          "int colspan" : 1,
272          "items" : [
273           {
274            "$ xns" : "Gtk",
275            "* prop" : "model",
276            "id" : "dir_model",
277            "strings" : "{}",
278            "xtype" : "StringList"
279           }
280          ],
281          "xtype" : "DropDown",
282          "| string getValue" : [
283           "() {",
284           "\treturn _this.dir_model.el.get_string(this.el.selected);",
285           "}"
286          ]
287         },
288         {
289          "$ justify" : "Gtk.Justification.RIGHT",
290          "$ xns" : "Gtk",
291          "id" : "name_lbl",
292          "label" : "Component Name (File name without extension)",
293          "x_options" : 4,
294          "xalign" : 0.90000000000000002,
295          "xtype" : "Label"
296         },
297         {
298          "$ visible" : true,
299          "$ xns" : "Gtk",
300          "bool hexpand" : true,
301          "id" : "name",
302          "xtype" : "Entry"
303         },
304         {
305          "$ justify" : "Gtk.Justification.RIGHT",
306          "$ visible" : true,
307          "$ xns" : "Gtk",
308          "id" : "title_lbl",
309          "label" : "Title",
310          "x_options" : 4,
311          "xalign" : 0.90000000000000002,
312          "xtype" : "Label"
313         },
314         {
315          "$ visible" : true,
316          "$ xns" : "Gtk",
317          "* pack" : "attach,1,2,1,1",
318          "bool hexpand" : true,
319          "id" : "title",
320          "xtype" : "Entry"
321         },
322         {
323          "$ justify" : "Gtk.Justification.RIGHT",
324          "$ visible" : true,
325          "$ xns" : "Gtk",
326          "id" : "region_lbl",
327          "label" : "Region",
328          "tooltip_text" : "center, north, south, east, west",
329          "x_options" : 4,
330          "xalign" : 0.90000000000000002,
331          "xtype" : "Label"
332         },
333         {
334          "$ visible" : true,
335          "$ xns" : "Gtk",
336          "bool hexpand" : true,
337          "id" : "region",
338          "xtype" : "Entry"
339         },
340         {
341          "$ justify" : "Gtk.Justification.RIGHT",
342          "$ visible" : true,
343          "$ xns" : "Gtk",
344          "id" : "parent_lbl",
345          "label" : "Parent Name",
346          "x_options" : 4,
347          "xalign" : 0.90000000000000002,
348          "xtype" : "Label"
349         },
350         {
351          "$ visible" : true,
352          "$ xns" : "Gtk",
353          "id" : "parent",
354          "xtype" : "Entry"
355         },
356         {
357          "$ justify" : "Gtk.Justification.RIGHT",
358          "$ visible" : true,
359          "$ xns" : "Gtk",
360          "id" : "permname_lbl",
361          "label" : "Permission Name",
362          "x_options" : 4,
363          "xalign" : 0.90000000000000002,
364          "xtype" : "Label"
365         },
366         {
367          "$ visible" : true,
368          "$ xns" : "Gtk",
369          "id" : "permname",
370          "xtype" : "Entry"
371         },
372         {
373          "$ justify" : "Gtk.Justification.RIGHT",
374          "$ visible" : true,
375          "$ xns" : "Gtk",
376          "id" : "modOrder_lbl",
377          "label" : "Order (for tabs)",
378          "x_options" : 4,
379          "xalign" : 0.90000000000000002,
380          "xtype" : "Label"
381         },
382         {
383          "$ visible" : true,
384          "$ xns" : "Gtk",
385          "id" : "modOrder",
386          "xtype" : "Entry"
387         },
388         {
389          "$ justify" : "Gtk.Justification.RIGHT",
390          "$ visible" : true,
391          "$ xns" : "Gtk",
392          "id" : "build_module_lbl",
393          "label" : "Module to build",
394          "x_options" : 4,
395          "xalign" : 0.90000000000000002,
396          "xtype" : "Label"
397         },
398         {
399          "$ xns" : "Gtk",
400          "id" : "build_module",
401          "items" : [
402           {
403            "$ xns" : "Gtk",
404            "* prop" : "model",
405            "id" : "build_module_model",
406            "strings" : "{}",
407            "xtype" : "StringList",
408            "| void load" : [
409             "(Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)",
410             "{",
411             "\t",
412             "\t_this.build_module.el.hide();",
413             "\t\t_this.build_module_lbl.el.hide();",
414             "\tvar el = _this.build_module_model.el;",
415             "\t while (el.get_n_items() > 0) {",
416             "\t\t\tel.remove(0);",
417             "\t}",
418             "\t",
419             "\tif (compilegroups == null) {",
420             "\t\treturn;",
421             "\t}",
422             "\tforeach(var k in compilegroups.keys) {",
423             "\t\tthis.el.append(k);",
424             "\t}",
425             "\tif (compilegroups.keys.size > 0) {",
426             "\t\t_this.build_module.el.selected = 0;",
427             "\t\t_this.build_module.el.show();",
428             "\t\t_this.build_module_lbl.el.show();",
429             "\t} else {",
430             "\t\t",
431             "\t}",
432             "\t",
433             "}"
434            ]
435           }
436          ],
437          "xtype" : "DropDown",
438          "| string getValue" : [
439           " ",
440           "() {",
441           "\tif (this.el.selected < 0) {",
442           "\t\treturn \"\";",
443           "\t}",
444           "\t",
445           "\treturn _this.build_module_model.el.get_string(this.el.selected);",
446           "}",
447           " "
448          ],
449          "| void setValue" : [
450           "(string str) {",
451           "\tvar m = _this.build_module_model.el;",
452           "\tfor(var i = 0; i < m.get_n_items(); i++) {",
453           "\t\tif (m.get_string(i) == str) {",
454           "\t\t\tthis.el.selected = i;",
455           "\t\t\treturn;",
456           "\t\t}",
457           "\t}",
458           "\t\t",
459           "}"
460          ]
461         },
462         {
463          "$ justify" : "Gtk.Justification.RIGHT",
464          "$ visible" : true,
465          "$ xns" : "Gtk",
466          "id" : "path_lbl",
467          "int colspan" : 1,
468          "label" : "Full path",
469          "x_options" : 4,
470          "xalign" : 0.90000000000000002,
471          "xtype" : "Label"
472         },
473         {
474          "$ visible" : true,
475          "$ xns" : "Gtk",
476          "bool editable" : false,
477          "bool hexpand" : true,
478          "id" : "path",
479          "int colspan" : 1,
480          "xtype" : "Entry"
481         },
482         {
483          "$ justify" : "Gtk.Justification.RIGHT",
484          "$ visible" : true,
485          "$ xns" : "Gtk",
486          "id" : "gen_lbl",
487          "int colspan" : 1,
488          "label" : "Generate as Extended (no working)",
489          "x_options" : 4,
490          "xalign" : 0.90000000000000002,
491          "xtype" : "Label"
492         },
493         {
494          "$ xns" : "Gtk",
495          "id" : "gen",
496          "listeners" : {
497           "toggled" : [
498            "( ) => {",
499            "\t  ",
500            "\tthis.el.label = this.el.active ? \"Extended\" : \"Wrapped\";",
501            "",
502            "}",
503            ""
504           ]
505          },
506          "string label" : "Wrapped",
507          "xtype" : "CheckButton"
508         }
509        ],
510        "uint row_spacing" : 2,
511        "xtype" : "Grid",
512        "| void xhideRow" : [
513         "(int row) ",
514         "{",
515         "\tvar el = _this.grid.el.get_child_at(0,row);",
516         "",
517         "\tel.hide();",
518         "\tel = _this.grid.el.get_child_at(1,row);",
519         "\tel.hide();",
520         "",
521         "}"
522        ],
523        "| void xshowAllRows" : [
524         "() {",
525         "\tfor (var i = 2; i < 10;i++) {",
526         "\t\tvar el = _this.grid.el.get_child_at(0,i);",
527         "\t\tel.show();",
528         "\t\tel = _this.grid.el.get_child_at(1,i);",
529         "\t\tel.show();",
530         "    }",
531         "}"
532        ]
533       }
534      ],
535      "xtype" : "Box"
536     },
537     {
538      "$ xns" : "Gtk",
539      "* prop" : "titlebar",
540      "bool show_title_buttons" : false,
541      "items" : [
542       {
543        "$ xns" : "Gtk",
544        "* pack" : "pack_start",
545        "listeners" : {
546         "clicked" : [
547          "() => { ",
548          "  \t_this.done = true;",
549          "    _this.el.hide(); ",
550          "}"
551         ]
552        },
553        "string label" : "Cancel",
554        "xtype" : "Button"
555       },
556       {
557        "$ css_classes" : "{ \"suggested-action\" }",
558        "$ xns" : "Gtk",
559        "* pack" : "pack_end",
560        "bool always_show_image" : true,
561        "bool hexpand" : false,
562        "id" : "save_btn",
563        "listeners" : {
564         "clicked" : [
565          "( ) =>  { ",
566          "",
567          " ",
568          "",
569          "",
570          "\tif (_this.name.el.get_text().length  < 1) {",
571          "\t    Xcls_StandardErrorDialog.singleton().show(",
572          "\t        _this.mainwindow.el,",
573          "\t        \"You have to set a Component name \"",
574          "\t    );",
575          "\t     ",
576          "\t    return;",
577          "\t}",
578          "\t// what does this do?",
579          "\t",
580          "\tvar isNew = _this.file.name.length  > 0 ? false : true;",
581          "\t/*",
582          "\tif (!isNew && this.file.name != _this.name.el.get_text()) {",
583          "\t    Xcls_StandardErrorDialog.singleton().show(",
584          "\t        this.el,",
585          "\t        \"Sorry changing names does not work yet. \"",
586          "\t    );",
587          "\t     ",
588          "\t    return;",
589          "\t}",
590          "\t*/",
591          "\t  ",
592          "  ",
593          "\t// FIXME - this may be more complicated...",
594          "\t//for (var i in this.def) {",
595          "\t//    this.file[i] =  this.get(i).el.get_text();",
596          "\t//}",
597          "",
598          "\tif (!isNew) {",
599          "\t  //  try {",
600          "\t  ",
601          "\t  \tvar old_target = _this.file.build_module;",
602          "         _this.updateFileFromEntry();",
603          "\t    if (_this.project.xtype == \"Gtk\" && old_target != _this.file.build_module) {",
604          "\t    \tvar gp = (JsRender.Gtk)_this.file;",
605          "\t    \tgp.updateCompileGroup(old_target,  _this.file.build_module);",
606          "    \t}",
607          "",
608          "\t      _this.done = true;",
609          "\t    _this.file.save();",
610          "\t    _this.el.hide();",
611          "\t    return;",
612          "\t}",
613          "\t",
614          "\t// ---------------- NEW FILES...",
615          "\tvar ftype = _this.filetype.getValue();",
616          "",
617          "\tif (ftype == \"\") {",
618          "\t\t// should not happen...",
619          "\t\t// so we are jut going to return without ",
620          "\t\tXcls_StandardErrorDialog.singleton().show(",
621          "\t        _this.mainwindow.el,",
622          "\t        \"You must select a file type. \"",
623          "\t    );",
624          "\t    return;",
625          "\t\t ",
626          "\t}",
627          "\t",
628          "\t",
629          "\tvar fn = _this.name.el.get_text();",
630          "\t",
631          "\t ",
632          "\tvar ext = ftype;",
633          "\t//var dir = _this.project.path; ",
634          "\t ",
635          "\t var dir = _this.dir_dropdown.getValue();",
636          "\t",
637          "\t ",
638          "\t",
639          "\t ",
640          "\tvar targetfile  = _this.project.path;",
641          "\tif (dir != \"\") {",
642          "\t\ttargetfile += dir;",
643          "\t}",
644          "\ttargetfile += \"/\" + fn;",
645          "\t",
646          "\t// strip the file type off the end..",
647          "\t",
648          "\ttry {",
649          "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
650          "\t\tfn = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
651          "\t  } catch (RegexError e) {} // ignore.",
652          "\t  ",
653          "\t  targetfile += \".\" + ext;",
654          "\t  ",
655          "\t  ",
656          "\tif (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {",
657          "\t    Xcls_StandardErrorDialog.singleton().show(",
658          "\t        _this.mainwindow.el,",
659          "\t        \"That file already exists\"",
660          "\t    ); ",
661          "\t    return;",
662          "\t}",
663          "\tJsRender.JsRender f;",
664          "   try {",
665          "\t   f =  JsRender.JsRender.factory(",
666          "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\",  ",
667          "\t\t\t_this.file.project, ",
668          "\t\t\ttargetfile);",
669          "\t} catch (JsRender.Error e) {",
670          "\t\tXcls_StandardErrorDialog.singleton().show(",
671          "\t        _this.mainwindow.el,",
672          "\t        \"Error creating file\"",
673          "\t    ); ",
674          "\t\treturn;",
675          "\t}",
676          "\t_this.file = f;",
677          "\t",
678          "\t",
679          "",
680          "\t",
681          "\t_this.updateFileFromEntry();",
682          "\t_this.file.loaded = true;",
683          "\t_this.file.save();",
684          "     _this.file.project.addFile(_this.file);",
685          "\t\t ",
686          "\t ",
687          " ",
688          "\t// what about .js ?",
689          "   _this.done = true;",
690          "\t_this.el.hide();",
691          "",
692          "// hopefull this will work with bjs files..",
693          "\t",
694          "\t_this.success(_this.project, _this.file);",
695          "   ",
696          "}"
697         ]
698        },
699        "string icon_name" : "document-save",
700        "string label" : "Save",
701        "xtype" : "Button"
702       }
703      ],
704      "title" : "Add / Edit File",
705      "xtype" : "HeaderBar"
706     }
707    ],
708    "listeners" : {
709     "close_request" : [
710      "( ) => {",
711      "\t_this.el.hide();",
712      "\treturn true;",
713      "}",
714      ""
715     ]
716    },
717    "string title" : "Add / Edit File",
718    "uint border_width" : 0,
719    "xtype" : "Window",
720    "| void show" : [
721     "(JsRender.JsRender  c, Gtk.Window pwin, bool new_window) ",
722     "{",
723     "    ",
724     "    this.project = c.project;",
725     "    this.done = false;",
726     "    this.new_window = new_window;",
727     "    ",
728     "    //if (!this.el) {",
729     "        //this.init();",
730     "     //} ",
731     "     ",
732     "      this.is_new = c.name == \"\";",
733     "",
734     "    _this.name.el.set_text(c.name);",
735     "    _this.title.el.set_text(c.title);",
736     "    _this.parent.el.set_text(c.parent);    ",
737     "    _this.region.el.set_text(c.region);",
738     "    _this.modOrder.el.set_text(c.modOrder);",
739     "    _this.permname.el.set_text(c.permname);",
740     " ",
741     "   _this.gen.el.active = c.gen_extended;",
742     "   ",
743     "",
744     "    ",
745     "    if (this.project.xtype == \"Gtk\") {",
746     "    \tvar p = (Project.Gtk) this.project;",
747     "\t    this.build_module_model.load(p.compilegroups);",
748     "\t    // it will select first if available...",
749     "\t    // only for new files.",
750     "\t    if (!this.is_new) {",
751     "\t\t    this.build_module.setValue(c.build_module);",
752     "\t    }",
753     "    }",
754     "\t     ",
755     "     ",
756     "    _this.file = c;",
757     "   ",
758     "   // this.el.set_size_request( 550, 100); // should expand height, but give  a min width.",
759     "",
760     "    this.el.set_transient_for(pwin);",
761     "    ",
762     "    // window + header?",
763     "     ",
764     "    this.el.show();",
765     "   // this.name.el.grab_focus();",
766     "    ",
767     "    ",
768     "    if (!this.is_new) {",
769     "\t    this.save_btn.el.set_label(\"Save\");",
770     "\t\tthis.filetype_lbl.el.hide();",
771     "\t\tthis.filetype.el.hide();",
772     "\t\tthis.filetype.showhide(); // as we only work on bjs files currently",
773     "    } else {",
774     "    ",
775     "\t\t//_this.project.loadDirsToStringList(this.dir_model.el, \"\");",
776     "\t\t//_this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
777     "    ",
778     "        this.save_btn.el.set_label(\"Create\");",
779     "\t    this.filetype.el.show();",
780     "\t    this.filetype_lbl.el.show();",
781     "\t    this.filetype_model.load();",
782     "\t\tthis.filetype.el.selected = Gtk.INVALID_LIST_POSITION;",
783     "\t    this.filetype.showhide();",
784     "\t    ",
785     "    }",
786     "    ",
787     "    ",
788     "    //this.success = c.success;",
789     "    ",
790     "    ",
791     "}"
792    ],
793    "| void updateFileFromEntry" : [
794     "() {",
795     "",
796     "        _this.file.title = _this.title.el.get_text();",
797     "        _this.file.region = _this.region.el.get_text();            ",
798     "        _this.file.parent = _this.parent.el.get_text();                        ",
799     "        _this.file.permname = _this.permname.el.get_text();                                    ",
800     "        _this.file.modOrder = _this.modOrder.el.get_text();",
801     "        _this.file.gen_extended = _this.gen.el.active;",
802     "        var new_name =  _this.name.el.get_text();",
803     "        if (_this.file.name.length  > 0 && _this.file.name != new_name) {",
804     "            try {",
805     "            \t_this.file.renameTo( new_name );",
806     "        \t} catch (JsRender.Error e) { } // do nothing?",
807     "        }",
808     "        ",
809     "        _this.file.build_module = _this.build_module.getValue();",
810     "        ",
811     "        ",
812     "        ",
813     "",
814     "                                                    ",
815     "}    "
816    ]
817   }
818  ],
819  "name" : "PopoverFileDetails"
820 }