Fix #7959 - new project flow - use void func to callback after each step, tidy up...
[roobuilder] / src / Builder4 / EditProject.bjs
index edd9723..b45ca28 100644 (file)
@@ -4,10 +4,11 @@
  "items" : [
   {
    "# WindowState? windowstate" : "null",
+   "$ Project.Callback doneObj" : "null",
    "$ deletable" : true,
    "$ xns" : "Gtk",
    "@ void canceled" : "()",
-   "@ void selected" : "(Project.Project? proj)",
+   "Project.Project result" : "null",
    "bool modal" : true,
    "default_width" : 600,
    "items" : [
          "\t\t",
          "\t\tproject.save();",
          "\t\t Project.Project.saveProjectList();",
-         "\t\t_this.selected(project); // this should trigger a load()",
+         " \t\t_this.result = project;",
          "\t\tif (is_new_folder || is_existing) {",
-         "\t    \t _this.windowstate.projectPopoverShow(_this.el, project);",
+         "\t\t\t   ",
+         "\t\t",
+         "\t    \t _this.windowstate.projectPopoverShow(",
+         "\t    \t \t_this.el.transient_for, project,  _this.doneObj ",
+         "    \t \t);",
+         "    \t } else {",
+         "    \t \tif (_this.doneObj != null) {",
+         "\t\t    \t _this.doneObj.call(project);",
+         "\t    \t }",
          "    \t }",
          "\t\t",
          "\t\treturn;",
           {
            "$ xns" : "Gtk",
            "* prop" : "model",
-           "strings" : "{ \"Roo\", \"Gtk\" /*, \"WrappedGtk\", \"Flutter\" */ }",
+           "strings" : [
+            "{  ",
+            "\t\"Gtk - A Gtk / Vala Desktop project\", ",
+            "\t\"Roo - A Web  Javascript Project using the Roo Library\"",
+            "\t/*,  \"Flutter\" */ ",
+            "}"
+           ],
            "xtype" : "StringList"
           }
          ],
          "| string getValue" : [
           "() {",
           "\tvar m = (Gtk.StringList) this.el.model;",
-          "\treturn this.el.selected == Gtk.INVALID_LIST_POSITION ?",
+          "\tvar str = this.el.selected == Gtk.INVALID_LIST_POSITION ?",
           "\t\t\t \"\" : m.get_string(this.el.selected);",
+          "\t\t\t ",
+          " \tvar ar = str.split(\" \");",
+          " \treturn ar[0];",
           "\t",
           "}"
          ],
     }
    ],
    "name" : "EditProject",
-   "title" : "New Project",
+   "string title" : "New Project",
    "xtype" : "Window",
    "| void hideAll" : [
     "() {",
     "}"
    ],
    "| void show" : [
-    "() {",
-    "     ",
+    "(Project.Callback doneObj) {",
+    "     this.doneObj= doneObj;",
     "    _this.hideAll(); ",
     "     // hide stuff..",
     "     _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION;",