2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# WindowState? windowstate" : "null",
7 "$ Project.Callback doneObj" : "null",
10 "@ void canceled" : "()",
11 "Project.Project result" : "null",
13 "default_width" : 600,
17 "* prop" : "titlebar",
18 "* title" : "New Project",
19 "bool show_title_buttons" : false,
22 "$ Gtk.Align halign" : "Gtk.Align.END",
24 "* pack" : "pack_start",
25 "bool hexpand" : false,
32 "\t_this.canceled();",
42 "$ Gtk.Align halign" : "Gtk.Align.START",
43 "$ css_classes" : "{ \"suggested-action\" }",
45 "* pack" : "pack_end",
46 "bool hexpand" : false,
52 " var err_dialog = Xcls_StandardErrorDialog.singleton();",
55 " \tif (_this.ptype_dd.getValue().length < 1) {",
56 " err_dialog.show(_this.el,\"You have to set Project type\"); ",
59 " var fn = _this.parent_dd.getValue();",
60 " var is_existing = false;",
61 " var is_new_folder = false;",
62 " switch (_this.type_dd.getValue()) {",
63 "\t \tcase \"Existing Folder\":",
64 "\t\t \tif (_this.folder_dd.getValue().length < 1) {",
65 "\t\t\t\terr_dialog.show(_this.el,\"You have to set Folder\"); ",
68 "\t\t\tfn += \"/\" + _this.folder_dd.getValue();",
69 "\t\t\tis_existing = true;",
72 "\t \tcase \"New Folder\":",
73 "\t\t \tif (_this.name_entry.getValue().length < 1) {",
74 "\t\t\t\terr_dialog.show(_this.el,\"You have enter a Project Name\"); ",
77 "\t\t\tfn += \"/\" + _this.name_entry.getValue();\t ",
79 "\t\t\tif (FileUtils.test( fn ,FileTest.EXISTS)) {",
80 "\t\t\t\terr_dialog.show(_this.el,\"That folder already exists\"); ",
81 "\t\t\t\treturn;\t\t\t",
83 "\t\t\tvar dir = File.new_for_path(fn);",
85 "\t\t\t\tdir.make_directory();\t",
86 "\t\t\t} catch (Error e) {",
87 "\t\t\t\tGLib.error(\"Failed to make directory %s\", fn);",
89 "\t\t\tis_new_folder = true;",
105 " GLib.debug(\"add %s\\n\" , fn);",
107 "\t\tvar project = Project.Project.factory(_this.ptype_dd.getValue(), fn);",
108 "\t\tif (is_new_folder) {\t",
109 "\t\t\tproject.initialize();",
112 "\t\t\tproject.load();",
115 "\t\tproject.save();",
116 "\t\t Project.Project.saveProjectList();",
117 " \t\t_this.result = project;",
118 "\t\tif (is_new_folder || is_existing) {",
121 "\t \t _this.windowstate.projectPopoverShow(",
122 "\t \t \t_this.el.transient_for, project, _this.doneObj ",
125 " \t \tif (_this.doneObj != null) {",
126 "\t\t \t _this.doneObj.call(project);",
131 "\t} catch (Error e) {",
132 "\t\tGLib.debug(\"got error? %s\" , e.message);",
143 "xtype" : "HeaderBar"
146 "$ homogeneous" : false,
149 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
150 "bool expand" : true,
151 "int margin_bottom" : 10,
152 "int margin_end" : 10,
153 "int margin_start" : 10,
154 "int margin_top" : 10,
159 "int column_spacing" : 4,
160 "int margin_bottom" : 20,
161 "int row_spacing" : 4,
164 "$ Gtk.Align halign" : "Gtk.Align.START",
167 "string label" : "Create a Project from:",
171 "$ uint selected" : "Gtk.INVALID_LIST_POSITION",
179 "bool hexpand" : true,
185 "strings" : "{ \"New Folder\", \"Existing Folder\" /*, \"Checkout from git\" */ }",
186 "xtype" : "StringList"
190 "notify[\"selected\"]" : [
193 "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
196 "\tvar m = (Gtk.StringList) this.el.model;",
197 "\tGLib.debug(\"selected item: %s\", m.get_string(this.el.selected));",
199 "\t_this.hideAll();",
200 "\t_this.parent_lbl.el.show();",
201 "\t_this.parent_dd.el.show();",
202 "\t_this.parent_dd.load();",
206 " \tswitch (m.get_string(this.el.selected)) {",
207 "\t\tcase \"New Folder\":",
208 "\t\t _this.name_lbl.el.show(); ",
209 " \t\t_this.name_entry.el.show(); ",
211 "\t\tcase \"Existing Folder\":",
212 "\t\t\t_this.folder_lbl.el.show();",
213 "\t\t\t _this.folder_dd.el.show(); \t",
216 "\t\tcase \"Checkout from git\":",
217 "\t\t _this.name_lbl.el.show(); ",
218 "\t\t\t_this.name_entry.el.show(); ",
221 "\t\t\t_this.hideAll();",
237 "xtype" : "DropDown",
238 "| string getValue" : [
240 "\tvar m = (Gtk.StringList) this.el.model;",
241 "\treturn m.get_string(this.el.selected);",
247 "$ Gtk.Align halign" : "Gtk.Align.START",
250 "string label" : "In Folder:",
255 "bool hexpand" : true,
261 "strings" : "{ \"gitlive\", \"Projects\", \"Select\" }",
262 "xtype" : "StringList"
266 "notify[\"selected\"]" : [
268 "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
269 "\t\t_this.hideAll();",
270 "\t\t_this.parent_lbl.el.show();",
271 " \t_this.parent_dd.el.show(); ",
278 "\tif (this.getValue() == \"Select Folder\") {",
279 "\t\tvar fd = new Gtk.FileDialog();",
280 "\t\tfd.title = \"Select Folder\";",
281 "\t\tfd.modal = true;",
283 "\t\tfd.select_folder.begin(_this.el, null, (obj, res) => {",
285 "\t\t \tvar f = fd.select_folder.end(res);",
286 "\t\t\t\tthis.extra_value = f.get_path();",
287 "\t\t\t\tvar sl = (Gtk.StringList) this.el.model;\t",
289 "\t\t\t\tsl.remove(sl.get_n_items()-1);",
291 "\t\t\t\tsl.append(this.extra_value);",
292 "\t\t\t\tsl.append(\"Select Folder\");",
293 "\t\t\t\tthis.el.selected = sl.get_n_items()-2;",
294 "\t\t\t} catch (GLib.Error e) {",
295 "\t\t\t\t// do nothing?",
302 "\t_this.hideAll();",
303 "\t_this.parent_lbl.el.show();",
304 " \t_this.parent_dd.el.show(); ",
307 " _this.ptype_lbl.el.show(); ",
308 " _this.ptype_dd.el.show(); ",
309 "\t// folder selected...",
310 "\tswitch(_this.type_dd.getValue()) {",
311 "\t\tcase \"New Folder\":",
312 "\t\t _this.name_lbl.el.show(); ",
313 " \t _this.name_entry.el.show(); ",
314 " \t _this.name_entry.el.text = \"\";",
315 "\t\t _this.ptype_lbl.el.show(); ",
316 "\t\t _this.ptype_dd.el.show(); ",
319 "\t\tcase \"Existing Folder\":",
320 "\t\t\t_this.folder_lbl.el.show();",
321 "\t\t \t_this.folder_dd.el.show();",
322 "\t\t \t_this.folder_dd.load();",
326 "\t\tcase \"Checkout from git\":",
327 "\t\t _this.name_lbl.el.show(); ",
328 " \t _this.name_entry.el.show(); ",
329 " \t _this.name_lbl.el.label= \"not yet\";",
330 " \t _this.name_entry.el.text = \"this is not supported yet\";",
342 "string extra_value" : "",
343 "xtype" : "DropDown",
344 "| string getValue" : [
346 "\tvar m = (Gtk.StringList) this.el.model;",
347 "\treturn m.get_string(this.el.selected);",
354 "\tvar sl = (Gtk.StringList) this.el.model;\t",
355 "\tvar hd = GLib.Environment.get_home_dir();",
356 "\twhile(sl.get_n_items() > 0) {",
359 "\tif (FileUtils.test(hd + \"/gitlive\" ,FileTest.IS_DIR)) {",
360 "\t\tsl.append(hd + \"/gitlive\");",
362 "\tif (FileUtils.test(hd + \"/Projects\" ,FileTest.IS_DIR)) {",
363 "\t\tsl.append(hd + \"/Projects\");",
365 "\tif (this.extra_value != \"\" && FileUtils.test(this.extra_value ,FileTest.IS_DIR)) {",
366 "\t\tsl.append(this.extra_value);",
369 "\tsl.append(\"Select Folder\");",
370 "\tthis.el.selected = Gtk.INVALID_LIST_POSITION;",
376 "$ Gtk.Align halign" : "Gtk.Align.START",
379 "string label" : "Add Folder",
384 "bool hexpand" : true,
390 "strings" : "{ \"gitlive\", \"Projects\", \"Select\" }",
391 "xtype" : "StringList"
395 "notify[\"selected\"]" : [
397 "\tvar fn = this.getValue();",
398 "\tif (fn == \"\") {",
401 "\tvar p = _this.parent_dd.getValue();",
402 "\tif (!FileUtils.test(p + \"/\" + fn + \"/.roobuilder.jcfg\" , GLib.FileTest.EXISTS)) {",
405 "\tvar ty = Project.Project.peekProjectType(p + \"/\" + fn + \"/.roobuilder.jcfg\" );",
406 "\tif (ty == \"\") {",
409 "\t_this.ptype_dd.setValue(ty);",
416 "xtype" : "DropDown",
417 "| string getValue" : [
419 "\tvar m = (Gtk.StringList) this.el.model;",
420 "\treturn this.el.selected == Gtk.INVALID_LIST_POSITION ?",
421 "\t\t\t \"\" : m.get_string(this.el.selected);",
427 "\tvar p = _this.parent_dd.getValue();",
428 "\tvar f = File.new_for_path(p);",
429 "\tvar sl = (Gtk.StringList) this.el.model;\t",
430 "\twhile(sl.get_n_items() > 0) {",
433 "\tvar gstr = new Gee.ArrayList<string>();",
437 "\t\tvar file_enum = f.enumerate_children(",
438 "\t\t\tGLib.FileAttribute.STANDARD_DISPLAY_NAME, ",
439 "\t\t\tGLib.FileQueryInfoFlags.NONE, null);",
443 "\t\tFileInfo next_file; ",
445 "\t\twhile ((next_file = file_enum.next_file(null)) != null) {",
446 "\t\t\tvar fn = next_file.get_display_name();",
448 "\t\t\tif (fn[0] == '.') { // skip hidden",
452 "\t\t\tif (!FileUtils.test(p + \"/\" + fn, GLib.FileTest.IS_DIR)) {",
455 "\t\t\tif (null != Project.Project.getProjectByPath(p + \"/\" + fn)) {",
459 "\t\t\tgstr.add(fn);",
461 "\t} catch (GLib.Error e) {",
462 "\t\t// do nothing.. ",
464 "\tgstr.sort((a,b) => {",
465 "\t\treturn Posix.strcmp(a.down(), b.down());",
468 "\tforeach(var str in gstr) {",
469 "\t\tsl.append(str);",
476 "$ Gtk.Align halign" : "Gtk.Align.START",
479 "string label" : "Named (New Folder Name)",
484 "bool hexpand" : true,
487 "| string getValue" : [
489 "\treturn this.el.text;",
494 "$ Gtk.Align halign" : "Gtk.Align.START",
497 "label" : "Project type :",
502 "bool hexpand" : true,
510 "\t\"Gtk - A Gtk / Vala Desktop project\", ",
511 "\t\"Roo - A Web Javascript Project using the Roo Library\"",
512 "\t/*, \"Flutter\" */ ",
515 "xtype" : "StringList"
519 "notify[\"selected\"]" : [
522 "\t_this.ok_btn.el.hide();\t",
523 "\tif (this.getValue() != \"\") {",
524 "\t _this.ok_btn.el.show();",
531 "xtype" : "DropDown",
532 "| string getValue" : [
534 "\tvar m = (Gtk.StringList) this.el.model;",
535 "\tvar str = this.el.selected == Gtk.INVALID_LIST_POSITION ?",
536 "\t\t\t \"\" : m.get_string(this.el.selected);",
538 " \tvar ar = str.split(\" \");",
543 "| void setValue" : [
545 "\tvar m = (Gtk.StringList) this.el.model;",
546 "\tfor(var i = 0; i < m.get_n_items();i++) {",
547 "\t\tif (m.get_string(i) == val) {",
548 "\t\t\tthis.el.selected = i;",
552 "\tthis.el.selected = Gtk.INVALID_LIST_POSITION;",
564 "name" : "EditProject",
565 "string title" : "New Project",
569 " \t_this.parent_lbl.el.hide();",
570 " _this.parent_dd.el.hide(); ",
572 " \t_this.folder_lbl.el.hide();",
573 " _this.folder_dd.el.hide(); ",
574 " _this.name_lbl.el.hide(); ",
575 " _this.name_entry.el.hide(); ",
576 " _this.ptype_lbl.el.hide(); ",
577 " _this.ptype_dd.el.hide(); ",
578 " _this.ok_btn.el.hide(); ",
583 "(Project.Callback doneObj) {",
584 " this.doneObj= doneObj;",
585 " _this.hideAll(); ",
587 " _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
588 " _this.folder_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
589 " _this.ptype_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
590 " _this.parent_dd.extra_value = \"\";",
591 " //[ 'xtype' ].forEach(function(k) {",
592 " // _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);",
594 "\t// shouild set path..",
602 "name" : "EditProject"