2 "build_module" : "builder",
3 "gen_extended" : false,
6 "# WindowState? windowstate" : "null",
9 "@ void canceled" : "()",
10 "@ void selected" : "(Project.Project? proj)",
12 "default_width" : 600,
16 "* prop" : "titlebar",
17 "* title" : "New Project",
18 "bool show_title_buttons" : false,
21 "$ Gtk.Align halign" : "Gtk.Align.END",
23 "* pack" : "pack_start",
24 "bool hexpand" : false,
31 "\t_this.canceled();",
41 "$ Gtk.Align halign" : "Gtk.Align.START",
42 "$ css_classes" : "{ \"suggested-action\" }",
44 "* pack" : "pack_end",
45 "bool hexpand" : false,
51 " var err_dialog = Xcls_StandardErrorDialog.singleton();",
54 " \tif (_this.ptype_dd.getValue().length < 1) {",
55 " err_dialog.show(_this.el,\"You have to set Project type\"); ",
58 " var fn = _this.parent_dd.getValue();",
59 " var is_existing = false;",
60 " var is_new_folder = false;",
61 " switch (_this.type_dd.getValue()) {",
62 "\t \tcase \"Existing Folder\":",
63 "\t\t \tif (_this.folder_dd.getValue().length < 1) {",
64 "\t\t\t\terr_dialog.show(_this.el,\"You have to set Folder\"); ",
67 "\t\t\tfn += \"/\" + _this.folder_dd.getValue();",
68 "\t\t\tis_existing = true;",
71 "\t \tcase \"New Folder\":",
72 "\t\t \tif (_this.name_entry.getValue().length < 1) {",
73 "\t\t\t\terr_dialog.show(_this.el,\"You have enter a Project Name\"); ",
76 "\t\t\tfn += \"/\" + _this.name_entry.getValue();\t ",
78 "\t\t\tif (FileUtils.test( fn ,FileTest.EXISTS)) {",
79 "\t\t\t\terr_dialog.show(_this.el,\"That folder already exists\"); ",
80 "\t\t\t\treturn;\t\t\t",
82 "\t\t\tvar dir = File.new_for_path(fn);",
84 "\t\t\t\tdir.make_directory();\t",
85 "\t\t\t} catch (Error e) {",
86 "\t\t\t\tGLib.error(\"Failed to make directory %s\", fn);",
88 "\t\t\tis_new_folder = true;",
104 " GLib.debug(\"add %s\\n\" , fn);",
106 "\t\tvar project = Project.Project.factory(_this.ptype_dd.getValue(), fn);",
107 "\t\tif (is_new_folder) {\t",
108 "\t\t\tproject.initialize();",
111 "\t\t\tproject.load();",
114 "\t\tproject.save();",
115 "\t\t Project.Project.saveProjectList();",
116 "\t\t_this.selected(project); // this should trigger a load()",
117 "\t\tif (is_new_folder || is_existing) {",
118 "\t \t _this.windowstate.projectPopoverShow(_this.el, project);",
122 "\t} catch (Error e) {",
123 "\t\tGLib.debug(\"got error? %s\" , e.message);",
134 "xtype" : "HeaderBar"
137 "$ homogeneous" : false,
140 "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
141 "bool expand" : true,
142 "int margin_bottom" : 10,
143 "int margin_end" : 10,
144 "int margin_start" : 10,
145 "int margin_top" : 10,
150 "int column_spacing" : 4,
151 "int margin_bottom" : 20,
152 "int row_spacing" : 4,
155 "$ Gtk.Align halign" : "Gtk.Align.START",
158 "string label" : "Create a Project from:",
162 "$ uint selected" : "Gtk.INVALID_LIST_POSITION",
170 "bool hexpand" : true,
176 "strings" : "{ \"New Folder\", \"Existing Folder\" /*, \"Checkout from git\" */ }",
177 "xtype" : "StringList"
181 "notify[\"selected\"]" : [
184 "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
187 "\tvar m = (Gtk.StringList) this.el.model;",
188 "\tGLib.debug(\"selected item: %s\", m.get_string(this.el.selected));",
190 "\t_this.hideAll();",
191 "\t_this.parent_lbl.el.show();",
192 "\t_this.parent_dd.el.show();",
193 "\t_this.parent_dd.load();",
197 " \tswitch (m.get_string(this.el.selected)) {",
198 "\t\tcase \"New Folder\":",
199 "\t\t _this.name_lbl.el.show(); ",
200 " \t\t_this.name_entry.el.show(); ",
202 "\t\tcase \"Existing Folder\":",
203 "\t\t\t_this.folder_lbl.el.show();",
204 "\t\t\t _this.folder_dd.el.show(); \t",
207 "\t\tcase \"Checkout from git\":",
208 "\t\t _this.name_lbl.el.show(); ",
209 "\t\t\t_this.name_entry.el.show(); ",
212 "\t\t\t_this.hideAll();",
228 "xtype" : "DropDown",
229 "| string getValue" : [
231 "\tvar m = (Gtk.StringList) this.el.model;",
232 "\treturn m.get_string(this.el.selected);",
238 "$ Gtk.Align halign" : "Gtk.Align.START",
241 "string label" : "In Folder:",
246 "bool hexpand" : true,
252 "strings" : "{ \"gitlive\", \"Projects\", \"Select\" }",
253 "xtype" : "StringList"
257 "notify[\"selected\"]" : [
259 "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
260 "\t\t_this.hideAll();",
261 "\t\t_this.parent_lbl.el.show();",
262 " \t_this.parent_dd.el.show(); ",
269 "\tif (this.getValue() == \"Select Folder\") {",
270 "\t\tvar fd = new Gtk.FileDialog();",
271 "\t\tfd.title = \"Select Folder\";",
272 "\t\tfd.modal = true;",
274 "\t\tfd.select_folder.begin(_this.el, null, (obj, res) => {",
276 "\t\t \tvar f = fd.select_folder.end(res);",
277 "\t\t\t\tthis.extra_value = f.get_path();",
278 "\t\t\t\tvar sl = (Gtk.StringList) this.el.model;\t",
280 "\t\t\t\tsl.remove(sl.get_n_items()-1);",
282 "\t\t\t\tsl.append(this.extra_value);",
283 "\t\t\t\tsl.append(\"Select Folder\");",
284 "\t\t\t\tthis.el.selected = sl.get_n_items()-2;",
285 "\t\t\t} catch (GLib.Error e) {",
286 "\t\t\t\t// do nothing?",
293 "\t_this.hideAll();",
294 "\t_this.parent_lbl.el.show();",
295 " \t_this.parent_dd.el.show(); ",
298 " _this.ptype_lbl.el.show(); ",
299 " _this.ptype_dd.el.show(); ",
300 "\t// folder selected...",
301 "\tswitch(_this.type_dd.getValue()) {",
302 "\t\tcase \"New Folder\":",
303 "\t\t _this.name_lbl.el.show(); ",
304 " \t _this.name_entry.el.show(); ",
305 " \t _this.name_entry.el.text = \"\";",
306 "\t\t _this.ptype_lbl.el.show(); ",
307 "\t\t _this.ptype_dd.el.show(); ",
310 "\t\tcase \"Existing Folder\":",
311 "\t\t\t_this.folder_lbl.el.show();",
312 "\t\t \t_this.folder_dd.el.show();",
313 "\t\t \t_this.folder_dd.load();",
317 "\t\tcase \"Checkout from git\":",
318 "\t\t _this.name_lbl.el.show(); ",
319 " \t _this.name_entry.el.show(); ",
320 " \t _this.name_lbl.el.label= \"not yet\";",
321 " \t _this.name_entry.el.text = \"this is not supported yet\";",
333 "string extra_value" : "",
334 "xtype" : "DropDown",
335 "| string getValue" : [
337 "\tvar m = (Gtk.StringList) this.el.model;",
338 "\treturn m.get_string(this.el.selected);",
345 "\tvar sl = (Gtk.StringList) this.el.model;\t",
346 "\tvar hd = GLib.Environment.get_home_dir();",
347 "\twhile(sl.get_n_items() > 0) {",
350 "\tif (FileUtils.test(hd + \"/gitlive\" ,FileTest.IS_DIR)) {",
351 "\t\tsl.append(hd + \"/gitlive\");",
353 "\tif (FileUtils.test(hd + \"/Projects\" ,FileTest.IS_DIR)) {",
354 "\t\tsl.append(hd + \"/Projects\");",
356 "\tif (this.extra_value != \"\" && FileUtils.test(this.extra_value ,FileTest.IS_DIR)) {",
357 "\t\tsl.append(this.extra_value);",
360 "\tsl.append(\"Select Folder\");",
361 "\tthis.el.selected = Gtk.INVALID_LIST_POSITION;",
367 "$ Gtk.Align halign" : "Gtk.Align.START",
370 "string label" : "Add Folder",
375 "bool hexpand" : true,
381 "strings" : "{ \"gitlive\", \"Projects\", \"Select\" }",
382 "xtype" : "StringList"
386 "notify[\"selected\"]" : [
388 "\tvar fn = this.getValue();",
389 "\tif (fn == \"\") {",
392 "\tvar p = _this.parent_dd.getValue();",
393 "\tif (!FileUtils.test(p + \"/\" + fn + \"/.roobuilder.jcfg\" , GLib.FileTest.EXISTS)) {",
396 "\tvar ty = Project.Project.peekProjectType(p + \"/\" + fn + \"/.roobuilder.jcfg\" );",
397 "\tif (ty == \"\") {",
400 "\t_this.ptype_dd.setValue(ty);",
407 "xtype" : "DropDown",
408 "| string getValue" : [
410 "\tvar m = (Gtk.StringList) this.el.model;",
411 "\treturn this.el.selected == Gtk.INVALID_LIST_POSITION ?",
412 "\t\t\t \"\" : m.get_string(this.el.selected);",
418 "\tvar p = _this.parent_dd.getValue();",
419 "\tvar f = File.new_for_path(p);",
420 "\tvar sl = (Gtk.StringList) this.el.model;\t",
421 "\twhile(sl.get_n_items() > 0) {",
424 "\tvar gstr = new Gee.ArrayList<string>();",
428 "\t\tvar file_enum = f.enumerate_children(",
429 "\t\t\tGLib.FileAttribute.STANDARD_DISPLAY_NAME, ",
430 "\t\t\tGLib.FileQueryInfoFlags.NONE, null);",
434 "\t\tFileInfo next_file; ",
436 "\t\twhile ((next_file = file_enum.next_file(null)) != null) {",
437 "\t\t\tvar fn = next_file.get_display_name();",
439 "\t\t\tif (fn[0] == '.') { // skip hidden",
443 "\t\t\tif (!FileUtils.test(p + \"/\" + fn, GLib.FileTest.IS_DIR)) {",
446 "\t\t\tif (null != Project.Project.getProjectByPath(p + \"/\" + fn)) {",
450 "\t\t\tgstr.add(fn);",
452 "\t} catch (GLib.Error e) {",
453 "\t\t// do nothing.. ",
455 "\tgstr.sort((a,b) => {",
456 "\t\treturn Posix.strcmp(a.down(), b.down());",
459 "\tforeach(var str in gstr) {",
460 "\t\tsl.append(str);",
467 "$ Gtk.Align halign" : "Gtk.Align.START",
470 "string label" : "Named (New Folder Name)",
475 "bool hexpand" : true,
478 "| string getValue" : [
480 "\treturn this.el.text;",
485 "$ Gtk.Align halign" : "Gtk.Align.START",
488 "label" : "Project type :",
493 "bool hexpand" : true,
499 "strings" : "{ \"Roo\", \"Gtk\" /*, \"WrappedGtk\", \"Flutter\" */ }",
500 "xtype" : "StringList"
504 "notify[\"selected\"]" : [
507 "\t_this.ok_btn.el.hide();\t",
508 "\tif (this.getValue() != \"\") {",
509 "\t _this.ok_btn.el.show();",
516 "xtype" : "DropDown",
517 "| string getValue" : [
519 "\tvar m = (Gtk.StringList) this.el.model;",
520 "\treturn this.el.selected == Gtk.INVALID_LIST_POSITION ?",
521 "\t\t\t \"\" : m.get_string(this.el.selected);",
525 "| void setValue" : [
527 "\tvar m = (Gtk.StringList) this.el.model;",
528 "\tfor(var i = 0; i < m.get_n_items();i++) {",
529 "\t\tif (m.get_string(i) == val) {",
530 "\t\t\tthis.el.selected = i;",
534 "\tthis.el.selected = Gtk.INVALID_LIST_POSITION;",
546 "name" : "EditProject",
547 "title" : "New Project",
551 " \t_this.parent_lbl.el.hide();",
552 " _this.parent_dd.el.hide(); ",
554 " \t_this.folder_lbl.el.hide();",
555 " _this.folder_dd.el.hide(); ",
556 " _this.name_lbl.el.hide(); ",
557 " _this.name_entry.el.hide(); ",
558 " _this.ptype_lbl.el.hide(); ",
559 " _this.ptype_dd.el.hide(); ",
560 " _this.ok_btn.el.hide(); ",
567 " _this.hideAll(); ",
569 " _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
570 " _this.folder_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
571 " _this.ptype_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
572 " _this.parent_dd.extra_value = \"\";",
573 " //[ 'xtype' ].forEach(function(k) {",
574 " // _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);",
576 "\t// shouild set path..",
584 "name" : "EditProject"