Fix #7214 - move edit code into popover
[roobuilder] / src / Builder4 / PopoverFileDetails.bjs
index a9bcb76..534bfc5 100644 (file)
 {
- "name" : "PopoverFileDetails",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverFileDetails.bjs",
- "permname" : "",
- "modOrder" : "",
  "build_module" : "builder",
  "items" : [
   {
-   "listeners" : {
-    "closed" : "() => {\n  if (!this.done) {\n    _this.el.show();\n  \n  }\n} "
-   },
-   "|   void updateFileFromEntry" : "() {\n\n        _this.file.title = _this.title.el.get_text();\n        _this.file.region = _this.region.el.get_text();            \n        _this.file.parent = _this.parent.el.get_text();                        \n        _this.file.permname = _this.permname.el.get_text();                                    \n        _this.file.modOrder = _this.modOrder.el.get_text();\n        \n        if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {\n            _this.file.renameTo(_this.name.el.get_text());\n        }\n        // store the module...\n        _this.file.build_module = \"\";        \n         Gtk.TreeIter iter; \n        if (_this.build_module.el.get_active_iter (out iter)) {\n             Value vfname;\n             this.dbmodel.el.get_value (iter, 0, out vfname);\n             if (((string)vfname).length > 0) {\n                 _this.file.build_module = (string)vfname;\n             }\n    \n        }\n        \n        \n\n                                                    \n}    ",
-   "id" : "PopoverFileDetails",
-   "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
-   "| void show" : "(JsRender.JsRender c, Gtk.Widget btn) \n{\n    this.project = c.project;\n    this.done = false;\n    \n    \n    //if (!this.el) {\n        //this.init();\n     //}\n    \n    _this.name.el.set_text(c.name);\n    _this.title.el.set_text(c.title);\n    _this.parent.el.set_text(c.parent);    \n    _this.region.el.set_text(c.region);\n    _this.modOrder.el.set_text(c.modOrder);\n     _this.permname.el.set_text(c.permname);\n    \n    \n    \n    \n    \n    \n    \n    \n     var ar = new Gee.ArrayList<string>();\n     _this.dbmodel.loadData(ar,\"\");\n    // load the modules... if relivant..\n    if (this.project.xtype == \"Gtk\") {\n        var p = (Project.Gtk)c.project;\n          var cg = p.compilegroups;\n\n        var iter = cg.map_iterator();\n       while(iter.next()) {\n            var key = iter.get_key();\n            if (key == \"_default_\") {\n                continue;\n            }\n            ar.add(key);\n        };\n        _this.dbmodel.loadData(ar, c.build_module);\n\n    }\n    \n     \n    _this.file = c;\n    //console.log('show all');\n   this.el.set_modal(true);\n    this.el.set_relative_to(btn);\n\n    this.el.set_position(Gtk.PositionType.RIGHT);\n    \n    // window + header?\n     print(\"SHOWALL - POPIP\\n\");\n    this.el.show_all();\n    this.name.el.grab_focus();\n    \n    \n    \n    if (c.path.length > 0) {\n\t    this.save_btn.el.set_label(\"Save\");\n\t\t_this.filetype.el.hide();\n\t\t_this.filetypelbl.el.hide();\n\t\t_this.filetype.showhide(true); // as we only work on bjs files currently\n    } else {\n        this.save_btn.el.set_label(\"Create\");\n        _this.ftdbmodel.loadData(\"bjs\"); // fixme - need to determine type..\n\t    _this.filetype.el.show();\n\t    _this.filetypelbl.el.show();\n    }\n    \n    \n    //this.success = c.success;\n    \n    \n}",
-   "bool done" : false,
-   "# Project.Project project" : "",
-   "xtype" : "Popover",
-   "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "# JsRender.JsRender file" : "null",
+   "# Project.Project project" : "",
    "$ xns" : "Gtk",
+   "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
+   "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "Xcls_MainWindow mainwindow" : "null",
+   "bool done" : false,
    "bool modal" : true,
-   "uint border_width" : 0,
+   "id" : "PopoverFileDetails",
    "items" : [
     {
-     "bool homogeneous" : false,
      "$ pack" : "add",
-     "xtype" : "Box",
      "$ xns" : "Gtk",
      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+     "bool homogeneous" : false,
      "items" : [
       {
-       "* pack" : "pack_start,false,true,0",
-       "xtype" : "HeaderBar",
        "$ xns" : "Gtk",
-       "string title" : "Add / Edit File"
+       "* pack" : "pack_start,false,true,0",
+       "string title" : "Add / Edit File",
+       "xtype" : "HeaderBar"
       },
       {
-       "id" : "grid",
-       "int margin_right" : 4,
-       "* pack" : "pack_start,false,false,4",
-       "xtype" : "Grid",
-       "uint row_spacing" : 2,
-       "n_columns" : 2,
-       "$ xns" : "Gtk",
-       "n_rows" : 7,
        "$ homogeneous" : true,
+       "$ xns" : "Gtk",
+       "* pack" : "pack_start,false,false,4",
+       "id" : "grid",
        "int margin_left" : 4,
+       "int margin_right" : 4,
        "items" : [
         {
-         "label" : "File type",
-         "id" : "filetypelbl",
-         "xalign" : 0.90000000000000002,
-         "* pack" : "attach,0,0,1,1",
-         "xtype" : "Label",
          "$ justify" : "Gtk.Justification.RIGHT",
+         "$ xns" : "Gtk",
+         "* pack" : "attach,0,0,1,1",
+         "id" : "filetypelbl",
+         "label" : "File type",
          "x_options" : 4,
-         "$ xns" : "Gtk"
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
         },
         {
-         "listeners" : {
-          "changed" : "() => {\n\tGtk.TreeIter iter;\n\tbool is_bjs = true;\n\tif (this.el.get_active_iter(out iter)) {\n\t\tValue vfname;\n\t\t_this.ftdbmodel.el.get_value (iter, 0, out vfname);\n\t\t is_bjs = ((string)vfname) == \"bjs\";\n\t}\n    \n  \n    // directory is only available for non-bjs \n    this.showhide(is_bjs);\n\n\n}\n"
-         },
-         "id" : "filetype",
+         "$ xns" : "Gtk",
          "* init" : "this.el.add_attribute(_this.ftdbcellrenderer.el , \"markup\", 1 );",
          "* pack" : "attach,1,0,1,1",
-         "xtype" : "ComboBox",
-         "| void showhide" : "(bool is_bjs) {\n\n\n\tif (_this.project.xtype != \"Roo\") {\n\t \tis_bjs = false;\n \t}\n\n\tfor (var i = 2; i < 9;i++) {\n\t\tvar el = _this.grid.el.get_child_at(0,i);\n\t\t\n\t\tvar showhide= is_bjs;\n\t\tif (i> 7) {\n\t\t\tshowhide = !showhide;\n\t\t}\n\t\t\n\t\tif (showhide) {\n\t\t   el.show();\n\t\t} else {\n\t\t\tel.hide();\n\t\t}\n\t\t el = _this.grid.el.get_child_at(1,i);\n\t\tif (showhide) {\n\t\t   el.show();\n\t\t} else {\n\t\t\tel.hide();\n\t\t}     \n    }\n    // load up the directories\n    //??? why can we not create bjs files in other directories??\n\t//if (!is_bjs && _this.file.path.length < 1) {\n\t\n\t\t_this.dirmodel.loadData();\n\t\t\n\t\t\n\t//}\n   \n    \n}\n",
-         "$ xns" : "Gtk",
+         "id" : "filetype",
          "items" : [
           {
-           "id" : "ftdbcellrenderer",
-           "xtype" : "CellRendererText",
+           "$ xns" : "Gtk",
            "* pack" : "pack_start,true",
-           "$ xns" : "Gtk"
+           "id" : "ftdbcellrenderer",
+           "xtype" : "CellRendererText"
           },
           {
-           "id" : "ftdbmodel",
-           "xtype" : "ListStore",
-           "* pack" : "set_model",
            "$ columns" : "typeof(string),typeof(string)",
-           "n_columns" : 2,
            "$ xns" : "Gtk",
-           "| void loadData" : "  (string cur) {\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n   /// el.append(out iter);\n    \n     \n   // el.set_value(iter, 0, \"\");\n   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");\n\n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"bjs\");\n    el.set_value(iter, 1, \"User Interface File (bjs)\");\n    _this.filetype.el.set_active_iter(iter);\n\n    el.append(out iter);\n    \n    el.set_value(iter, 0, \"vala\");\n    el.set_value(iter, 1, \"Vala\");\n\tif (cur == \"vala\") {\n\t    _this.filetype.el.set_active_iter(iter);\n    }\n\n\n\n    el.append(out iter);\n    \n    el.set_value(iter, 0, \"js\");\n    el.set_value(iter, 1, \"Javascript\");\n\n\tif (cur == \"js\") {\n\t    _this.filetype.el.set_active_iter(iter);\n    }\n\n    el.append(out iter);\n    \n    el.set_value(iter, 0, \"css\");\n    el.set_value(iter, 1, \"CSS\");\n\n\tif (cur == \"css\") {\n\t    _this.filetype.el.set_active_iter(iter);\n    }\n                                     \n}\n"
+           "* pack" : "set_model",
+           "id" : "ftdbmodel",
+           "n_columns" : 2,
+           "xtype" : "ListStore",
+           "| void loadData" : [
+            "  (string cur) {",
+            "    this.el.clear();                                    ",
+            "    Gtk.TreeIter iter;",
+            "    var el = this.el;",
+            "    ",
+            "   /// el.append(out iter);",
+            "    ",
+            "     ",
+            "   // el.set_value(iter, 0, \"\");",
+            "   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");",
+            "",
+            "    el.append(out iter);",
+            "",
+            "    ",
+            "    el.set_value(iter, 0, \"bjs\");",
+            "    el.set_value(iter, 1, \"User Interface File (bjs)\");",
+            "    _this.filetype.el.set_active_iter(iter);",
+            "",
+            "    el.append(out iter);",
+            "    ",
+            "    el.set_value(iter, 0, \"vala\");",
+            "    el.set_value(iter, 1, \"Vala\");",
+            "\tif (cur == \"vala\") {",
+            "\t    _this.filetype.el.set_active_iter(iter);",
+            "    }",
+            "",
+            "",
+            "",
+            "    el.append(out iter);",
+            "    ",
+            "    el.set_value(iter, 0, \"js\");",
+            "    el.set_value(iter, 1, \"Javascript\");",
+            "",
+            "\tif (cur == \"js\") {",
+            "\t    _this.filetype.el.set_active_iter(iter);",
+            "    }",
+            "",
+            "    el.append(out iter);",
+            "    ",
+            "    el.set_value(iter, 0, \"css\");",
+            "    el.set_value(iter, 1, \"CSS\");",
+            "",
+            "\tif (cur == \"css\") {",
+            "\t    _this.filetype.el.set_active_iter(iter);",
+            "    }",
+            "                                     ",
+            "}",
+            ""
+           ]
           }
+         ],
+         "listeners" : {
+          "changed" : [
+           "() => {",
+           "\tGtk.TreeIter iter;",
+           "\tbool is_bjs = true;",
+           "\tif (this.el.get_active_iter(out iter)) {",
+           "\t\tValue vfname;",
+           "\t\t_this.ftdbmodel.el.get_value (iter, 0, out vfname);",
+           "\t\t is_bjs = ((string)vfname) == \"bjs\";",
+           "\t}",
+           "    ",
+           "  ",
+           "    // directory is only available for non-bjs ",
+           "    this.showhide(is_bjs);",
+           "",
+           "",
+           "}",
+           ""
+          ]
+         },
+         "xtype" : "ComboBox",
+         "| void showhide" : [
+          "(bool is_bjs) {",
+          "",
+          "",
+          "\tif (_this.project.xtype != \"Roo\") {",
+          "\t \tis_bjs = false;",
+          " \t}",
+          "",
+          "\tfor (var i = 2; i < 9;i++) {",
+          "\t\tvar el = _this.grid.el.get_child_at(0,i);",
+          "\t\t",
+          "\t\tvar showhide= is_bjs;",
+          "\t\tif (i> 7) {",
+          "\t\t\tshowhide = !showhide;",
+          "\t\t}",
+          "\t\t",
+          "\t\tif (showhide) {",
+          "\t\t   el.show();",
+          "\t\t} else {",
+          "\t\t\tel.hide();",
+          "\t\t}",
+          "\t\t el = _this.grid.el.get_child_at(1,i);",
+          "\t\tif (showhide) {",
+          "\t\t   el.show();",
+          "\t\t} else {",
+          "\t\t\tel.hide();",
+          "\t\t}     ",
+          "    }",
+          "    // load up the directories",
+          "    //??? why can we not create bjs files in other directories??",
+          "\t//if (!is_bjs && _this.file.path.length < 1) {",
+          "\t",
+          "\t\t_this.dirmodel.loadData();",
+          "\t\t",
+          "\t\t",
+          "\t//}",
+          "   ",
+          "    ",
+          "}",
+          ""
          ]
         },
         {
-         "label" : "Component Name",
-         "xalign" : 0.90000000000000002,
-         "* pack" : "attach,0,1,1,1",
-         "xtype" : "Label",
          "$ justify" : "Gtk.Justification.RIGHT",
+         "$ xns" : "Gtk",
+         "* pack" : "attach,0,1,1,1",
+         "label" : "Component Name",
          "x_options" : 4,
-         "$ xns" : "Gtk"
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
         },
         {
-         "id" : "name",
          "$ visible" : true,
-         "xtype" : "Entry",
+         "$ xns" : "Gtk",
          "* pack" : "attach,1,1,1,1",
-         "$ xns" : "Gtk"
+         "id" : "name",
+         "xtype" : "Entry"
         },
         {
-         "label" : "Title",
+         "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
-         "xalign" : 0.90000000000000002,
+         "$ xns" : "Gtk",
          "* pack" : "attach,0,2,1,1",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
+         "label" : "Title",
          "x_options" : 4,
-         "$ xns" : "Gtk"
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
         },
         {
-         "id" : "title",
          "$ visible" : true,
-         "xtype" : "Entry",
+         "$ xns" : "Gtk",
          "* pack" : "attach,1,2,1,1",
-         "$ xns" : "Gtk"
+         "id" : "title",
+         "xtype" : "Entry"
         },
         {
-         "label" : "Region",
-         "tooltip_text" : "center, north, south, east, west",
+         "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
-         "xalign" : 0.90000000000000002,
+         "$ xns" : "Gtk",
          "* pack" : "attach,0,3,1,1",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
+         "label" : "Region",
+         "tooltip_text" : "center, north, south, east, west",
          "x_options" : 4,
-         "$ xns" : "Gtk"
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
         },
         {
-         "id" : "region",
          "$ visible" : true,
-         "xtype" : "Entry",
+         "$ xns" : "Gtk",
          "* pack" : "attach,1,3,1,1",
-         "$ xns" : "Gtk"
+         "id" : "region",
+         "xtype" : "Entry"
         },
         {
-         "label" : "Parent Name",
+         "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
-         "xalign" : 0.90000000000000002,
+         "$ xns" : "Gtk",
          "* pack" : "attach,0,4,1,1",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
+         "label" : "Parent Name",
          "x_options" : 4,
-         "$ xns" : "Gtk"
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
         },
         {
-         "id" : "parent",
          "$ visible" : true,
-         "xtype" : "Entry",
+         "$ xns" : "Gtk",
          "* pack" : "attach,1,4,1,1",
-         "$ xns" : "Gtk"
+         "id" : "parent",
+         "xtype" : "Entry"
         },
         {
-         "label" : "Permission Name",
+         "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
-         "xalign" : 0.90000000000000002,
+         "$ xns" : "Gtk",
          "* pack" : "attach,0,5,1,1",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
+         "label" : "Permission Name",
          "x_options" : 4,
-         "$ xns" : "Gtk"
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
         },
         {
-         "id" : "permname",
          "$ visible" : true,
-         "xtype" : "Entry",
+         "$ xns" : "Gtk",
          "* pack" : "attach,1,5,1,1",
-         "$ xns" : "Gtk"
+         "id" : "permname",
+         "xtype" : "Entry"
         },
         {
-         "label" : "Order (for tabs)",
+         "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
-         "xalign" : 0.90000000000000002,
+         "$ xns" : "Gtk",
          "* pack" : "attach,0,6,1,1",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
+         "label" : "Order (for tabs)",
          "x_options" : 4,
-         "$ xns" : "Gtk"
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
         },
         {
-         "id" : "modOrder",
          "$ visible" : true,
-         "xtype" : "Entry",
+         "$ xns" : "Gtk",
          "* pack" : "attach,1,6,1,1",
-         "$ xns" : "Gtk"
+         "id" : "modOrder",
+         "xtype" : "Entry"
         },
         {
-         "label" : "Module to build (Vala only)",
+         "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
-         "xalign" : 0.90000000000000002,
+         "$ xns" : "Gtk",
          "* pack" : "attach,0,7,1,1",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
+         "label" : "Module to build (Vala only)",
          "x_options" : 4,
-         "$ xns" : "Gtk"
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
         },
         {
-         "id" : "build_module",
+         "$ xns" : "Gtk",
          "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
          "* pack" : "attach,1,7,1,1",
-         "xtype" : "ComboBox",
-         "$ xns" : "Gtk",
+         "id" : "build_module",
          "items" : [
           {
-           "id" : "dbcellrenderer",
+           "$ xns" : "Gtk",
            "* pack" : "pack_start,true",
-           "xtype" : "CellRendererText",
-           "$ xns" : "Gtk"
+           "id" : "dbcellrenderer",
+           "xtype" : "CellRendererText"
           },
           {
-           "id" : "dbmodel",
-           "* pack" : "set_model",
-           "xtype" : "ListStore",
            "$ columns" : "typeof(string),typeof(string)",
-           "n_columns" : 2,
            "$ xns" : "Gtk",
-           "| void loadData" : "  (Gee.ArrayList<string> data, string cur) {\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n   /// el.append(out iter);\n    \n     \n   // el.set_value(iter, 0, \"\");\n   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");\n\n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a module --\");\n    _this.build_module.el.set_active_iter(iter);\n    \n    for (var i = 0; i < data.size;i++) {\n    \n\n        el.append(out iter);\n        \n        el.set_value(iter, 0, data.get(i));\n        el.set_value(iter, 1, data.get(i));\n        \n        if (data.get(i) == cur) {\n            _this.build_module.el.set_active_iter(iter);\n        }\n        \n    }\n     this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n"
+           "* pack" : "set_model",
+           "id" : "dbmodel",
+           "n_columns" : 2,
+           "xtype" : "ListStore",
+           "| void loadData" : [
+            "  (Gee.ArrayList<string> data, string cur) {",
+            "    this.el.clear();                                    ",
+            "    Gtk.TreeIter iter;",
+            "    var el = this.el;",
+            "    ",
+            "   /// el.append(out iter);",
+            "    ",
+            "     ",
+            "   // el.set_value(iter, 0, \"\");",
+            "   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");",
+            "",
+            "    el.append(out iter);",
+            "",
+            "    ",
+            "    el.set_value(iter, 0, \"\");",
+            "    el.set_value(iter, 1, \"-- select a module --\");",
+            "    _this.build_module.el.set_active_iter(iter);",
+            "    ",
+            "    for (var i = 0; i < data.size;i++) {",
+            "    ",
+            "",
+            "        el.append(out iter);",
+            "        ",
+            "        el.set_value(iter, 0, data.get(i));",
+            "        el.set_value(iter, 1, data.get(i));",
+            "        ",
+            "        if (data.get(i) == cur) {",
+            "            _this.build_module.el.set_active_iter(iter);",
+            "        }",
+            "        ",
+            "    }",
+            "     this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          ",
+            "                                     ",
+            "}",
+            ""
+           ]
           }
-         ]
+         ],
+         "xtype" : "ComboBox"
         },
         {
-         "label" : "Directory",
+         "$ justify" : "Gtk.Justification.RIGHT",
          "$ visible" : true,
-         "xalign" : 0.90000000000000002,
+         "$ xns" : "Gtk",
          "* pack" : "attach,0,8,1,1",
-         "xtype" : "Label",
-         "$ justify" : "Gtk.Justification.RIGHT",
+         "label" : "Directory",
          "x_options" : 4,
-         "$ xns" : "Gtk"
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
         },
         {
-         "id" : "dir",
+         "$ xns" : "Gtk",
          "* init" : "this.el.add_attribute(_this.dircellrenderer.el , \"markup\", 1 );",
          "* pack" : "attach,1,8,1,1",
-         "xtype" : "ComboBox",
-         "$ xns" : "Gtk",
+         "id" : "dir",
          "items" : [
           {
-           "id" : "dircellrenderer",
-           "xtype" : "CellRendererText",
+           "$ xns" : "Gtk",
            "* pack" : "pack_start,true",
-           "$ xns" : "Gtk"
+           "id" : "dircellrenderer",
+           "xtype" : "CellRendererText"
           },
           {
-           "id" : "dirmodel",
-           "xtype" : "ListStore",
-           "* pack" : "set_model",
            "$ columns" : "typeof(string),typeof(string)",
-           "n_columns" : 2,
            "$ xns" : "Gtk",
-           "| void loadData" : "  () {\n\t\n\t\n  \n    this.el.clear();                                    \n    \n    if (!(_this.project is Project.Gtk)) {\n\t\treturn;\n\t}\n    var sd = ((Project.Gtk)_this.project).sourcedirs();\n    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n   /// el.append(out iter);\n    \n     \n   // el.set_value(iter, 0, \"\");\n   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");\n\n//    el.append(out iter);\n\n    \n//    el.set_value(iter, 0, \"\");\n  //  el.set_value(iter, 1, \"-- select a directoyr --\");\n    //_this.build_module.el.set_active_iter(iter);\n    \n    for (var i = 0; i < sd.length;i++) {\n    \n\n        el.append(out iter);\n        \n        el.set_value(iter, 0, sd[i]);\n        el.set_value(iter, 1, sd[i]);\n        \n        //if (data.get(i) == cur) {\n        //    _this.build_module.el.set_active_iter(iter);\n       // }\n        \n    }\n  //  this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n"
+           "* pack" : "set_model",
+           "id" : "dirmodel",
+           "n_columns" : 2,
+           "xtype" : "ListStore",
+           "| void loadData" : [
+            "  () {",
+            "\t",
+            "\t",
+            "  ",
+            "    this.el.clear();                                    ",
+            "    ",
+            "    if (!(_this.project is Project.Gtk)) {",
+            "\t\treturn;",
+            "\t}",
+            "    var sd = ((Project.Gtk)_this.project).sourcedirs();",
+            "    ",
+            "    Gtk.TreeIter iter;",
+            "    var el = this.el;",
+            "    ",
+            "   /// el.append(out iter);",
+            "    ",
+            "     ",
+            "   // el.set_value(iter, 0, \"\");",
+            "   // el.set_value(iter, 1, \"aaa  - Just add Element - aaa\");",
+            "",
+            "//    el.append(out iter);",
+            "",
+            "    ",
+            "//    el.set_value(iter, 0, \"\");",
+            "  //  el.set_value(iter, 1, \"-- select a directoyr --\");",
+            "    //_this.build_module.el.set_active_iter(iter);",
+            "    ",
+            "    for (var i = 0; i < sd.length;i++) {",
+            "    ",
+            "",
+            "        el.append(out iter);",
+            "        ",
+            "        el.set_value(iter, 0, sd[i]);",
+            "        el.set_value(iter, 1, sd[i]);",
+            "        ",
+            "        //if (data.get(i) == cur) {",
+            "        //    _this.build_module.el.set_active_iter(iter);",
+            "       // }",
+            "        ",
+            "    }",
+            "  //  this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          ",
+            "                                     ",
+            "}",
+            ""
+           ]
           }
-         ]
+         ],
+         "xtype" : "ComboBox"
         }
-       ]
+       ],
+       "n_columns" : 2,
+       "n_rows" : 7,
+       "uint row_spacing" : 2,
+       "xtype" : "Grid"
       },
       {
-       "int margin_bottom" : 4,
-       "int margin_right" : 4,
-       "* pack" : "pack_end,false,true,0",
-       "xtype" : "HButtonBox",
        "$ xns" : "Gtk",
+       "* pack" : "pack_end,false,true,0",
+       "int margin_bottom" : 4,
        "int margin_left" : 4,
+       "int margin_right" : 4,
        "items" : [
         {
+         "$ xns" : "Gtk",
+         "* pack" : "add",
          "listeners" : {
-          "clicked" : "() => { \n\n  _this.done = true;\n    _this.el.hide(); \n}"
+          "clicked" : [
+           "() => { ",
+           "",
+           "  _this.done = true;",
+           "    _this.el.hide(); ",
+           "}"
+          ]
          },
          "string label" : "Cancel",
-         "* pack" : "add",
-         "xtype" : "Button",
-         "$ xns" : "Gtk"
+         "xtype" : "Button"
         },
         {
+         "$ xns" : "Gtk",
+         "* pack" : "add",
+         "id" : "save_btn",
          "listeners" : {
-          "clicked" : "( ) =>  { \n\n \n\n\n\tif (_this.name.el.get_text().length  < 1) {\n\t    StandardErrorDialog.show(\n\t        _this.mainwindow.el,\n\t        \"You have to set Component name \"\n\t    );\n\t     \n\t    return;\n\t}\n\t// what does this do?\n\t\n\tvar isNew = _this.file.name.length  > 0 ? false : true;\n\t/*\n\tif (!isNew && this.file.name != _this.name.el.get_text()) {\n\t    Xcls_StandardErrorDialog.singleton().show(\n\t        this.el,\n\t        \"Sorry changing names does not work yet. \"\n\t    );\n\t     \n\t    return;\n\t}\n\t*/\n\t \n\t\n  \n\t// FIXME - this may be more complicated...\n\t//for (var i in this.def) {\n\t//    this.file[i] =  this.get(i).el.get_text();\n\t//}\n\n\tif (!isNew) {\n\t    try {\n\t         _this.updateFileFromEntry();\n\t     } catch( JsRender.Error.RENAME_FILE_EXISTS er) {\n\t          Xcls_StandardErrorDialog.singleton().show(\n\t            _this.mainwindow.el,\n\t            \"The name you used already exists \"\n\t        );\n\t        return;\n\t         \n\t     }\n\n\t      _this.done = true;\n\t    _this.file.save();\n\t    _this.el.hide();\n\t    return;\n\t}\n\t\n\t// ---------------- NEW FILES...\n\tGtk.TreeIter iter;\n\n\tif (!_this.filetype.el.get_active_iter(out iter)) {\n\t\t// should not happen...\n\t\t// so we are jut going to return without \n\t\tStandardErrorDialog.show(\n\t        _this.mainwindow.el,\n\t        \"You must select a file type. \"\n\t    );\n\t    return;\n\t\t \n\t}\n\t\n\t\n\tvar fn = _this.name.el.get_text();\n\t\n\tValue ftypename;\n\t_this.ftdbmodel.el.get_value (iter, 0, out ftypename);\n\tvar ext = ((string)ftypename);\n\tvar dir = _this.project.firstPath(); \n\tif (ext != \"bjs\") {\n\t \n\t\tif (!_this.dir.el.get_active_iter(out iter)) {\n\t\t\t// should not happen...\n\t\t\t// so we are jut going to return without \n\t\t\tStandardErrorDialog.show(\n\t\t\t    _this.mainwindow.el,\n\t\t\t    \"You must select a directory \"\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tValue vdir;\n\t\t_this.dirmodel.el.get_value (iter, 0, out vdir);\n\t\tdir = (string)vdir;\n\t}\n\t\n\tvar targetfile = dir + \"/\" + fn;\n\t\n\t// strip the file type off the end..\n\t\n\t\n    var rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);\n    targetfile = rx.replace(targetfile, targetfile.length, 0, \"\"); \n   \n\tif (GLib.FileUtils.test(targetfile + \".\" + ext, GLib.FileTest.EXISTS)) {\n\t    Xcls_StandardErrorDialog.singleton().show(\n\t        _this.mainwindow.el,\n\t        \"That file already exists\"\n\t    ); \n\t    return;\n\t}\n   \n   var f =  JsRender.JsRender.factory(\n\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\",  \n\t\t_this.file.project, \n\t\ttargetfile + \".\" + ext);\n\n\t_this.file = f;\n\t\n\n\t\n\t_this.updateFileFromEntry();\n\t_this.file.loaded = true;\n\t_this.file.save();\n\tif (ext == \"bjs\") {\n\t\t_this.file.project.addFile(_this.file);\n\t}\n\t\n \n\t// what about .js ?\n   _this.done = true;\n\t_this.el.hide();\n\n// hopefull this will work with bjs files..\n\t\n\t_this.success(_this.project, _this.file);\n   \n}"
+          "clicked" : [
+           "( ) =>  { ",
+           "",
+           " ",
+           "",
+           "",
+           "\tif (_this.name.el.get_text().length  < 1) {",
+           "\t    StandardErrorDialog.show(",
+           "\t        _this.mainwindow.el,",
+           "\t        \"You have to set Component name \"",
+           "\t    );",
+           "\t     ",
+           "\t    return;",
+           "\t}",
+           "\t// what does this do?",
+           "\t",
+           "\tvar isNew = _this.file.name.length  > 0 ? false : true;",
+           "\t/*",
+           "\tif (!isNew && this.file.name != _this.name.el.get_text()) {",
+           "\t    Xcls_StandardErrorDialog.singleton().show(",
+           "\t        this.el,",
+           "\t        \"Sorry changing names does not work yet. \"",
+           "\t    );",
+           "\t     ",
+           "\t    return;",
+           "\t}",
+           "\t*/",
+           "\t ",
+           "\t",
+           "  ",
+           "\t// FIXME - this may be more complicated...",
+           "\t//for (var i in this.def) {",
+           "\t//    this.file[i] =  this.get(i).el.get_text();",
+           "\t//}",
+           "",
+           "\tif (!isNew) {",
+           "\t    try {",
+           "\t         _this.updateFileFromEntry();",
+           "\t     } catch( JsRender.Error.RENAME_FILE_EXISTS er) {",
+           "\t          Xcls_StandardErrorDialog.singleton().show(",
+           "\t            _this.mainwindow.el,",
+           "\t            \"The name you used already exists \"",
+           "\t        );",
+           "\t        return;",
+           "\t         ",
+           "\t     }",
+           "",
+           "\t      _this.done = true;",
+           "\t    _this.file.save();",
+           "\t    _this.el.hide();",
+           "\t    return;",
+           "\t}",
+           "\t",
+           "\t// ---------------- NEW FILES...",
+           "\tGtk.TreeIter iter;",
+           "",
+           "\tif (!_this.filetype.el.get_active_iter(out iter)) {",
+           "\t\t// should not happen...",
+           "\t\t// so we are jut going to return without ",
+           "\t\tStandardErrorDialog.show(",
+           "\t        _this.mainwindow.el,",
+           "\t        \"You must select a file type. \"",
+           "\t    );",
+           "\t    return;",
+           "\t\t ",
+           "\t}",
+           "\t",
+           "\t",
+           "\tvar fn = _this.name.el.get_text();",
+           "\t",
+           "\tValue ftypename;",
+           "\t_this.ftdbmodel.el.get_value (iter, 0, out ftypename);",
+           "\tvar ext = ((string)ftypename);",
+           "\tvar dir = _this.project.firstPath(); ",
+           "\tif (ext != \"bjs\") {",
+           "\t ",
+           "\t\tif (!_this.dir.el.get_active_iter(out iter)) {",
+           "\t\t\t// should not happen...",
+           "\t\t\t// so we are jut going to return without ",
+           "\t\t\tStandardErrorDialog.show(",
+           "\t\t\t    _this.mainwindow.el,",
+           "\t\t\t    \"You must select a directory \"",
+           "\t\t\t);",
+           "\t\t\treturn;",
+           "\t\t}",
+           "\t\tValue vdir;",
+           "\t\t_this.dirmodel.el.get_value (iter, 0, out vdir);",
+           "\t\tdir = (string)vdir;",
+           "\t}",
+           "\t",
+           "\tvar targetfile = dir + \"/\" + fn;",
+           "\t",
+           "\t// strip the file type off the end..",
+           "\t",
+           "\t",
+           "    var rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
+           "    targetfile = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
+           "   ",
+           "\tif (GLib.FileUtils.test(targetfile + \".\" + ext, GLib.FileTest.EXISTS)) {",
+           "\t    Xcls_StandardErrorDialog.singleton().show(",
+           "\t        _this.mainwindow.el,",
+           "\t        \"That file already exists\"",
+           "\t    ); ",
+           "\t    return;",
+           "\t}",
+           "   ",
+           "   var f =  JsRender.JsRender.factory(",
+           "\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\",  ",
+           "\t\t_this.file.project, ",
+           "\t\ttargetfile + \".\" + ext);",
+           "",
+           "\t_this.file = f;",
+           "\t",
+           "",
+           "\t",
+           "\t_this.updateFileFromEntry();",
+           "\t_this.file.loaded = true;",
+           "\t_this.file.save();",
+           "\tif (ext == \"bjs\") {",
+           "\t\t_this.file.project.addFile(_this.file);",
+           "\t}",
+           "\t",
+           " ",
+           "\t// what about .js ?",
+           "   _this.done = true;",
+           "\t_this.el.hide();",
+           "",
+           "// hopefull this will work with bjs files..",
+           "\t",
+           "\t_this.success(_this.project, _this.file);",
+           "   ",
+           "}"
+          ]
          },
-         "id" : "save_btn",
-         "* pack" : "add",
-         "xtype" : "Button",
          "string label" : "Save",
-         "$ xns" : "Gtk"
+         "xtype" : "Button"
         }
-       ]
+       ],
+       "xtype" : "HButtonBox"
       }
-     ]
+     ],
+     "xtype" : "Box"
     }
+   ],
+   "listeners" : {
+    "closed" : [
+     "() => {",
+     "  if (!this.done) {",
+     "    _this.el.show();",
+     "  ",
+     "  }",
+     "} "
+    ]
+   },
+   "uint border_width" : 0,
+   "xtype" : "Popover",
+   "|   void updateFileFromEntry" : [
+    "() {",
+    "",
+    "        _this.file.title = _this.title.el.get_text();",
+    "        _this.file.region = _this.region.el.get_text();            ",
+    "        _this.file.parent = _this.parent.el.get_text();                        ",
+    "        _this.file.permname = _this.permname.el.get_text();                                    ",
+    "        _this.file.modOrder = _this.modOrder.el.get_text();",
+    "        ",
+    "        if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {",
+    "            _this.file.renameTo(_this.name.el.get_text());",
+    "        }",
+    "        // store the module...",
+    "        _this.file.build_module = \"\";        ",
+    "         Gtk.TreeIter iter; ",
+    "        if (_this.build_module.el.get_active_iter (out iter)) {",
+    "             Value vfname;",
+    "             this.dbmodel.el.get_value (iter, 0, out vfname);",
+    "             if (((string)vfname).length > 0) {",
+    "                 _this.file.build_module = (string)vfname;",
+    "             }",
+    "    ",
+    "        }",
+    "        ",
+    "        ",
+    "",
+    "                                                    ",
+    "}    "
+   ],
+   "| void show" : [
+    "(JsRender.JsRender c, Gtk.Widget btn) ",
+    "{",
+    "    this.project = c.project;",
+    "    this.done = false;",
+    "    ",
+    "    ",
+    "    //if (!this.el) {",
+    "        //this.init();",
+    "     //}",
+    "    ",
+    "    _this.name.el.set_text(c.name);",
+    "    _this.title.el.set_text(c.title);",
+    "    _this.parent.el.set_text(c.parent);    ",
+    "    _this.region.el.set_text(c.region);",
+    "    _this.modOrder.el.set_text(c.modOrder);",
+    "     _this.permname.el.set_text(c.permname);",
+    "    ",
+    "    ",
+    "    ",
+    "    ",
+    "    ",
+    "    ",
+    "    ",
+    "    ",
+    "     var ar = new Gee.ArrayList<string>();",
+    "     _this.dbmodel.loadData(ar,\"\");",
+    "    // load the modules... if relivant..",
+    "    if (this.project.xtype == \"Gtk\") {",
+    "        var p = (Project.Gtk)c.project;",
+    "          var cg = p.compilegroups;",
+    "",
+    "        var iter = cg.map_iterator();",
+    "       while(iter.next()) {",
+    "            var key = iter.get_key();",
+    "            if (key == \"_default_\") {",
+    "                continue;",
+    "            }",
+    "            ar.add(key);",
+    "        };",
+    "        _this.dbmodel.loadData(ar, c.build_module);",
+    "",
+    "    }",
+    "    ",
+    "     ",
+    "    _this.file = c;",
+    "    //console.log('show all');",
+    "   this.el.set_modal(true);",
+    "    this.el.set_relative_to(btn);",
+    "",
+    "    this.el.set_position(Gtk.PositionType.RIGHT);",
+    "    ",
+    "    // window + header?",
+    "     print(\"SHOWALL - POPIP\\n\");",
+    "    this.el.show_all();",
+    "    this.name.el.grab_focus();",
+    "    ",
+    "    ",
+    "    ",
+    "    if (c.path.length > 0) {",
+    "\t    this.save_btn.el.set_label(\"Save\");",
+    "\t\t_this.filetype.el.hide();",
+    "\t\t_this.filetypelbl.el.hide();",
+    "\t\t_this.filetype.showhide(true); // as we only work on bjs files currently",
+    "    } else {",
+    "        this.save_btn.el.set_label(\"Create\");",
+    "        _this.ftdbmodel.loadData(\"bjs\"); // fixme - need to determine type..",
+    "\t    _this.filetype.el.show();",
+    "\t    _this.filetypelbl.el.show();",
+    "    }",
+    "    ",
+    "    ",
+    "    //this.success = c.success;",
+    "    ",
+    "    ",
+    "}"
    ]
   }
- ]
+ ],
+ "modOrder" : "",
+ "name" : "PopoverFileDetails",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverFileDetails.bjs",
+ "permname" : "",
+ "title" : ""
 }
\ No newline at end of file