src/Builder4/ValaProjectSettingsPopover.bjs
authorAlan <alan@roojs.com>
Wed, 6 Jul 2022 08:39:09 +0000 (16:39 +0800)
committerAlan <alan@roojs.com>
Wed, 6 Jul 2022 08:39:09 +0000 (16:39 +0800)
src/Builder4/ValaProjectSettingsPopover.vala

src/Builder4/ValaProjectSettingsPopover.bjs
src/Builder4/ValaProjectSettingsPopover.vala

index 5305805..666e498 100644 (file)
 {
- "name" : "ValaProjectSettingsPopover",
- "parent" : "",
- "title" : "",
- "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaProjectSettingsPopover.bjs",
- "permname" : "",
- "modOrder" : "",
  "build_module" : "builder",
  "items" : [
   {
-   "listeners" : {
-    "hide" : "() => {\n\t_this.project.writeConfig();\n\n}"
-   },
-   "id" : "ValaProjectSettingsPopover",
-   "Xcls_MainWindow window" : "null",
-   "| void show" : "(Gtk.Widget btn, Project.Gtk project) {\n     \n    //print(\"ValaProjectSettings show\\n\");\n    \n    this.project=  project;\n\n    this.compile_flags.el.text = _this.project.compilegroups.get(\"_default_\").compile_flags;\n    \n    this.default_directory_tree_store.load();    \n    this.default_packages_tree_store.load();            \n    this.targets_tree_store.load();\n    this.files_tree_store.load();\n\n\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n\n\tthis.el.set_position(Gtk.PositionType.RIGHT);\n\n\t// window + header?\n\t// print(\"SHOWALL - POPIP\\n\");\n\tthis.el.set_size_request(800,500);\n\tthis.el.show_all();\n\t//this.view.el.grab_focus();\n\n}\n",
-   "Project.Gtk project" : "null",
-   "xtype" : "Popover",
-   "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
-   "| void save" : "()  {\n    this.project.writeConfig(); \n}",
    "$ xns" : "Gtk",
+   "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
+   "Project.Gtk project" : "null",
+   "Xcls_MainWindow window" : "null",
    "bool modal" : true,
-   "uint border_width" : 0,
+   "id" : "ValaProjectSettingsPopover",
    "items" : [
     {
-     "bool hexpand" : true,
-     "* pack" : "add",
-     "xtype" : "Box",
      "$ xns" : "Gtk",
+     "* pack" : "add",
      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+     "bool hexpand" : true,
      "items" : [
       {
-       "* pack" : "pack_start,true,true,0",
-       "xtype" : "Notebook",
        "$ xns" : "Gtk",
+       "* pack" : "pack_start,true,true,0",
        "items" : [
         {
-         "id" : "label_global",
-         "xtype" : "Label",
-         "* pack" : false,
          "$ xns" : "Gtk",
-         "utf8 label" : "Global"
+         "* pack" : false,
+         "id" : "label_global",
+         "utf8 label" : "Global",
+         "xtype" : "Label"
         },
         {
-         "id" : "label_targets",
-         "* pack" : false,
-         "xtype" : "Label",
          "$ xns" : "Gtk",
-         "utf8 label" : "Targets"
+         "* pack" : false,
+         "id" : "label_targets",
+         "utf8 label" : "Targets",
+         "xtype" : "Label"
         },
         {
-         "xtype" : "Box",
-         "* pack" : "append_page,_this.label_global.el",
-         "gboolean homogeneous" : false,
          "$ xns" : "Gtk",
+         "* pack" : "append_page,_this.label_global.el",
          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+         "gboolean homogeneous" : false,
          "items" : [
           {
-           "xtype" : "Label",
-           "* pack" : "pack_start,false,false,0",
            "$ xns" : "Gtk",
-           "utf8 label" : "compile flags"
+           "* pack" : "pack_start,false,false,0",
+           "utf8 label" : "compile flags",
+           "xtype" : "Label"
           },
           {
+           "$ xns" : "Gtk",
+           "* pack" : "pack_start,false,false,0",
+           "id" : "compile_flags",
            "listeners" : {
-            "changed" : "() => {\n    \n   _this.project.compilegroups.get(\"_default_\").compile_flags = this.el.text;\n   _this.project.writeConfig();\n//    _this.project.save();\n\n}"
+            "changed" : [
+             "() => {",
+             "    ",
+             "   _this.project.compilegroups.get(\"_default_\").compile_flags = this.el.text;",
+             "   _this.project.writeConfig();",
+             "//    _this.project.save();",
+             "",
+             "}"
+            ]
            },
-           "id" : "compile_flags",
-           "xtype" : "Entry",
-           "* pack" : "pack_start,false,false,0",
-           "$ xns" : "Gtk",
-           "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR "
+           "utf8 placeholder_text" : "eg. -g --valasrc $BASEDIR ",
+           "xtype" : "Entry"
           },
           {
-           "* pack" : "pack_start,true,true,0",
-           "xtype" : "Paned",
            "$ xns" : "Gtk",
-           "int position" : 300,
+           "* pack" : "pack_start,true,true,0",
            "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+           "int position" : 300,
            "items" : [
             {
-             "bool hexpand" : true,
-             "xtype" : "ScrolledWindow",
-             "* pack" : "add",
              "$ xns" : "Gtk",
+             "* pack" : "add",
+             "bool hexpand" : true,
              "items" : [
               {
-               "gboolean headers_visible" : true,
-               "* pack" : "add",
-               "xtype" : "TreeView",
-               "string id" : "default_packages_tree",
                "$ xns" : "Gtk",
+               "* pack" : "add",
+               "gboolean headers_visible" : true,
                "items" : [
                 {
-                 "id" : "default_packages_tree_store",
+                 "$ columns" : [
+                  "    typeof(string),  // 0 key type",
+                  "      typeof(bool)"
+                 ],
+                 "$ n_columns" : 2,
+                 "$ xns" : "Gtk",
                  "* pack" : "set_model",
+                 "id" : "default_packages_tree_store",
                  "xtype" : "ListStore",
-                 "$ n_columns" : 2,
-                 "| void load" : "() {\n \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    \n    this.el.clear();\n    var pal = (Palete.Gtk) _this.project.palete;\n    var pkgs = pal.packages(_this.project);\n    print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);\n\n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < pkgs.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   pkgs.get(i) ); // title \n        this.el.set_value(citer, 1,   items.contains(pkgs.get(i)) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
-                 "$ columns" : "    typeof(string),  // 0 key type\n      typeof(bool)",
-                 "$ xns" : "Gtk"
+                 "| void load" : [
+                  "() {",
+                  " ",
+                  "    var def = _this.project.compilegroups.get(\"_default_\");",
+                  "    var items  = def.packages;",
+                  "    ",
+                  "    this.el.clear();",
+                  "    var pal = (Palete.Gtk) _this.project.palete;",
+                  "    var pkgs = pal.packages(_this.project);",
+                  "    print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);",
+                  "",
+                  "    Gtk.TreeIter citer;",
+                  "",
+                  "    for(var i =0 ; i < pkgs.size; i++) {",
+                  "         this.el.append(out citer);   ",
+                  "         ",
+                  "        this.el.set_value(citer, 0,   pkgs.get(i) ); // title ",
+                  "        this.el.set_value(citer, 1,   items.contains(pkgs.get(i)) );",
+                  "    }",
+                  "    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+                  "    ",
+                  "}",
+                  ""
+                 ]
                 },
                 {
-                 "utf8 title" : "package name",
-                 "* init" : " \n this.el.add_attribute(_this.packages_render.el , \"text\", 0 );\n  ",
+                 "$ xns" : "Gtk",
+                 "* init" : [
+                  " ",
+                  " this.el.add_attribute(_this.packages_render.el , \"text\", 0 );",
+                  "  "
+                 ],
                  "* pack" : "append_column",
-                 "xtype" : "TreeViewColumn",
-                 "gboolean resizable" : true,
                  "gboolean expand" : true,
-                 "$ xns" : "Gtk",
+                 "gboolean resizable" : true,
                  "items" : [
                   {
-                   "id" : "packages_render",
+                   "$ xns" : "Gtk",
                    "* pack" : "pack_start,false",
-                   "xtype" : "CellRendererText",
-                   "$ xns" : "Gtk"
+                   "id" : "packages_render",
+                   "xtype" : "CellRendererText"
                   }
-                 ]
+                 ],
+                 "utf8 title" : "package name",
+                 "xtype" : "TreeViewColumn"
                 },
                 {
-                 "utf8 title" : "use",
-                 "* init" : "{\n this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );\n }",
+                 "$ xns" : "Gtk",
+                 "* init" : [
+                  "{",
+                  " this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );",
+                  " }"
+                 ],
                  "* pack" : "append_column",
-                 "xtype" : "TreeViewColumn",
                  "gboolean resizable" : false,
-                 "$ xns" : "Gtk",
                  "gint fixed_width" : 50,
                  "items" : [
                   {
+                   "$ xns" : "Gtk",
+                   "* pack" : "pack_start,false",
+                   "gboolean activatable" : true,
+                   "id" : "packages_render_use",
                    "listeners" : {
-                    "toggled" : "(  path_string) =>  { \n    var m = _this.default_packages_tree_store.el;\n   Gtk.TreeIter iter;\n   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n   m.get_iter (out iter, path);\n   GLib.Value val;\n   m.get_value(iter, 1, out val);\n   m.set_value(iter, 1,  ((bool) val) ? false :true); \n     GLib.Value fval;  \n   m.get_value(iter, 0, out fval);\n   var fn = (string)fval;\n    \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    if ((bool)val) {\n        // renive\n        items.remove(fn);\n    } else {\n        items.add(fn);\n    }\n    \n}"
+                    "toggled" : [
+                     "(  path_string) =>  { ",
+                     "    var m = _this.default_packages_tree_store.el;",
+                     "   Gtk.TreeIter iter;",
+                     "   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
+                     "   m.get_iter (out iter, path);",
+                     "   GLib.Value val;",
+                     "   m.get_value(iter, 1, out val);",
+                     "   m.set_value(iter, 1,  ((bool) val) ? false :true); ",
+                     "     GLib.Value fval;  ",
+                     "   m.get_value(iter, 0, out fval);",
+                     "   var fn = (string)fval;",
+                     "    ",
+                     "    var def = _this.project.compilegroups.get(\"_default_\");",
+                     "    var items  = def.packages;",
+                     "    if ((bool)val) {",
+                     "        // renive",
+                     "        items.remove(fn);",
+                     "    } else {",
+                     "        items.add(fn);",
+                     "    }",
+                     "    ",
+                     "}"
+                    ]
                    },
-                   "id" : "packages_render_use",
-                   "xtype" : "CellRendererToggle",
-                   "* pack" : "pack_start,false",
-                   "$ xns" : "Gtk",
-                   "gboolean activatable" : true
+                   "xtype" : "CellRendererToggle"
                   }
-                 ]
+                 ],
+                 "utf8 title" : "use",
+                 "xtype" : "TreeViewColumn"
                 }
-               ]
+               ],
+               "string id" : "default_packages_tree",
+               "xtype" : "TreeView"
               }
-             ]
+             ],
+             "xtype" : "ScrolledWindow"
             },
             {
-             "bool hexpand" : true,
-             "xtype" : "ScrolledWindow",
-             "* pack" : "add2",
              "$ xns" : "Gtk",
+             "* pack" : "add2",
+             "bool hexpand" : true,
              "items" : [
               {
-               "listeners" : {
-                "button_press_event" : " ( ev) => {\n    //console.log(\"button press?\");\n   \n    \n    if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {\n        //print(\"click\" + ev.type);\n        return false;\n    }\n    //Gtk.TreePath res;\n    //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n    //    return true;\n    //}\n     \n  //  this.el.get_selection().select_path(res);\n     \n      //if (!this.get('/LeftTreeMenu').el)  { \n      //      this.get('/LeftTreeMenu').init(); \n      //  }\n        \n     _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());\n     _this.default_directory_menu.el.show_all();\n      _this.default_directory_menu.el.popup(null, null, null,  3, ev.time);\n     //   print(\"click:\" + res.path.to_string());\n      return true;\n}"
-               },
+               "$ xns" : "Gtk",
+               "* pack" : "add",
                "gboolean headers_visible" : true,
                "id" : "default_directory_tree",
-               "* pack" : "add",
-               "xtype" : "TreeView",
-               "$ xns" : "Gtk",
                "items" : [
                 {
-                 "id" : "default_directory_tree_store",
+                 "$ columns" : [
+                  "    typeof(string)",
+                  "     "
+                 ],
+                 "$ n_columns" : 1,
+                 "$ xns" : "Gtk",
                  "* pack" : "set_model",
+                 "id" : "default_directory_tree_store",
                  "xtype" : "ListStore",
-                 "$ n_columns" : 1,
-                 "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.sources;\n     \n \n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < items.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   items.get(i) ); // title \n        //this.el.set_value(citer, 1,   items.get(i) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
-                 "$ columns" : "    typeof(string)\n     ",
-                 "$ xns" : "Gtk"
+                 "| void load" : [
+                  "() {",
+                  " ",
+                  "  this.el.clear();",
+                  "  ",
+                  "    ",
+                  "     var def = _this.project.compilegroups.get(\"_default_\");",
+                  "     var items  = def.sources;",
+                  "     ",
+                  " ",
+                  "    Gtk.TreeIter citer;",
+                  "",
+                  "    for(var i =0 ; i < items.size; i++) {",
+                  "         this.el.append(out citer);   ",
+                  "         ",
+                  "        this.el.set_value(citer, 0,   items.get(i) ); // title ",
+                  "        //this.el.set_value(citer, 1,   items.get(i) );",
+                  "    }",
+                  "    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+                  "    ",
+                  "}",
+                  ""
+                 ]
                 },
                 {
-                 "utf8 title" : "Available Directories (right click to add)",
-                 "* init" : "\n this.el.add_attribute(_this.directory_render.el , \"text\", 0 );\n   ",
+                 "$ xns" : "Gtk",
+                 "* init" : [
+                  "",
+                  " this.el.add_attribute(_this.directory_render.el , \"text\", 0 );",
+                  "   "
+                 ],
                  "* pack" : "append_column",
-                 "xtype" : "TreeViewColumn",
                  "gboolean resizable" : true,
-                 "$ xns" : "Gtk",
                  "items" : [
                   {
-                   "id" : "directory_render",
+                   "$ xns" : "Gtk",
                    "* pack" : "pack_start,false",
-                   "xtype" : "CellRendererText",
-                   "$ xns" : "Gtk"
+                   "id" : "directory_render",
+                   "xtype" : "CellRendererText"
                   }
-                 ]
+                 ],
+                 "utf8 title" : "Available Directories (right click to add)",
+                 "xtype" : "TreeViewColumn"
                 }
-               ]
+               ],
+               "listeners" : {
+                "button_press_event" : [
+                 " ( ev) => {",
+                 "    //console.log(\"button press?\");",
+                 "   ",
+                 "    ",
+                 "    if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {",
+                 "        //print(\"click\" + ev.type);",
+                 "        return false;",
+                 "    }",
+                 "    //Gtk.TreePath res;",
+                 "    //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
+                 "    //    return true;",
+                 "    //}",
+                 "     ",
+                 "  //  this.el.get_selection().select_path(res);",
+                 "     ",
+                 "      //if (!this.get('/LeftTreeMenu').el)  { ",
+                 "      //      this.get('/LeftTreeMenu').init(); ",
+                 "      //  }",
+                 "        ",
+                 "     _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());",
+                 "     _this.default_directory_menu.el.show_all();",
+                 "      _this.default_directory_menu.el.popup(null, null, null,  3, ev.time);",
+                 "     //   print(\"click:\" + res.path.to_string());",
+                 "      return true;",
+                 "}"
+                ]
+               },
+               "xtype" : "TreeView"
               },
               {
-               "id" : "default_directory_menu",
-               "xtype" : "Menu",
                "$ xns" : "Gtk",
+               "id" : "default_directory_menu",
                "items" : [
                 {
+                 "$ xns" : "Gtk",
+                 "* pack" : "add",
                  "listeners" : {
-                  "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
+                  "activate" : [
+                   "()  => {",
+                   "    ",
+                   "    var  chooser = new Gtk.FileChooserDialog (",
+                   "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,",
+                   "\t\"_Cancel\",",
+                   "\tGtk.ResponseType.CANCEL,",
+                   "\t\"_Add\",",
+                   "\tGtk.ResponseType.ACCEPT);",
+                   "    if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
+                   "        chooser.close ();",
+                   "           return;",
+                   "       }",
+                   "       chooser.close ();",
+                   "       // add the directory..",
+                   "       var fn = _this.project.relPath(chooser.get_filename());",
+                   "       _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
+                   "       _this.default_directory_tree_store.load();",
+                   "}"
+                  ]
                  },
-                 "* pack" : "add",
-                 "xtype" : "MenuItem",
-                 "$ xns" : "Gtk",
-                 "utf8 label" : "Add Directory"
+                 "utf8 label" : "Add Directory",
+                 "xtype" : "MenuItem"
                 },
                 {
+                 "$ xns" : "Gtk",
+                 "* pack" : "add",
                  "listeners" : {
-                  "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
+                  "activate" : [
+                   "()  => {",
+                   "    ",
+                   "    var  chooser = new Gtk.FileChooserDialog (",
+                   "\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,",
+                   "\t\"_Cancel\",",
+                   "\tGtk.ResponseType.CANCEL,",
+                   "\t\"_Add\",",
+                   "\tGtk.ResponseType.ACCEPT);",
+                   "    if (chooser.run () != Gtk.ResponseType.ACCEPT) {",
+                   "        chooser.close ();",
+                   "           return;",
+                   "       }",
+                   "       chooser.close ();",
+                   "       // add the directory..",
+                   "       var fn = _this.project.relPath(chooser.get_filename());",
+                   "       _this.project.compilegroups.get(\"_default_\").sources.add(fn);",
+                   "       _this.default_directory_tree_store.load();",
+                   "}"
+                  ]
                  },
-                 "* pack" : "add",
-                 "xtype" : "MenuItem",
-                 "$ xns" : "Gtk",
-                 "utf8 label" : "Add File"
+                 "utf8 label" : "Add File",
+                 "xtype" : "MenuItem"
                 },
                 {
+                 "$ xns" : "Gtk",
                  "* pack" : "add",
-                 "xtype" : "SeparatorMenuItem",
-                 "$ xns" : "Gtk"
+                 "xtype" : "SeparatorMenuItem"
                 },
                 {
+                 "$ xns" : "Gtk",
+                 "* pack" : "add",
                  "listeners" : {
-                  "activate" : "()  => {\n    \n     //\n        Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {\n               print(\"nothing selected\\n\");\n            return;\n        }\n\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       print(\"remove: %s\\n\", fn);\n       if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {\n                  print(\"remove failed\");\n              }\n       _this.default_directory_tree_store.load();\n}"
+                  "activate" : [
+                   "()  => {",
+                   "    ",
+                   "     //",
+                   "        Gtk.TreeModel mod;",
+                   "        Gtk.TreeIter iter;",
+                   "        if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {",
+                   "               print(\"nothing selected\\n\");",
+                   "            return;",
+                   "        }",
+                   "",
+                   "            ",
+                   "       // add the directory..",
+                   "       ",
+                   "       ",
+                   "       GLib.Value val;",
+                   "        mod.get_value(iter,0, out val);",
+                   "       var fn =  (string) val;",
+                   "       ",
+                   "       print(\"remove: %s\\n\", fn);",
+                   "       if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {",
+                   "                  print(\"remove failed\");",
+                   "              }",
+                   "       _this.default_directory_tree_store.load();",
+                   "}"
+                  ]
                  },
-                 "* pack" : "add",
-                 "xtype" : "MenuItem",
-                 "$ xns" : "Gtk",
-                 "utf8 label" : "Remove File/Directory"
+                 "utf8 label" : "Remove File/Directory",
+                 "xtype" : "MenuItem"
                 }
-               ]
+               ],
+               "xtype" : "Menu"
               }
-             ]
+             ],
+             "xtype" : "ScrolledWindow"
             }
-           ]
+           ],
+           "xtype" : "Paned"
           }
-         ]
+         ],
+         "xtype" : "Box"
         },
         {
-         "gint position" : 300,
-         "xtype" : "Paned",
-         "* pack" : "append_page,_this.label_targets.el",
          "$ xns" : "Gtk",
+         "* pack" : "append_page,_this.label_targets.el",
          "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+         "gint position" : 300,
          "items" : [
           {
-           "* init" : "{  \nthis.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n\n}\n",
-           "xtype" : "ScrolledWindow",
-           "* pack" : "add1",
            "$ xns" : "Gtk",
+           "* init" : [
+            "{  ",
+            "this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+            "",
+            "}",
+            ""
+           ],
+           "* pack" : "add1",
            "items" : [
             {
-             "id" : "targets_tree_menu",
-             "* pack" : "add",
-             "xtype" : "Menu",
              "$ xns" : "Gtk",
+             "* pack" : "add",
+             "id" : "targets_tree_menu",
              "items" : [
               {
+               "$ xns" : "Gtk",
+               "* pack" : "add",
                "listeners" : {
-                "activate" : "()  => {\n    \n       if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {\n        return;\n    }\n      \n       // add the directory..\n       \n       _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));\n       _this.targets_tree_store.load();\n}"
+                "activate" : [
+                 "()  => {",
+                 "    ",
+                 "       if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {",
+                 "        return;",
+                 "    }",
+                 "      ",
+                 "       // add the directory..",
+                 "       ",
+                 "       _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));",
+                 "       _this.targets_tree_store.load();",
+                 "}"
+                ]
                },
-               "* pack" : "add",
-               "xtype" : "MenuItem",
-               "$ xns" : "Gtk",
-               "utf8 label" : "Add Compile Target"
+               "utf8 label" : "Add Compile Target",
+               "xtype" : "MenuItem"
               },
               {
+               "$ xns" : "Gtk",
                "* pack" : "add",
-               "xtype" : "SeparatorMenuItem",
-               "$ xns" : "Gtk"
+               "xtype" : "SeparatorMenuItem"
               },
               {
+               "$ xns" : "Gtk",
+               "* pack" : "add",
                "listeners" : {
-                "activate" : "()  => {\n    \n     //\n        Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {\n               print(\"nothing selected\\n\");\n            return;\n        }\n\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       print(\"remove: %s\\n\", fn);\n       if (!_this.project.compilegroups.unset(fn)) {\n                  print(\"remove failed\");\n      }\n       _this.targets_tree_store.load();\n}"
+                "activate" : [
+                 "()  => {",
+                 "    ",
+                 "     //",
+                 "        Gtk.TreeModel mod;",
+                 "        Gtk.TreeIter iter;",
+                 "        if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {",
+                 "               print(\"nothing selected\\n\");",
+                 "            return;",
+                 "        }",
+                 "",
+                 "            ",
+                 "       // add the directory..",
+                 "       ",
+                 "       ",
+                 "       GLib.Value val;",
+                 "        mod.get_value(iter,0, out val);",
+                 "       var fn =  (string) val;",
+                 "       ",
+                 "       print(\"remove: %s\\n\", fn);",
+                 "       if (!_this.project.compilegroups.unset(fn)) {",
+                 "                  print(\"remove failed\");",
+                 "      }",
+                 "       _this.targets_tree_store.load();",
+                 "}"
+                ]
                },
-               "* pack" : "add",
-               "xtype" : "MenuItem",
-               "$ xns" : "Gtk",
-               "utf8 label" : "Remove Target"
+               "utf8 label" : "Remove Target",
+               "xtype" : "MenuItem"
               }
-             ]
+             ],
+             "xtype" : "Menu"
             },
             {
-             "listeners" : {
-              "button_press_event" : " ( ev) => {\n    //console.log(\"button press?\");\n   \n    \n    if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {\n        //print(\"click\" + ev.type);\n        return false;\n    }\n    //Gtk.TreePath res;\n    //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n    //    return true;\n    //}\n     \n  //  this.el.get_selection().select_path(res);\n     \n      //if (!this.get('/LeftTreeMenu').el)  { \n      //      this.get('/LeftTreeMenu').init(); \n      //  }\n        \n     _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());\n     _this.targets_tree_menu.el.show_all();\n      _this.targets_tree_menu.el.popup(null, null, null,  3, ev.time);\n     //   print(\"click:\" + res.path.to_string());\n      return true;\n}",
-              "cursor_changed" : " ( ) => {\n\n    if (this.cursor != \"\") {\n         // save the values..\n     }\n     \n     // load the new values.\n     \n\n         Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!this.el.get_selection().get_selected(out mod, out iter)) {\n            print(\"nothing selected\\n\");\n            // should disable the right hand side..\n            _this.set_vbox.el.hide();\n            return;\n        }\n        _this.set_vbox.el.show();\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       this.cursor = fn;\n       var cg = _this.project.compilegroups.get(fn);\n       \n       _this.build_pack_target.el.set_text(cg.target_bin);\n       _this.build_compile_flags.el.set_text(cg.compile_flags);\n\t\t_this.build_execute_args.el.set_text(cg.execute_args);\n       \n       _this.set_vbox.cgroup = cg;\n       _this.files_tree_store.update();\n       \n       // load the srouces\n\n\n  }"
-             },
-             "id" : "targets_tree",
              "# string cursor" : "",
-             "* pack" : "add",
-             "xtype" : "TreeView",
              "$ xns" : "Gtk",
+             "* pack" : "add",
+             "id" : "targets_tree",
              "items" : [
               {
+               "$ columns" : [
+                "    typeof(string),  // 0 key type",
+                "     typeof(string) // ??",
+                "     "
+               ],
+               "$ n_columns" : 2,
+               "$ xns" : "Gtk",
+               "* pack" : "set_model",
                "id" : "targets_tree_store",
                "xtype" : "ListStore",
-               "* pack" : "set_model",
-               "$ n_columns" : 2,
-               "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var cg = _this.project.compilegroups;\n     \n   _this.targets_tree.cursor = \"\";\n    Gtk.TreeIter citer;\n    var iter = cg.map_iterator();\n   while(iter.next()) {\n        var key = iter.get_key();\n        if (key == \"_default_\") {\n            continue;\n        }\n    \n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   key ); // title \n        //this.el.set_value(citer, 1,   items.get(i) );\n    };\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    _this.set_vbox.el.hide();\n}\n",
-               "$ columns" : "    typeof(string),  // 0 key type\n     typeof(string) // ??\n     ",
-               "$ xns" : "Gtk"
+               "| void load" : [
+                "() {",
+                " ",
+                "  this.el.clear();",
+                "  ",
+                "    ",
+                "     var cg = _this.project.compilegroups;",
+                "     ",
+                "   _this.targets_tree.cursor = \"\";",
+                "    Gtk.TreeIter citer;",
+                "    var iter = cg.map_iterator();",
+                "   while(iter.next()) {",
+                "        var key = iter.get_key();",
+                "        if (key == \"_default_\") {",
+                "            continue;",
+                "        }",
+                "    ",
+                "         this.el.append(out citer);   ",
+                "         ",
+                "        this.el.set_value(citer, 0,   key ); // title ",
+                "        //this.el.set_value(citer, 1,   items.get(i) );",
+                "    };",
+                "    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+                "    _this.set_vbox.el.hide();",
+                "}",
+                ""
+               ]
               },
               {
-               "utf8 title" : "name",
-               "* init" : " {\n     this.el.add_attribute(_this.targets_render.el , \"text\", 0 );\n }",
+               "$ xns" : "Gtk",
+               "* init" : [
+                " {",
+                "     this.el.add_attribute(_this.targets_render.el , \"text\", 0 );",
+                " }"
+               ],
                "* pack" : "append_column",
-               "xtype" : "TreeViewColumn",
                "gboolean resizable" : true,
-               "$ xns" : "Gtk",
                "items" : [
                 {
+                 "$ xns" : "Gtk",
+                 "* pack" : "pack_start,false",
+                 "gboolean editable" : true,
+                 "id" : "targets_render",
                  "listeners" : {
-                  "edited" : "  (path, newtext) => {\n     \n     Gtk.TreeIter  iter;\n        _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n       GLib.Value gval;\n        _this.targets_tree_store.el.get_value(iter,0, out gval);\n        var oldval = (string)gval;\n       if (oldval == newtext) {\n          return;\n        }\n         var cg = _this.project.compilegroups.get(oldval);\n        cg.name = newtext;\n        _this.project.compilegroups.unset(oldval);\n        _this.project.compilegroups.set(newtext, cg);\n       _this.targets_tree_store.load();\n  }"
+                  "edited" : [
+                   "  (path, newtext) => {",
+                   "     ",
+                   "     Gtk.TreeIter  iter;",
+                   "        _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));",
+                   "       GLib.Value gval;",
+                   "        _this.targets_tree_store.el.get_value(iter,0, out gval);",
+                   "        var oldval = (string)gval;",
+                   "       if (oldval == newtext) {",
+                   "          return;",
+                   "        }",
+                   "         var cg = _this.project.compilegroups.get(oldval);",
+                   "        cg.name = newtext;",
+                   "        _this.project.compilegroups.unset(oldval);",
+                   "        _this.project.compilegroups.set(newtext, cg);",
+                   "       _this.targets_tree_store.load();",
+                   "  }"
+                  ]
                  },
-                 "id" : "targets_render",
-                 "xtype" : "CellRendererText",
-                 "* pack" : "pack_start,false",
-                 "$ xns" : "Gtk",
-                 "gboolean editable" : true
+                 "xtype" : "CellRendererText"
                 }
-               ]
+               ],
+               "utf8 title" : "name",
+               "xtype" : "TreeViewColumn"
               }
-             ]
+             ],
+             "listeners" : {
+              "button_press_event" : [
+               " ( ev) => {",
+               "    //console.log(\"button press?\");",
+               "   ",
+               "    ",
+               "    if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {",
+               "        //print(\"click\" + ev.type);",
+               "        return false;",
+               "    }",
+               "    //Gtk.TreePath res;",
+               "    //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
+               "    //    return true;",
+               "    //}",
+               "     ",
+               "  //  this.el.get_selection().select_path(res);",
+               "     ",
+               "      //if (!this.get('/LeftTreeMenu').el)  { ",
+               "      //      this.get('/LeftTreeMenu').init(); ",
+               "      //  }",
+               "        ",
+               "     _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());",
+               "     _this.targets_tree_menu.el.show_all();",
+               "      _this.targets_tree_menu.el.popup(null, null, null,  3, ev.time);",
+               "     //   print(\"click:\" + res.path.to_string());",
+               "      return true;",
+               "}"
+              ],
+              "cursor_changed" : [
+               " ( ) => {",
+               "",
+               "    if (this.cursor != \"\") {",
+               "         // save the values..",
+               "     }",
+               "     ",
+               "     // load the new values.",
+               "     ",
+               "",
+               "         Gtk.TreeModel mod;",
+               "        Gtk.TreeIter iter;",
+               "        if (!this.el.get_selection().get_selected(out mod, out iter)) {",
+               "            print(\"nothing selected\\n\");",
+               "            // should disable the right hand side..",
+               "            _this.set_vbox.el.hide();",
+               "            return;",
+               "        }",
+               "        _this.set_vbox.el.show();",
+               "            ",
+               "       // add the directory..",
+               "       ",
+               "       ",
+               "       GLib.Value val;",
+               "        mod.get_value(iter,0, out val);",
+               "       var fn =  (string) val;",
+               "       ",
+               "       this.cursor = fn;",
+               "       var cg = _this.project.compilegroups.get(fn);",
+               "       ",
+               "       _this.build_pack_target.el.set_text(cg.target_bin);",
+               "       _this.build_compile_flags.el.set_text(cg.compile_flags);",
+               "\t\t_this.build_execute_args.el.set_text(cg.execute_args);",
+               "       ",
+               "       _this.set_vbox.cgroup = cg;",
+               "       _this.files_tree_store.update();",
+               "       ",
+               "       // load the srouces",
+               "",
+               "",
+               "  }"
+              ]
+             },
+             "xtype" : "TreeView"
             }
-           ]
+           ],
+           "xtype" : "ScrolledWindow"
           },
           {
-           "id" : "set_vbox",
-           "xtype" : "Box",
-           "* pack" : "add2",
-           "gboolean homogeneous" : false,
-           "$ xns" : "Gtk",
            "# Project.GtkValaSettings cgroup" : "null",
+           "$ xns" : "Gtk",
+           "* pack" : "add2",
            "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
+           "gboolean homogeneous" : false,
+           "id" : "set_vbox",
            "items" : [
             {
-             "xtype" : "Label",
-             "* pack" : "pack_start,false,false,0",
              "$ xns" : "Gtk",
-             "utf8 label" : "target filename"
+             "* pack" : "pack_start,false,false,0",
+             "utf8 label" : "target filename",
+             "xtype" : "Label"
             },
             {
+             "$ xns" : "Gtk",
+             "* pack" : "pack_start,false,false,0",
+             "id" : "build_pack_target",
              "listeners" : {
-              "changed" : "()  => {\n        if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;\n}"
+              "changed" : [
+               "()  => {",
+               "        if (_this.targets_tree.cursor.length < 1) {",
+               "        return;",
+               "    }",
+               "    _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;",
+               "}"
+              ]
              },
-             "id" : "build_pack_target",
-             "xtype" : "Entry",
-             "* pack" : "pack_start,false,false,0",
-             "$ xns" : "Gtk"
+             "xtype" : "Entry"
             },
             {
-             "xtype" : "Label",
-             "* pack" : "pack_start,false,false,0",
              "$ xns" : "Gtk",
-             "utf8 label" : "compile flags"
+             "* pack" : "pack_start,false,false,0",
+             "utf8 label" : "compile flags",
+             "xtype" : "Label"
             },
             {
+             "$ xns" : "Gtk",
+             "* pack" : "pack_start,false,false,0",
+             "id" : "build_compile_flags",
              "listeners" : {
-              "changed" : "() => {\n    if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;\n}"
+              "changed" : [
+               "() => {",
+               "    if (_this.targets_tree.cursor.length < 1) {",
+               "        return;",
+               "    }",
+               "    _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;",
+               "}"
+              ]
              },
-             "id" : "build_compile_flags",
-             "xtype" : "Entry",
-             "* pack" : "pack_start,false,false,0",
-             "$ xns" : "Gtk"
+             "xtype" : "Entry"
             },
             {
-             "xtype" : "Label",
-             "* pack" : "pack_start,false,false,0",
              "$ xns" : "Gtk",
-             "utf8 label" : "test argments - when run after a build"
+             "* pack" : "pack_start,false,false,0",
+             "utf8 label" : "test argments - when run after a build",
+             "xtype" : "Label"
             },
             {
+             "$ xns" : "Gtk",
+             "* pack" : "pack_start,false,false,0",
+             "id" : "build_execute_args",
              "listeners" : {
-              "changed" : "() => {\n    if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;\n}"
+              "changed" : [
+               "() => {",
+               "    if (_this.targets_tree.cursor.length < 1) {",
+               "        return;",
+               "    }",
+               "    _this.project.compilegroups.get(_this.targets_tree.cursor).execute_args = this.el.text;",
+               "}"
+              ]
              },
-             "id" : "build_execute_args",
              "string placeholder_text" : "eg.  -f somefile -g ",
-             "xtype" : "Entry",
-             "* pack" : "pack_start,false,false,0",
-             "$ xns" : "Gtk"
+             "xtype" : "Entry"
             },
             {
-             "xtype" : "Label",
-             "* pack" : "pack_start,false,false,0",
              "$ xns" : "Gtk",
-             "utf8 label" : "Files to compile"
+             "* pack" : "pack_start,false,false,0",
+             "utf8 label" : "Files to compile",
+             "xtype" : "Label"
             },
             {
-             "* pack" : "pack_start,true,true,0",
-             "xtype" : "ScrolledWindow",
              "$ xns" : "Gtk",
+             "* pack" : "pack_start,true,true,0",
              "items" : [
               {
-               "xtype" : "TreeView",
-               "* pack" : "add",
-               "string id" : "files_tree",
                "$ xns" : "Gtk",
+               "* pack" : "add",
                "items" : [
                 {
-                 "id" : "files_tree_store",
-                 "xtype" : "ListStore",
-                 "* pack" : "set_model",
-                 "| void updateDir" : "(string dname, bool bval) {\n  \n  Gtk.TreeIter citer;\n\n    var cg =   _this.set_vbox.cgroup;\n  for(var i =0 ; i < this.el.iter_n_children(null); i++) {\n        this.el.iter_nth_child(out citer,null,i);\n\n        GLib.Value val;\n        this.el.get_value(citer,0, out val);\n        var fn = (string) val;\n        \n        if ( Path.get_dirname (fn) == dname) {\n        \n            this.el.set_value(citer, 3,   bval ); // checked \n           \n     \n     \n            if (!bval) {\n                // renive\n                if (cg.sources.contains(fn)) {\n                    cg.sources.remove(fn);\n                }\n            } else {\n                if (!cg.sources.contains(fn)) {\n                    cg.sources.add(fn);\n                }\n            }\n            \n            \n        }\n    }\n\n}\n",
+                 "$ columns" : [
+                  "    typeof(string),  // 0 file name",
+                  "        typeof(string),  // 0 basename",
+                  "     typeof(string), // type (dir orfile)",
+                  "     typeof(bool)  // is checked.",
+                  "     "
+                 ],
                  "$ n_columns" : 4,
-                 "| void load" : "() {\n \n      this.el.clear();\n  \n    \n     var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.sources;\n     \n     \n     \n     \n \n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < items.size; i++) {\n    \n         var files = _this.project.filesForCompile(items.get(i), false);\n         if (files.size < 1) {\n            continue;\n         }\n    \n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   items.get(i) ); // title \n        this.el.set_value(citer, 1,   \"<span foreground=\\\"green\\\" font_weight=\\\"bold\\\">\" + \n                    GLib.Markup.escape_text(items.get(i)) + \"</span>\"\n            ); // title \n        print(\"ADD item %s\", items.get(i));\n        this.el.set_value(citer, 2,   \"dir\"); // type         \n        this.el.set_value(citer, 3,   false ); // checked \n\n       \n        \n         for(var j =0 ; j < files.size; j++) {\n            this.el.append(out citer);   \n             print(\"ADD item %s\", files.get(j));\n            this.el.set_value(citer, 0,   files.get(j) ); // title \n            this.el.set_value(citer, 1,   GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title             \n            this.el.set_value(citer, 2,   \"file\"); // type         \n            this.el.set_value(citer, 3,   false ); // checked \n\n        }\n        \n        \n        //this.el.set_value(citer, 1,   items.get(i) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    if (_this.set_vbox.cgroup == null) {\n\t\t_this.set_vbox.el.set_sensitive(false);\n    \n    }\n}\n ",
-                 "$ columns" : "    typeof(string),  // 0 file name\n        typeof(string),  // 0 basename\n     typeof(string), // type (dir orfile)\n     typeof(bool)  // is checked.\n     ",
                  "$ xns" : "Gtk",
-                 "| void update" : "() {\n\n\n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < this.el.iter_n_children(null); i++) {\n        this.el.iter_nth_child(out citer,null,i);\n\n        GLib.Value val;\n        this.el.get_value(citer,0, out val);\n        var fn = (string) val;\n        \n        var active = false;\n        if (_this.set_vbox.cgroup.sources.contains(fn)) {\n            active = true;\n        }\n        \n        this.el.set_value(citer, 3,   active ); // checked \n    }\n\n     _this.set_vbox.el.set_sensitive(true);\n}\n"
+                 "* pack" : "set_model",
+                 "id" : "files_tree_store",
+                 "xtype" : "ListStore",
+                 "| void load" : [
+                  "() {",
+                  " ",
+                  "      this.el.clear();",
+                  "  ",
+                  "    ",
+                  "     var def = _this.project.compilegroups.get(\"_default_\");",
+                  "     var items  = def.sources;",
+                  "     ",
+                  "     ",
+                  "     ",
+                  "     ",
+                  " ",
+                  "    Gtk.TreeIter citer;",
+                  "",
+                  "    for(var i =0 ; i < items.size; i++) {",
+                  "    ",
+                  "         var files = _this.project.filesForCompile(items.get(i), false);",
+                  "         if (files.size < 1) {",
+                  "            continue;",
+                  "         }",
+                  "    ",
+                  "         this.el.append(out citer);   ",
+                  "         ",
+                  "        this.el.set_value(citer, 0,   items.get(i) ); // title ",
+                  "        this.el.set_value(citer, 1,   \"<span foreground=\\\"green\\\" font_weight=\\\"bold\\\">\" + ",
+                  "                    GLib.Markup.escape_text(items.get(i)) + \"</span>\"",
+                  "            ); // title ",
+                  "        print(\"ADD item %s\", items.get(i));",
+                  "        this.el.set_value(citer, 2,   \"dir\"); // type         ",
+                  "        this.el.set_value(citer, 3,   false ); // checked ",
+                  "",
+                  "       ",
+                  "        ",
+                  "         for(var j =0 ; j < files.size; j++) {",
+                  "            this.el.append(out citer);   ",
+                  "             print(\"ADD item %s\", files.get(j));",
+                  "            this.el.set_value(citer, 0,   files.get(j) ); // title ",
+                  "            this.el.set_value(citer, 1,   GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title             ",
+                  "            this.el.set_value(citer, 2,   \"file\"); // type         ",
+                  "            this.el.set_value(citer, 3,   false ); // checked ",
+                  "",
+                  "        }",
+                  "        ",
+                  "        ",
+                  "        //this.el.set_value(citer, 1,   items.get(i) );",
+                  "    }",
+                  "    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
+                  "    if (_this.set_vbox.cgroup == null) {",
+                  "\t\t_this.set_vbox.el.set_sensitive(false);",
+                  "    ",
+                  "    }",
+                  "}",
+                  " "
+                 ],
+                 "| void update" : [
+                  "() {",
+                  "",
+                  "",
+                  "    Gtk.TreeIter citer;",
+                  "",
+                  "    for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
+                  "        this.el.iter_nth_child(out citer,null,i);",
+                  "",
+                  "        GLib.Value val;",
+                  "        this.el.get_value(citer,0, out val);",
+                  "        var fn = (string) val;",
+                  "        ",
+                  "        var active = false;",
+                  "        if (_this.set_vbox.cgroup.sources.contains(fn)) {",
+                  "            active = true;",
+                  "        }",
+                  "        ",
+                  "        this.el.set_value(citer, 3,   active ); // checked ",
+                  "    }",
+                  "",
+                  "     _this.set_vbox.el.set_sensitive(true);",
+                  "}",
+                  ""
+                 ],
+                 "| void updateDir" : [
+                  "(string dname, bool bval) {",
+                  "  ",
+                  "  Gtk.TreeIter citer;",
+                  "",
+                  "    var cg =   _this.set_vbox.cgroup;",
+                  "  for(var i =0 ; i < this.el.iter_n_children(null); i++) {",
+                  "        this.el.iter_nth_child(out citer,null,i);",
+                  "",
+                  "        GLib.Value val;",
+                  "        this.el.get_value(citer,0, out val);",
+                  "        var fn = (string) val;",
+                  "        ",
+                  "        if ( Path.get_dirname (fn) == dname) {",
+                  "        ",
+                  "            this.el.set_value(citer, 3,   bval ); // checked ",
+                  "           ",
+                  "     ",
+                  "     ",
+                  "            if (!bval) {",
+                  "                // renive",
+                  "                if (cg.sources.contains(fn)) {",
+                  "                    cg.sources.remove(fn);",
+                  "                }",
+                  "            } else {",
+                  "                if (!cg.sources.contains(fn)) {",
+                  "                    cg.sources.add(fn);",
+                  "                }",
+                  "            }",
+                  "            ",
+                  "            ",
+                  "        }",
+                  "    }",
+                  "",
+                  "}",
+                  ""
+                 ]
                 },
                 {
-                 "utf8 title" : "name",
-                 "* init" : "\n this.el.add_attribute(_this.files_render.el , \"markup\", 1 ); // basnemae\n \n/*  this.el.add_attribute(_this.files_render.el , \"markup\", 2 );\n*/",
+                 "$ xns" : "Gtk",
+                 "* init" : [
+                  "",
+                  " this.el.add_attribute(_this.files_render.el , \"markup\", 1 ); // basnemae",
+                  " ",
+                  "/*  this.el.add_attribute(_this.files_render.el , \"markup\", 2 );",
+                  "*/"
+                 ],
                  "* pack" : "append_column",
-                 "xtype" : "TreeViewColumn",
                  "gboolean resizable" : true,
-                 "$ xns" : "Gtk",
                  "items" : [
                   {
-                   "id" : "files_render",
+                   "$ xns" : "Gtk",
                    "* pack" : "pack_start,false",
-                   "xtype" : "CellRendererText",
-                   "$ xns" : "Gtk"
+                   "id" : "files_render",
+                   "xtype" : "CellRendererText"
                   }
-                 ]
+                 ],
+                 "utf8 title" : "name",
+                 "xtype" : "TreeViewColumn"
                 },
                 {
-                 "utf8 title" : "use",
-                 "* init" : "{\n this.el.add_attribute(_this.files_render_use.el , \"active\", 3 );\n }",
+                 "$ xns" : "Gtk",
+                 "* init" : [
+                  "{",
+                  " this.el.add_attribute(_this.files_render_use.el , \"active\", 3 );",
+                  " }"
+                 ],
                  "* pack" : "append_column",
-                 "xtype" : "TreeViewColumn",
                  "gboolean resizable" : false,
-                 "$ xns" : "Gtk",
                  "gint fixed_width" : 50,
                  "items" : [
                   {
+                   "$ xns" : "Gtk",
+                   "* pack" : "pack_start,false",
+                   "gboolean activatable" : true,
+                   "id" : "files_render_use",
                    "listeners" : {
-                    "toggled" : "(  path_string) =>  { \n\n\n\n    var m = _this.files_tree_store.el;\n   Gtk.TreeIter iter;\n   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n   m.get_iter (out iter, path);\n   GLib.Value val;\n   m.get_value(iter, 3, out val);\n   m.set_value(iter, 3,  ((bool) val) ? false :true); \n   \n   // type.\n   GLib.Value ftval;  \n   m.get_value(iter, 2, out ftval);\n   var ftype = (string)ftval;   \n   \n   // full name...  \n   GLib.Value fval;     \n   m.get_value(iter, 0, out fval);\n   var fn = (string)fval;\n    \n    \n    var cg =   _this.set_vbox.cgroup;\n    // what's the sleected target?\n    // update the list..\n    // if ftype is a dir == then toggle all the bellow.\n    \n    if (ftype == \"dir\") {\n        _this.files_tree_store.updateDir(fn,  ((bool) val) ? false :true);\n    }\n    \n    // if ftype is a file .. see if all the files in that directory are check and check the dir.\n\n     \n    if ((bool)val) {\n        // renive\n        cg.sources.remove(fn);\n    } else {\n        cg.sources.add(fn);\n    }\n    \n}"
+                    "toggled" : [
+                     "(  path_string) =>  { ",
+                     "",
+                     "",
+                     "",
+                     "    var m = _this.files_tree_store.el;",
+                     "   Gtk.TreeIter iter;",
+                     "   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);",
+                     "   m.get_iter (out iter, path);",
+                     "   GLib.Value val;",
+                     "   m.get_value(iter, 3, out val);",
+                     "   m.set_value(iter, 3,  ((bool) val) ? false :true); ",
+                     "   ",
+                     "   // type.",
+                     "   GLib.Value ftval;  ",
+                     "   m.get_value(iter, 2, out ftval);",
+                     "   var ftype = (string)ftval;   ",
+                     "   ",
+                     "   // full name...  ",
+                     "   GLib.Value fval;     ",
+                     "   m.get_value(iter, 0, out fval);",
+                     "   var fn = (string)fval;",
+                     "    ",
+                     "    ",
+                     "    var cg =   _this.set_vbox.cgroup;",
+                     "    // what's the sleected target?",
+                     "    // update the list..",
+                     "    // if ftype is a dir == then toggle all the bellow.",
+                     "    ",
+                     "    if (ftype == \"dir\") {",
+                     "        _this.files_tree_store.updateDir(fn,  ((bool) val) ? false :true);",
+                     "    }",
+                     "    ",
+                     "    // if ftype is a file .. see if all the files in that directory are check and check the dir.",
+                     "",
+                     "     ",
+                     "    if ((bool)val) {",
+                     "        // renive",
+                     "        cg.sources.remove(fn);",
+                     "    } else {",
+                     "        cg.sources.add(fn);",
+                     "    }",
+                     "    ",
+                     "}"
+                    ]
                    },
-                   "id" : "files_render_use",
-                   "xtype" : "CellRendererToggle",
-                   "* pack" : "pack_start,false",
-                   "$ xns" : "Gtk",
-                   "gboolean activatable" : true
+                   "xtype" : "CellRendererToggle"
                   }
-                 ]
+                 ],
+                 "utf8 title" : "use",
+                 "xtype" : "TreeViewColumn"
                 }
-               ]
+               ],
+               "string id" : "files_tree",
+               "xtype" : "TreeView"
               }
-             ]
+             ],
+             "xtype" : "ScrolledWindow"
             }
-           ]
+           ],
+           "xtype" : "Box"
           }
-         ]
+         ],
+         "xtype" : "Paned"
         }
-       ]
+       ],
+       "xtype" : "Notebook"
       }
-     ]
+     ],
+     "xtype" : "Box"
+    },
+    {
+     "$ 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" : [
+         "() => { ",
+         "",
+         "  _this.done = true;",
+         "    _this.el.hide(); ",
+         "}"
+        ]
+       },
+       "string label" : "Cancel",
+       "xtype" : "Button"
+      },
+      {
+       "$ xns" : "Gtk",
+       "* pack" : "add",
+       "id" : "save_btn",
+       "listeners" : {
+        "clicked" : [
+         "( ) =>  { ",
+         "",
+         " ",
+         "",
+         "",
+         "\tif (_this.name.el.get_text().length  < 1) {",
+         "\t    Xcls_StandardErrorDialog.singleton().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\tXcls_StandardErrorDialog.singleton().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\tXcls_StandardErrorDialog.singleton().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);",
+         "   ",
+         "}"
+        ]
+       },
+       "string label" : "Save",
+       "xtype" : "Button"
+      }
+     ],
+     "xtype" : "HButtonBox"
     }
+   ],
+   "listeners" : {
+    "hide" : [
+     "() => {",
+     "\t_this.project.writeConfig();",
+     "",
+     "}"
+    ]
+   },
+   "uint border_width" : 0,
+   "xtype" : "Popover",
+   "| void save" : [
+    "()  {",
+    "    this.project.writeConfig(); ",
+    "}"
+   ],
+   "| void show" : [
+    "(Gtk.Widget btn, Project.Gtk project) {",
+    "     ",
+    "    //print(\"ValaProjectSettings show\\n\");",
+    "    ",
+    "    this.project=  project;",
+    "",
+    "    this.compile_flags.el.text = _this.project.compilegroups.get(\"_default_\").compile_flags;",
+    "    ",
+    "    this.default_directory_tree_store.load();    ",
+    "    this.default_packages_tree_store.load();            ",
+    "    this.targets_tree_store.load();",
+    "    this.files_tree_store.load();",
+    "",
+    "",
+    "\tthis.el.set_modal(true);",
+    "\tthis.el.set_relative_to(btn);",
+    "",
+    "\tthis.el.set_position(Gtk.PositionType.RIGHT);",
+    "",
+    "\t// window + header?",
+    "\t// print(\"SHOWALL - POPIP\\n\");",
+    "\tthis.el.set_size_request(800,500);",
+    "\tthis.el.show_all();",
+    "\t//this.view.el.grab_focus();",
+    "",
+    "}",
+    ""
    ]
   }
- ]
+ ],
+ "modOrder" : "",
+ "name" : "ValaProjectSettingsPopover",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/ValaProjectSettingsPopover.bjs",
+ "permname" : "",
+ "title" : ""
 }
\ No newline at end of file
index 099656b..1ef4578 100644 (file)
@@ -15,6 +15,7 @@ public class Xcls_ValaProjectSettingsPopover : Object
     public Xcls_label_global label_global;
     public Xcls_label_targets label_targets;
     public Xcls_compile_flags compile_flags;
+    public Xcls_default_packages_tree default_packages_tree;
     public Xcls_default_packages_tree_store default_packages_tree_store;
     public Xcls_packages_render packages_render;
     public Xcls_packages_render_use packages_render_use;
@@ -30,9 +31,11 @@ public class Xcls_ValaProjectSettingsPopover : Object
     public Xcls_build_pack_target build_pack_target;
     public Xcls_build_compile_flags build_compile_flags;
     public Xcls_build_execute_args build_execute_args;
+    public Xcls_files_tree files_tree;
     public Xcls_files_tree_store files_tree_store;
     public Xcls_files_render files_render;
     public Xcls_files_render_use files_render_use;
+    public Xcls_save_btn save_btn;
 
         // my vars (def)
     public Xcls_MainWindow window;
@@ -55,6 +58,9 @@ public class Xcls_ValaProjectSettingsPopover : Object
         var child_0 = new Xcls_Box2( _this );
         child_0.ref();
         this.el.add (  child_0.el  );
+        var child_1 = new Xcls_HButtonBox52( _this );
+        child_1.ref();
+        this.el.pack_end (  child_1.el , false,true,0 );
 
         //listeners
         this.el.hide.connect( () => {
@@ -346,6 +352,7 @@ public class Xcls_ValaProjectSettingsPopover : Object
         public Xcls_default_packages_tree(Xcls_ValaProjectSettingsPopover _owner )
         {
             _this = _owner;
+            _this.default_packages_tree = this;
             this.el = new Gtk.TreeView();
 
             // my vars (dec)
@@ -378,8 +385,8 @@ public class Xcls_ValaProjectSettingsPopover : Object
         {
             _this = _owner;
             _this.default_packages_tree_store = this;
-            this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 key type
-      typeof(bool) );
+            this.el = new Gtk.ListStore.newv(  {     typeof(string),  // 0 key type
+      typeof(bool) }  );
 
             // my vars (dec)
 
@@ -572,6 +579,7 @@ public class Xcls_ValaProjectSettingsPopover : Object
             this.el.add (  child_0.el  );
             var child_1 = new Xcls_default_directory_menu( _this );
             child_1.ref();
+            this.el.add(  child_1.el );
         }
 
         // user defined functions
@@ -645,8 +653,8 @@ public class Xcls_ValaProjectSettingsPopover : Object
         {
             _this = _owner;
             _this.default_directory_tree_store = this;
-            this.el = new Gtk.ListStore( 1,     typeof(string)
-      );
+            this.el = new Gtk.ListStore.newv(  {     typeof(string)
+      }  );
 
             // my vars (dec)
 
@@ -1236,9 +1244,9 @@ public class Xcls_ValaProjectSettingsPopover : Object
         {
             _this = _owner;
             _this.targets_tree_store = this;
-            this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 key type
+            this.el = new Gtk.ListStore.newv(  {     typeof(string),  // 0 key type
      typeof(string) // ??
-      );
+      }  );
 
             // my vars (dec)
 
@@ -1616,6 +1624,7 @@ public class Xcls_ValaProjectSettingsPopover : Object
         public Xcls_files_tree(Xcls_ValaProjectSettingsPopover _owner )
         {
             _this = _owner;
+            _this.files_tree = this;
             this.el = new Gtk.TreeView();
 
             // my vars (dec)
@@ -1647,11 +1656,11 @@ public class Xcls_ValaProjectSettingsPopover : Object
         {
             _this = _owner;
             _this.files_tree_store = this;
-            this.el = new Gtk.ListStore( 4,     typeof(string),  // 0 file name
+            this.el = new Gtk.ListStore.newv(  {     typeof(string),  // 0 file name
         typeof(string),  // 0 basename
      typeof(string), // type (dir orfile)
      typeof(bool)  // is checked.
-      );
+      }  );
 
             // my vars (dec)
 
@@ -1659,6 +1668,28 @@ public class Xcls_ValaProjectSettingsPopover : Object
         }
 
         // user defined functions
+        public void update () {
+        
+        
+            Gtk.TreeIter citer;
+        
+            for(var i =0 ; i < this.el.iter_n_children(null); i++) {
+                this.el.iter_nth_child(out citer,null,i);
+        
+                GLib.Value val;
+                this.el.get_value(citer,0, out val);
+                var fn = (string) val;
+                
+                var active = false;
+                if (_this.set_vbox.cgroup.sources.contains(fn)) {
+                    active = true;
+                }
+                
+                this.el.set_value(citer, 3,   active ); // checked 
+            }
+        
+             _this.set_vbox.el.set_sensitive(true);
+        }
         public void updateDir (string dname, bool bval) {
           
           Gtk.TreeIter citer;
@@ -1745,28 +1776,6 @@ public class Xcls_ValaProjectSettingsPopover : Object
             
             }
         }
-        public void update () {
-        
-        
-            Gtk.TreeIter citer;
-        
-            for(var i =0 ; i < this.el.iter_n_children(null); i++) {
-                this.el.iter_nth_child(out citer,null,i);
-        
-                GLib.Value val;
-                this.el.get_value(citer,0, out val);
-                var fn = (string) val;
-                
-                var active = false;
-                if (_this.set_vbox.cgroup.sources.contains(fn)) {
-                    active = true;
-                }
-                
-                this.el.set_value(citer, 3,   active ); // checked 
-            }
-        
-             _this.set_vbox.el.set_sensitive(true);
-        }
     }
 
     public class Xcls_TreeViewColumn48 : Object
@@ -1935,4 +1944,222 @@ public class Xcls_ValaProjectSettingsPopover : Object
 
 
 
+    public class Xcls_HButtonBox52 : Object
+    {
+        public Gtk.HButtonBox el;
+        private Xcls_ValaProjectSettingsPopover  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_HButtonBox52(Xcls_ValaProjectSettingsPopover _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HButtonBox();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.margin_right = 4;
+            this.el.margin_left = 4;
+            this.el.margin_bottom = 4;
+            var child_0 = new Xcls_Button53( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_save_btn( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+        }
+
+        // user defined functions
+    }
+    public class Xcls_Button53 : Object
+    {
+        public Gtk.Button el;
+        private Xcls_ValaProjectSettingsPopover  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Button53(Xcls_ValaProjectSettingsPopover _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Cancel";
+
+            //listeners
+            this.el.clicked.connect( () => { 
+            
+              _this.done = true;
+                _this.el.hide(); 
+            });
+        }
+
+        // user defined functions
+    }
+
+    public class Xcls_save_btn : Object
+    {
+        public Gtk.Button el;
+        private Xcls_ValaProjectSettingsPopover  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_save_btn(Xcls_ValaProjectSettingsPopover _owner )
+        {
+            _this = _owner;
+            _this.save_btn = this;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Save";
+
+            //listeners
+            this.el.clicked.connect( ( ) =>  { 
+            
+             
+            
+            
+               if (_this.name.el.get_text().length  < 1) {
+                   Xcls_StandardErrorDialog.singleton().show(
+                       _this.mainwindow.el,
+                       "You have to set Component name "
+                   );
+                    
+                   return;
+               }
+               // what does this do?
+               
+               var isNew = _this.file.name.length  > 0 ? false : true;
+               /*
+               if (!isNew && this.file.name != _this.name.el.get_text()) {
+                   Xcls_StandardErrorDialog.singleton().show(
+                       this.el,
+                       "Sorry changing names does not work yet. "
+                   );
+                    
+                   return;
+               }
+               */
+                
+               
+              
+               // FIXME - this may be more complicated...
+               //for (var i in this.def) {
+               //    this.file[i] =  this.get(i).el.get_text();
+               //}
+            
+               if (!isNew) {
+                   try {
+                        _this.updateFileFromEntry();
+                    } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
+                         Xcls_StandardErrorDialog.singleton().show(
+                           _this.mainwindow.el,
+                           "The name you used already exists "
+                       );
+                       return;
+                        
+                    }
+            
+                     _this.done = true;
+                   _this.file.save();
+                   _this.el.hide();
+                   return;
+               }
+               
+               // ---------------- NEW FILES...
+               Gtk.TreeIter iter;
+            
+               if (!_this.filetype.el.get_active_iter(out iter)) {
+                       // should not happen...
+                       // so we are jut going to return without 
+                       Xcls_StandardErrorDialog.singleton().show(
+                       _this.mainwindow.el,
+                       "You must select a file type. "
+                   );
+                   return;
+                        
+               }
+               
+               
+               var fn = _this.name.el.get_text();
+               
+               Value ftypename;
+               _this.ftdbmodel.el.get_value (iter, 0, out ftypename);
+               var ext = ((string)ftypename);
+               var dir = _this.project.firstPath(); 
+               if (ext != "bjs") {
+                
+                       if (!_this.dir.el.get_active_iter(out iter)) {
+                               // should not happen...
+                               // so we are jut going to return without 
+                               Xcls_StandardErrorDialog.singleton().show(
+                                   _this.mainwindow.el,
+                                   "You must select a directory "
+                               );
+                               return;
+                       }
+                       Value vdir;
+                       _this.dirmodel.el.get_value (iter, 0, out vdir);
+                       dir = (string)vdir;
+               }
+               
+               var targetfile = dir + "/" + fn;
+               
+               // strip the file type off the end..
+               
+               
+                var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
+                targetfile = rx.replace(targetfile, targetfile.length, 0, ""); 
+               
+               if (GLib.FileUtils.test(targetfile + "." + ext, GLib.FileTest.EXISTS)) {
+                   Xcls_StandardErrorDialog.singleton().show(
+                       _this.mainwindow.el,
+                       "That file already exists"
+                   ); 
+                   return;
+               }
+               
+               var f =  JsRender.JsRender.factory(
+                       ext == "bjs" ? _this.file.project.xtype : "PlainFile",  
+                       _this.file.project, 
+                       targetfile + "." + ext);
+            
+               _this.file = f;
+               
+            
+               
+               _this.updateFileFromEntry();
+               _this.file.loaded = true;
+               _this.file.save();
+               if (ext == "bjs") {
+                       _this.file.project.addFile(_this.file);
+               }
+               
+             
+               // what about .js ?
+               _this.done = true;
+               _this.el.hide();
+            
+            // hopefull this will work with bjs files..
+               
+               _this.success(_this.project, _this.file);
+               
+            });
+        }
+
+        // user defined functions
+    }
+
+
 }