new files need adding to full file list
[roobuilder] / src / Builder4 / PopoverFileDetails.vala
index abc6952..94ab8c9 100644 (file)
-static Xcls_PopoverFileDetails  _PopoverFileDetails;
+    static Xcls_PopoverFileDetails  _PopoverFileDetails;
 
-public class Xcls_PopoverFileDetails : Object
-{
-    public Gtk.Popover el;
-    private Xcls_PopoverFileDetails  _this;
-
-    public static Xcls_PopoverFileDetails singleton()
+    public class Xcls_PopoverFileDetails : Object
     {
-        if (_PopoverFileDetails == null) {
-            _PopoverFileDetails= new Xcls_PopoverFileDetails();
+        public Gtk.Window el;
+        private Xcls_PopoverFileDetails  _this;
+
+        public static Xcls_PopoverFileDetails singleton()
+        {
+            if (_PopoverFileDetails == null) {
+                _PopoverFileDetails= new Xcls_PopoverFileDetails();
+            }
+            return _PopoverFileDetails;
         }
-        return _PopoverFileDetails;
-    }
-    public Xcls_grid grid;
-    public Xcls_filetypelbl filetypelbl;
-    public Xcls_filetype filetype;
-    public Xcls_ftdbcellrenderer ftdbcellrenderer;
-    public Xcls_ftdbmodel ftdbmodel;
-    public Xcls_name name;
-    public Xcls_title title;
-    public Xcls_region region;
-    public Xcls_parent parent;
-    public Xcls_permname permname;
-    public Xcls_modOrder modOrder;
-    public Xcls_build_module build_module;
-    public Xcls_dbcellrenderer dbcellrenderer;
-    public Xcls_dbmodel dbmodel;
-    public Xcls_dir dir;
-    public Xcls_dircellrenderer dircellrenderer;
-    public Xcls_dirmodel dirmodel;
-    public Xcls_save_btn save_btn;
-
-        // my vars (def)
-    public bool new_window;
-    public signal void success (Project.Project pr, JsRender.JsRender file);
-    public JsRender.JsRender file;
-    public Project.Project project;
-    public Xcls_MainWindow mainwindow;
-    public bool done;
-
-    // ctor
-    public Xcls_PopoverFileDetails()
-    {
-        _this = this;
-        this.el = new Gtk.Popover( null );
-
-        // my vars (dec)
-        this.new_window = true;
-        this.file = null;
-        this.mainwindow = null;
-        this.done = false;
-
-        // set gobject values
-        this.el.border_width = 0;
-        this.el.modal = true;
-        this.el.position = Gtk.PositionType.RIGHT;
-        var child_0 = new Xcls_Box2( _this );
-        child_0.ref();
-        this.el.add (  child_0.el  );
-
-        //listeners
-        this.el.closed.connect( () => {
-          if (!this.done) {
-            _this.el.show();
-          
-          }
-        });
-        this.el.hide.connect( ( ) => {
-        
-         if (!this.done) {
-            _this.el.show();
-          
-          }
-        });
-    }
+        public Xcls_grid grid;
+        public Xcls_filetype_lbl filetype_lbl;
+        public Xcls_filetype filetype;
+        public Xcls_filetype_model filetype_model;
+        public Xcls_dir_dropdown_lbl dir_dropdown_lbl;
+        public Xcls_dir_dropdown dir_dropdown;
+        public Xcls_dir_model dir_model;
+        public Xcls_name_lbl name_lbl;
+        public Xcls_name name;
+        public Xcls_title_lbl title_lbl;
+        public Xcls_title title;
+        public Xcls_region_lbl region_lbl;
+        public Xcls_region region;
+        public Xcls_parent_lbl parent_lbl;
+        public Xcls_parent parent;
+        public Xcls_permname_lbl permname_lbl;
+        public Xcls_permname permname;
+        public Xcls_modOrder_lbl modOrder_lbl;
+        public Xcls_modOrder modOrder;
+        public Xcls_build_module_lbl build_module_lbl;
+        public Xcls_build_module build_module;
+        public Xcls_build_module_model build_module_model;
+        public Xcls_path_lbl path_lbl;
+        public Xcls_path path;
+        public Xcls_gen_lbl gen_lbl;
+        public Xcls_gen gen;
+        public Xcls_save_btn save_btn;
 
-    // user defined functions
-    public void show (JsRender.JsRender c, Gtk.Widget btn, bool new_window) 
-    {
-        this.project = c.project;
-        this.done = false;
-        this.new_window = new_window;
-        
-        //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);
-    
+            // my vars (def)
+        public bool is_new;
+        public bool new_window;
+        public signal void success (Project.Project pr, JsRender.JsRender file);
+        public JsRender.JsRender file;
+        public Project.Project project;
+        public uint border_width;
+        public bool done;
+        public Xcls_MainWindow mainwindow;
+
+        // ctor
+        public Xcls_PopoverFileDetails()
+        {
+            _this = this;
+            this.el = new Gtk.Window();
+
+            // my vars (dec)
+            this.is_new = true;
+            this.new_window = true;
+            this.file = null;
+            this.border_width = 0;
+            this.done = false;
+            this.mainwindow = null;
+
+            // set gobject values
+            this.el.title = "Add / Edit File";
+            this.el.modal = true;
+            var child_1 = new Xcls_Box2( _this );
+            child_1.ref();
+            this.el.set_child ( child_1.el  );
+            var child_2 = new Xcls_HeaderBar29( _this );
+            this.el.titlebar = child_2.el;
+
+            //listeners
+            this.el.close_request.connect( ( ) => {
+               _this.el.hide();
+               return true;
+            });
+        }
+
+        // user defined functions
+        public void onDirChanged () {
+        if (this.dir_dropdown.el.selected == Gtk.INVALID_LIST_POSITION) {
+                       this.build_module_lbl.el.hide();
+                       this.build_module.el.hide();
+                       this.name_lbl.el.hide();
+                       this.name.el.hide();
+                        
+               this.gen_lbl.el.hide();
+                       this.gen.el.hide();
+            
+                       return;
+                       
+               
+               }
+               // directory selected
+               var sel = this.filetype.getValue();
+               
+               if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
+                       this.build_module_lbl.el.show();
+                       this.build_module.el.show();
+               }
+               this.name_lbl.el.show();
+               this.name.el.show();
+               
+               if (sel == "bjs") {
+                _this.gen_lbl.el.show();
+                _this.gen.el.show();
+            }
+            
+            if (this.file.project.xtype == "Roo" && sel == "bjs") {
+               this.title_lbl.el.show();
+                       this.title.el.show();
+                       
+                       this.region_lbl.el.show();
+                       this.region.el.show();
+                       
+                       this.parent_lbl.el.show();
+                       this.parent.el.show();
+                       
+                       this.permname_lbl.el.show();
+                       this.permname.el.show();
+                       
+                       this.modOrder_lbl.el.show();
+                       this.modOrder.el.show();
+               }
+            
+                
+        }
+        public void showEditFile () {
+               this.save_btn.el.set_label("Save");
+               this.filetype_lbl.el.hide();
+               this.filetype.el.hide();
+                        
+               var sel = this.filetype.getValue();
+               switch(_this.project.xtype) {
+                       case "Roo":      
+                                if (sel == "bjs") {
+                                       _this.title_lbl.el.show();
+                                       _this.title.el.show();
+                                       
+                                       _this.region_lbl.el.show();
+                                       _this.region.el.show();
+                                       
+                                       _this.parent_lbl.el.show();
+                                       _this.parent.el.show();
+                                       
+                                       _this.permname_lbl.el.show();
+                                       _this.permname.el.show();
+                                       
+                                       _this.modOrder_lbl.el.show();
+                                       _this.modOrder.el.show();
+                               
+                               }
+                               break;
+                       default:
+                               _this.build_module_lbl.el.show();
+                               _this.build_module.el.show();   
+                               
+                               if (sel == "bjs") {
+                               
+                                        _this.gen_lbl.el.show();
+                                       _this.gen.el.show();
+                               }
+                               break;
+               }
+               this.path.el.show();
+               this.path_lbl.el.show();
+               this.path.el.set_text(_this.file.relpath);
         }
+        public void show (JsRender.JsRender  c, Gtk.Window pwin, bool new_window) 
+        {
+            
+            this.project = c.project;
+            this.done = false;
+            this.new_window = new_window;
+            
+            //if (!this.el) {
+                //this.init();
+             //} 
+             
+              this.is_new = c.name == "";
         
+            _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);
          
-        _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();
-        
+           _this.gen.el.active = c.gen_extended;
+           
         
+            
+            if (this.project.xtype == "Gtk") {
+               var p = (Project.Gtk) this.project;
+                   this.build_module_model.load(p.compilegroups);
+                   // it will select first if available...
+                   // only for new files.
+                   if (!this.is_new) {
+                           this.build_module.setValue(c.build_module);
+                   }
+            }
+                    
+             
+            _this.file = c;
+           
+           // this.el.set_size_request( 550, 100); // should expand height, but give  a min width.
         
-        if (c.path.length > 0) {
-           this.save_btn.el.set_label("Save");
-               _this.filetype.el.hide();
-               _this.filetypelbl.el.hide();
-               _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..
-           _this.filetype.el.show();
-           _this.filetypelbl.el.show();
+            this.el.set_transient_for(pwin);
+            
+            // window + header?
+             this.hideAll();
+            this.el.show();
+           // this.name.el.grab_focus();
+            
+            
+            if (!this.is_new) {
+                  this.showEditFile();
+            } else {
+               this.showNewFile();
+                        
+              
+                   
+            }
+            
+            
+            //this.success = c.success;
+            
+            
         }
+        public 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();
+                _this.file.gen_extended = _this.gen.el.active;
+                var new_name =  _this.name.el.get_text();
+                if (_this.file.name.length  > 0 && _this.file.name != new_name) {
+                    try {
+                       _this.file.renameTo( new_name );
+                       } catch (JsRender.Error e) { } // do nothing?
+                }
+                
+                _this.file.build_module = _this.build_module.getValue();
+                       
+                
+                
         
-        //this.success = c.success;
-        
-        
-    }
-    public 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();
+                                                            
+        }
+        public void onFileTypeChange () {
+               if (this.filetype.el.selected == Gtk.INVALID_LIST_POSITION) {
+                       this.dir_dropdown.el.hide();
+                       this.dir_dropdown_lbl.el.hide();
+                       this.build_module_lbl.el.hide();
+                       this.build_module.el.hide();
+                       this.name_lbl.el.hide();
+                       this.name.el.hide();
+                
+               this.gen_lbl.el.hide();
+                       this.gen.el.hide();
+            
             
-            if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {
-                _this.file.renameTo(_this.name.el.get_text());
+               this.title_lbl.el.hide();
+                       this.title.el.hide();
+                       
+                       this.region_lbl.el.hide();
+                       this.region.el.hide();
+                       
+                       this.parent_lbl.el.hide();
+                       this.parent.el.hide();
+                       
+                       this.permname_lbl.el.hide();
+                       this.permname.el.hide();
+                       
+                       this.modOrder_lbl.el.hide();
+                       this.modOrder.el.hide();
+         
+                       return;
+                        
+               }
+               
+               this.dir_dropdown.el.show();
+               this.dir_dropdown_lbl.el.show();
+               var sel = this.filetype.getValue();
+               
+               var old_sel = _this.dir_dropdown.el.selected != Gtk.INVALID_LIST_POSITION;
+               var olddir = this.dir_dropdown.getValue();
+               GLib.debug("old dir = %s", olddir);
+               if (this.file.project.xtype=="Gtk" && (sel == "bjs" || sel == "vala")) {
+                       _this.project.loadDirsToStringList(_this.dir_model.el, "/src");
+                       if (old_sel && olddir.has_prefix("/src")) {
+                               this.dir_dropdown.setValue(olddir);
+                       } else {
+                            _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
+                   }
+                 
+               } else {
+        
+                _this.project.loadDirsToStringList(_this.dir_model.el, "");
+                       if (old_sel) {
+                               this.dir_dropdown.setValue(olddir);
+                       } else {
+                            _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
+                    }
+               
             }
-            // 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;
-                 }
         
+         
+            // is this confusing?  - should we just strip out / add if necessary..
+            if (sel == "bjs" || sel == "vala" || sel == "js" || sel == "css" || sel == "php") {
+                _this.name_lbl.el.label = "Component Name (Filename with-out extension)";                               
+            } else {
+                   _this.name_lbl.el.label = "File Name (with extension)";
             }
-            
-            
-    
-                                                        
-    }
-    public class Xcls_Box2 : Object
-    {
-        public Gtk.Box el;
-        private Xcls_PopoverFileDetails  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_Box2(Xcls_PopoverFileDetails _owner )
+         
+        }
+        public void showNewFile () {
+               this.save_btn.el.set_label("Create");
+               this.hideAll();
+               this.filetype.el.show();
+            this.filetype_lbl.el.show();
+            this.filetype_model.load();
+               this.filetype.el.selected = Gtk.INVALID_LIST_POSITION;
+         
+                   
+        }
+        public void hideAll () {
+        
+               // exiting only
+               this.path_lbl.el.hide();
+            this.path.el.hide();
+             
+            // new 
+            this.name_lbl.el.hide();
+            this.name.el.hide();
+            //new 
+            this.dir_dropdown_lbl.el.hide();
+            this.dir_dropdown.el.hide();
+               // roo
+               this.title_lbl.el.hide();
+               this.title.el.hide();
+               
+               this.region_lbl.el.hide();
+               this.region.el.hide();
+               
+               this.parent_lbl.el.hide();
+               this.parent.el.hide();
+               
+               this.permname_lbl.el.hide();
+               this.permname.el.hide();
+               
+               this.modOrder_lbl.el.hide();
+               this.modOrder.el.hide();
+               
+               this.build_module_lbl.el.hide();
+               this.build_module.el.hide();
+               
+               this.gen_lbl.el.hide();
+               this.gen.el.hide();
+                       this.filetype_lbl.el.hide();
+                       this.filetype.el.hide();
+        }
+        public class Xcls_Box2 : Object
         {
-            _this = _owner;
-            this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+            public Gtk.Box el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.homogeneous = false;
-            var child_0 = new Xcls_HeaderBar3( _this );
-            child_0.ref();
-            this.el.pack_start (  child_0.el , false,true,0 );
-            var child_1 = new Xcls_grid( _this );
-            child_1.ref();
-            this.el.pack_start (  child_1.el , false,false,4 );
-            var child_2 = new Xcls_ButtonBox29( _this );
-            child_2.ref();
-            this.el.add (  child_2.el  );
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
-    public class Xcls_HeaderBar3 : Object
-    {
-        public Gtk.HeaderBar el;
-        private Xcls_PopoverFileDetails  _this;
+            // ctor
+            public Xcls_Box2(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
 
+                // my vars (dec)
 
-            // my vars (def)
+                // set gobject values
+                this.el.homogeneous = false;
+                this.el.margin_end = 4;
+                this.el.margin_start = 4;
+                this.el.hexpand = true;
+                this.el.margin_bottom = 4;
+                this.el.margin_top = 4;
+                new Xcls_grid( _this );
+                this.el.append ( _this.grid.el  );
+            }
 
-        // ctor
-        public Xcls_HeaderBar3(Xcls_PopoverFileDetails _owner )
+            // user defined functions
+        }
+        public class Xcls_grid : Object
         {
-            _this = _owner;
-            this.el = new Gtk.HeaderBar();
-
-            // my vars (dec)
+            public Gtk.Grid el;
+            private Xcls_PopoverFileDetails  _this;
+
+
+                // my vars (def)
+
+            // ctor
+            public Xcls_grid(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.grid = this;
+                this.el = new Gtk.Grid();
+
+                // my vars (dec)
+
+                // set gobject values
+                this.el.margin_end = 4;
+                this.el.margin_start = 4;
+                this.el.hexpand = true;
+                this.el.column_spacing = 4;
+                this.el.row_spacing = 2;
+                new Xcls_filetype_lbl( _this );
+                this.el.attach( _this.filetype_lbl.el, 0, 0, 1, 1 );
+                new Xcls_filetype( _this );
+                this.el.attach( _this.filetype.el, 1, 0, 1, 1 );
+                new Xcls_dir_dropdown_lbl( _this );
+                this.el.attach( _this.dir_dropdown_lbl.el, 0, 1, 1, 1 );
+                new Xcls_dir_dropdown( _this );
+                this.el.attach( _this.dir_dropdown.el, 1, 1, 1, 1 );
+                new Xcls_name_lbl( _this );
+                this.el.attach( _this.name_lbl.el, 0, 2, 1, 1 );
+                new Xcls_name( _this );
+                this.el.attach( _this.name.el, 1, 2, 1, 1 );
+                new Xcls_title_lbl( _this );
+                this.el.attach( _this.title_lbl.el, 0, 3, 1, 1 );
+                new Xcls_title( _this );
+                this.el.attach ( _this.title.el , 1,2,1,1 );
+                new Xcls_region_lbl( _this );
+                this.el.attach( _this.region_lbl.el, 0, 4, 1, 1 );
+                new Xcls_region( _this );
+                this.el.attach( _this.region.el, 1, 4, 1, 1 );
+                new Xcls_parent_lbl( _this );
+                this.el.attach( _this.parent_lbl.el, 0, 5, 1, 1 );
+                new Xcls_parent( _this );
+                this.el.attach( _this.parent.el, 1, 5, 1, 1 );
+                new Xcls_permname_lbl( _this );
+                this.el.attach( _this.permname_lbl.el, 0, 6, 1, 1 );
+                new Xcls_permname( _this );
+                this.el.attach( _this.permname.el, 1, 6, 1, 1 );
+                new Xcls_modOrder_lbl( _this );
+                this.el.attach( _this.modOrder_lbl.el, 0, 7, 1, 1 );
+                new Xcls_modOrder( _this );
+                this.el.attach( _this.modOrder.el, 1, 7, 1, 1 );
+                new Xcls_build_module_lbl( _this );
+                this.el.attach( _this.build_module_lbl.el, 0, 8, 1, 1 );
+                new Xcls_build_module( _this );
+                this.el.attach( _this.build_module.el, 1, 8, 1, 1 );
+                new Xcls_path_lbl( _this );
+                this.el.attach( _this.path_lbl.el, 0, 9, 1, 1 );
+                new Xcls_path( _this );
+                this.el.attach( _this.path.el, 1, 9, 1, 1 );
+                new Xcls_gen_lbl( _this );
+                this.el.attach( _this.gen_lbl.el, 0, 10, 1, 1 );
+                new Xcls_gen( _this );
+                this.el.attach( _this.gen.el, 1, 10, 1, 1 );
+            }
 
-            // set gobject values
-            this.el.title = "Add / Edit File";
+            // user defined functions
+            public void xhideRow (int row) 
+            {
+               var el = _this.grid.el.get_child_at(0,row);
+            
+               el.hide();
+               el = _this.grid.el.get_child_at(1,row);
+               el.hide();
+            
+            }
+            public void xshowAllRows () {
+               for (var i = 2; i < 10;i++) {
+                       var el = _this.grid.el.get_child_at(0,i);
+                       el.show();
+                       el = _this.grid.el.get_child_at(1,i);
+                       el.show();
+                }
+            }
         }
+        public class Xcls_filetype_lbl : Object
+        {
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-        // user defined functions
-    }
-
-    public class Xcls_grid : Object
-    {
-        public Gtk.Grid el;
-        private Xcls_PopoverFileDetails  _this;
 
+                // my vars (def)
 
-            // my vars (def)
+            // ctor
+            public Xcls_filetype_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.filetype_lbl = this;
+                this.el = new Gtk.Label( "File type" );
 
-        // ctor
-        public Xcls_grid(Xcls_PopoverFileDetails _owner )
-        {
-            _this = _owner;
-            _this.grid = this;
-            this.el = new Gtk.Grid();
+                // my vars (dec)
 
-            // my vars (dec)
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+            }
 
-            // set gobject values
-            this.el.margin_right = 4;
-            this.el.margin_left = 4;
-            this.el.row_spacing = 2;
-            var child_0 = new Xcls_filetypelbl( _this );
-            child_0.ref();
-            this.el.attach (  child_0.el , 0,0,1,1 );
-            var child_1 = new Xcls_filetype( _this );
-            child_1.ref();
-            this.el.attach (  child_1.el , 1,0,1,1 );
-            var child_2 = new Xcls_Label9( _this );
-            child_2.ref();
-            this.el.attach (  child_2.el , 0,1,1,1 );
-            var child_3 = new Xcls_name( _this );
-            child_3.ref();
-            this.el.attach (  child_3.el , 1,1,1,1 );
-            var child_4 = new Xcls_Label11( _this );
-            child_4.ref();
-            this.el.attach (  child_4.el , 0,2,1,1 );
-            var child_5 = new Xcls_title( _this );
-            child_5.ref();
-            this.el.attach (  child_5.el , 1,2,1,1 );
-            var child_6 = new Xcls_Label13( _this );
-            child_6.ref();
-            this.el.attach (  child_6.el , 0,3,1,1 );
-            var child_7 = new Xcls_region( _this );
-            child_7.ref();
-            this.el.attach (  child_7.el , 1,3,1,1 );
-            var child_8 = new Xcls_Label15( _this );
-            child_8.ref();
-            this.el.attach (  child_8.el , 0,4,1,1 );
-            var child_9 = new Xcls_parent( _this );
-            child_9.ref();
-            this.el.attach (  child_9.el , 1,4,1,1 );
-            var child_10 = new Xcls_Label17( _this );
-            child_10.ref();
-            this.el.attach (  child_10.el , 0,5,1,1 );
-            var child_11 = new Xcls_permname( _this );
-            child_11.ref();
-            this.el.attach (  child_11.el , 1,5,1,1 );
-            var child_12 = new Xcls_Label19( _this );
-            child_12.ref();
-            this.el.attach (  child_12.el , 0,6,1,1 );
-            var child_13 = new Xcls_modOrder( _this );
-            child_13.ref();
-            this.el.attach (  child_13.el , 1,6,1,1 );
-            var child_14 = new Xcls_Label21( _this );
-            child_14.ref();
-            this.el.attach (  child_14.el , 0,7,1,1 );
-            var child_15 = new Xcls_build_module( _this );
-            child_15.ref();
-            this.el.attach (  child_15.el , 1,7,1,1 );
-            var child_16 = new Xcls_Label25( _this );
-            child_16.ref();
-            this.el.attach (  child_16.el , 0,8,1,1 );
-            var child_17 = new Xcls_dir( _this );
-            child_17.ref();
-            this.el.attach (  child_17.el , 1,8,1,1 );
+            // user defined functions
         }
 
-        // user defined functions
-    }
-    public class Xcls_filetypelbl : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverFileDetails  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_filetypelbl(Xcls_PopoverFileDetails _owner )
+        public class Xcls_filetype : Object
         {
-            _this = _owner;
-            _this.filetypelbl = this;
-            this.el = new Gtk.Label( "File type" );
+            public Gtk.DropDown el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-        }
+                // my vars (def)
+            public bool in_showhide;
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_filetype(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.filetype = this;
+                new Xcls_filetype_model( _this );
+                this.el = new Gtk.DropDown( _this.filetype_model.el, null );
 
-    public class Xcls_filetype : Object
-    {
-        public Gtk.ComboBox el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
+                this.in_showhide = false;
 
+                // set gobject values
+                this.el.hexpand = true;
 
-            // my vars (def)
+                //listeners
+                this.el.notify["selected"].connect( () => {
+                
+                       _this.onFileTypeChange();
+                
+                 });
+            }
 
-        // ctor
-        public Xcls_filetype(Xcls_PopoverFileDetails _owner )
+            // user defined functions
+            public string getValue () {
+               
+               if (!_this.is_new) {
+                       return _this.file.xtype != "Plainfile" ? "bjs" :  _this.file.file_ext;
+               }
+               
+               if (this.el.selected == Gtk.INVALID_LIST_POSITION) {
+                       return "";
+               }
+               
+               return _this.filetype_model.el.get_string(this.el.selected).split(" ")[0];
+            }
+            public void setValue (string cur) {
+               var el  = _this.filetype_model.el;
+               for(var i= 0; i < el.get_n_items();i++)  {
+                       if (el.get_string(i).has_prefix(cur)) {
+                               this.el.selected = i;
+                               break;
+                       }
+               }
+            }
+        }
+        public class Xcls_filetype_model : Object
         {
-            _this = _owner;
-            _this.filetype = this;
-            this.el = new Gtk.ComboBox();
+            public Gtk.StringList el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            var child_0 = new Xcls_ftdbcellrenderer( _this );
-            child_0.ref();
-            this.el.pack_start (  child_0.el , true );
-            var child_1 = new Xcls_ftdbmodel( _this );
-            child_1.ref();
-            this.el.set_model (  child_1.el  );
+                // my vars (def)
 
-            // init method
+            // ctor
+            public Xcls_filetype_model(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.filetype_model = this;
+                this.el = new Gtk.StringList( {} );
 
-            this.el.add_attribute(_this.ftdbcellrenderer.el , "markup", 1 );
+                // my vars (dec)
 
-            //listeners
-            this.el.changed.connect( () => {
-               Gtk.TreeIter iter;
-               bool is_bjs = true;
-               if (this.el.get_active_iter(out iter)) {
-                       Value vfname;
-                       _this.ftdbmodel.el.get_value (iter, 0, out vfname);
-                        is_bjs = ((string)vfname) == "bjs";
+                // set gobject values
+            }
+
+            // user defined functions
+            public void load () {
+                var el = this.el;
+                
+                while (el.get_n_items() > 0) {
+                       el.remove(0);
                }
+               el.append("bjs - User Interface File");
+             
                 
-              
-                // directory is only available for non-bjs 
-                this.showhide(is_bjs);
+             switch(_this.project.xtype) {
+               case "Roo":
+                       el.append("js - Javascript File");
+                       el.append("css - CSS File");
+                       el.append("php - Javascript File");
+                       
+                       break;
             
+               case "Gtk":             
+                               
+                       el.append("vala - Vala File");
+                       el.append("css - CSS File");
+                       el.append("other - Other Type");
+                       break;
+                default : 
+                       break;
+               }
             
-            });
-        }
-
-        // user defined functions
-        public void showhide (bool is_bjs) {
-        
-        
-               if (_this.project.xtype != "Roo") {
-                       is_bjs = false;
-               }
-        
-               for (var i = 2; i < 9;i++) {
-                       var el = _this.grid.el.get_child_at(0,i);
-                       
-                       var showhide= is_bjs;
-                       if (i> 7) {
-                               showhide = !showhide;
-                       }
-                       
-                       if (showhide) {
-                          el.show();
-                       } else {
-                               el.hide();
-                       }
-                        el = _this.grid.el.get_child_at(1,i);
-                       if (showhide) {
-                          el.show();
-                       } else {
-                               el.hide();
-                       }     
+               
+               
+               
             }
-            // load up the directories
-            //??? why can we not create bjs files in other directories??
-               //if (!is_bjs && _this.file.path.length < 1) {
-               
-                       _this.dirmodel.loadData();
-                       
-                       
-               //}
-           
-            
         }
-    }
-    public class Xcls_ftdbcellrenderer : Object
-    {
-        public Gtk.CellRendererText el;
-        private Xcls_PopoverFileDetails  _this;
-
 
-            // my vars (def)
 
-        // ctor
-        public Xcls_ftdbcellrenderer(Xcls_PopoverFileDetails _owner )
+        public class Xcls_dir_dropdown_lbl : Object
         {
-            _this = _owner;
-            _this.ftdbcellrenderer = this;
-            this.el = new Gtk.CellRendererText();
-
-            // my vars (dec)
-
-            // set gobject values
-        }
-
-        // user defined functions
-    }
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-    public class Xcls_ftdbmodel : Object
-    {
-        public Gtk.ListStore el;
-        private Xcls_PopoverFileDetails  _this;
 
+                // my vars (def)
 
-            // my vars (def)
+            // ctor
+            public Xcls_dir_dropdown_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.dir_dropdown_lbl = this;
+                this.el = new Gtk.Label( "Create File in this Directory" );
 
-        // ctor
-        public Xcls_ftdbmodel(Xcls_PopoverFileDetails _owner )
-        {
-            _this = _owner;
-            _this.ftdbmodel = this;
-            this.el = new Gtk.ListStore.newv(  { typeof(string),typeof(string) }  );
+                // my vars (dec)
 
-            // my vars (dec)
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.visible = true;
+            }
 
-            // set gobject values
+            // user defined functions
         }
 
-        // user defined functions
-        public 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");
-               if (cur == "vala") {
-                   _this.filetype.el.set_active_iter(iter);
-            }
-        
-        
-        
-            el.append(out iter);
-            
-            el.set_value(iter, 0, "js");
-            el.set_value(iter, 1, "Javascript");
-        
-               if (cur == "js") {
-                   _this.filetype.el.set_active_iter(iter);
-            }
-        
-            el.append(out iter);
-            
-            el.set_value(iter, 0, "css");
-            el.set_value(iter, 1, "CSS");
-        
-               if (cur == "css") {
-                   _this.filetype.el.set_active_iter(iter);
-            }
-                                             
-        }
-    }
+        public class Xcls_dir_dropdown : Object
+        {
+            public Gtk.DropDown el;
+            private Xcls_PopoverFileDetails  _this;
 
 
-    public class Xcls_Label9 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (def)
+            public int colspan;
 
+            // ctor
+            public Xcls_dir_dropdown(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.dir_dropdown = this;
+                new Xcls_dir_model( _this );
+                this.el = new Gtk.DropDown( _this.dir_model.el, null );
 
-            // my vars (def)
+                // my vars (dec)
+                this.colspan = 1;
 
-        // ctor
-        public Xcls_Label9(Xcls_PopoverFileDetails _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.Label( "Component Name" );
+                // set gobject values
 
-            // my vars (dec)
+                //listeners
+                this.el.notify["selected"].connect( () => {
+                
+                        _this.onDirChanged();
+                       
+                       
+                       
+                 });
+            }
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
+            // user defined functions
+            public string getValue () {
+               return _this.dir_model.el.get_string(this.el.selected);
+            }
+            public void setValue (string cur) {
+               var el  = _this.dir_model.el;
+               for(var i= 0; i < el.get_n_items();i++)  {
+                       if (el.get_string(i) == cur) {
+                               this.el.selected = i;
+                               break;
+                       }
+               }
+            }
         }
+        public class Xcls_dir_model : Object
+        {
+            public Gtk.StringList el;
+            private Xcls_PopoverFileDetails  _this;
 
-        // user defined functions
-    }
-
-    public class Xcls_name : Object
-    {
-        public Gtk.Entry el;
-        private Xcls_PopoverFileDetails  _this;
 
+                // my vars (def)
 
-            // my vars (def)
+            // ctor
+            public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.dir_model = this;
+                this.el = new Gtk.StringList( {} );
 
-        // ctor
-        public Xcls_name(Xcls_PopoverFileDetails _owner )
-        {
-            _this = _owner;
-            _this.name = this;
-            this.el = new Gtk.Entry();
+                // my vars (dec)
 
-            // my vars (dec)
+                // set gobject values
+            }
 
-            // set gobject values
-            this.el.visible = true;
+            // user defined functions
         }
 
-        // user defined functions
-    }
-
-    public class Xcls_Label11 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverFileDetails  _this;
-
 
-            // my vars (def)
-
-        // ctor
-        public Xcls_Label11(Xcls_PopoverFileDetails _owner )
+        public class Xcls_name_lbl : Object
         {
-            _this = _owner;
-            this.el = new Gtk.Label( "Title" );
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_name_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.name_lbl = this;
+                this.el = new Gtk.Label( "Component Name (File name without extension)" );
 
-    public class Xcls_title : Object
-    {
-        public Gtk.Entry el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_title(Xcls_PopoverFileDetails _owner )
+        public class Xcls_name : Object
         {
-            _this = _owner;
-            _this.title = this;
-            this.el = new Gtk.Entry();
+            public Gtk.Entry el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_name(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.name = this;
+                this.el = new Gtk.Entry();
 
-    public class Xcls_Label13 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.hexpand = true;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_Label13(Xcls_PopoverFileDetails _owner )
+        public class Xcls_title_lbl : Object
         {
-            _this = _owner;
-            this.el = new Gtk.Label( "Region" );
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.tooltip_text = "center, north, south, east, west";
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_title_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.title_lbl = this;
+                this.el = new Gtk.Label( "Title" );
 
-    public class Xcls_region : Object
-    {
-        public Gtk.Entry el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_region(Xcls_PopoverFileDetails _owner )
+        public class Xcls_title : Object
         {
-            _this = _owner;
-            _this.region = this;
-            this.el = new Gtk.Entry();
+            public Gtk.Entry el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_title(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.title = this;
+                this.el = new Gtk.Entry();
 
-    public class Xcls_Label15 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.hexpand = true;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_Label15(Xcls_PopoverFileDetails _owner )
+        public class Xcls_region_lbl : Object
         {
-            _this = _owner;
-            this.el = new Gtk.Label( "Parent Name" );
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_region_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.region_lbl = this;
+                this.el = new Gtk.Label( "Region" );
 
-    public class Xcls_parent : Object
-    {
-        public Gtk.Entry el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.tooltip_text = "center, north, south, east, west";
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_parent(Xcls_PopoverFileDetails _owner )
+        public class Xcls_region : Object
         {
-            _this = _owner;
-            _this.parent = this;
-            this.el = new Gtk.Entry();
+            public Gtk.Entry el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_region(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.region = this;
+                this.el = new Gtk.Entry();
 
-    public class Xcls_Label17 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.hexpand = true;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_Label17(Xcls_PopoverFileDetails _owner )
+        public class Xcls_parent_lbl : Object
         {
-            _this = _owner;
-            this.el = new Gtk.Label( "Permission Name" );
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_parent_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.parent_lbl = this;
+                this.el = new Gtk.Label( "Parent Name" );
 
-    public class Xcls_permname : Object
-    {
-        public Gtk.Entry el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_permname(Xcls_PopoverFileDetails _owner )
+        public class Xcls_parent : Object
         {
-            _this = _owner;
-            _this.permname = this;
-            this.el = new Gtk.Entry();
+            public Gtk.Entry el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_parent(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.parent = this;
+                this.el = new Gtk.Entry();
 
-    public class Xcls_Label19 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_Label19(Xcls_PopoverFileDetails _owner )
+        public class Xcls_permname_lbl : Object
         {
-            _this = _owner;
-            this.el = new Gtk.Label( "Order (for tabs)" );
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_permname_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.permname_lbl = this;
+                this.el = new Gtk.Label( "Permission Name" );
 
-    public class Xcls_modOrder : Object
-    {
-        public Gtk.Entry el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
+        public class Xcls_permname : Object
         {
-            _this = _owner;
-            _this.modOrder = this;
-            this.el = new Gtk.Entry();
+            public Gtk.Entry el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_permname(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.permname = this;
+                this.el = new Gtk.Entry();
 
-    public class Xcls_Label21 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_Label21(Xcls_PopoverFileDetails _owner )
+        public class Xcls_modOrder_lbl : Object
         {
-            _this = _owner;
-            this.el = new Gtk.Label( "Module to build (Vala only)" );
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.visible = true;
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_modOrder_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.modOrder_lbl = this;
+                this.el = new Gtk.Label( "Order (for tabs)" );
 
-    public class Xcls_build_module : Object
-    {
-        public Gtk.ComboBox el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_build_module(Xcls_PopoverFileDetails _owner )
+        public class Xcls_modOrder : Object
         {
-            _this = _owner;
-            _this.build_module = this;
-            this.el = new Gtk.ComboBox();
-
-            // my vars (dec)
+            public Gtk.Entry el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // set gobject values
-            var child_0 = new Xcls_dbcellrenderer( _this );
-            child_0.ref();
-            this.el.pack_start (  child_0.el , true );
-            var child_1 = new Xcls_dbmodel( _this );
-            child_1.ref();
-            this.el.set_model (  child_1.el  );
 
-            // init method
+                // my vars (def)
 
-            this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
-        }
+            // ctor
+            public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.modOrder = this;
+                this.el = new Gtk.Entry();
 
-        // user defined functions
-    }
-    public class Xcls_dbcellrenderer : Object
-    {
-        public Gtk.CellRendererText el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_dbcellrenderer(Xcls_PopoverFileDetails _owner )
+        public class Xcls_build_module_lbl : Object
         {
-            _this = _owner;
-            _this.dbcellrenderer = this;
-            this.el = new Gtk.CellRendererText();
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-        }
+                // my vars (def)
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_build_module_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.build_module_lbl = this;
+                this.el = new Gtk.Label( "Module to build" );
 
-    public class Xcls_dbmodel : Object
-    {
-        public Gtk.ListStore el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
 
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_dbmodel(Xcls_PopoverFileDetails _owner )
+        public class Xcls_build_module : Object
         {
-            _this = _owner;
-            _this.dbmodel = this;
-            this.el = new Gtk.ListStore.newv(  { typeof(string),typeof(string) }  );
+            public Gtk.DropDown el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-        }
+                // my vars (def)
 
-        // user defined functions
-        public 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);
-                }
-                
+            // ctor
+            public Xcls_build_module(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.build_module = this;
+                new Xcls_build_module_model( _this );
+                this.el = new Gtk.DropDown( _this.build_module_model.el, null );
+
+                // my vars (dec)
+
+                // set gobject values
+            }
+
+            // user defined functions
+            public string getValue () {
+               if (this.el.selected < 0) {
+                       return "";
+               }
+               
+               return _this.build_module_model.el.get_string(this.el.selected);
+            }
+            public void setValue (string str) {
+               var m = _this.build_module_model.el;
+               for(var i = 0; i < m.get_n_items(); i++) {
+                       if (m.get_string(i) == str) {
+                               this.el.selected = i;
+                               return;
+                       }
+               }
+                       
             }
-             this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
-                                             
         }
-    }
+        public class Xcls_build_module_model : Object
+        {
+            public Gtk.StringList el;
+            private Xcls_PopoverFileDetails  _this;
 
 
-    public class Xcls_Label25 : Object
-    {
-        public Gtk.Label el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (def)
 
+            // ctor
+            public Xcls_build_module_model(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.build_module_model = this;
+                this.el = new Gtk.StringList( {} );
 
-            // my vars (def)
+                // my vars (dec)
 
-        // ctor
-        public Xcls_Label25(Xcls_PopoverFileDetails _owner )
+                // set gobject values
+            }
+
+            // user defined functions
+            public void load (Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)
+            {
+               
+               _this.build_module.el.hide();
+                       _this.build_module_lbl.el.hide();
+               var el = _this.build_module_model.el;
+                while (el.get_n_items() > 0) {
+                               el.remove(0);
+               }
+               
+               if (compilegroups == null) {
+                       return;
+               }
+               foreach(var k in compilegroups.keys) {
+                       this.el.append(k);
+               }
+               if (compilegroups.keys.size > 0) {
+                       _this.build_module.el.selected = 0;
+                       _this.build_module.el.show();
+                       _this.build_module_lbl.el.show();
+               } else {
+                       
+               }
+               
+            }
+        }
+
+
+        public class Xcls_path_lbl : Object
         {
-            _this = _owner;
-            this.el = new Gtk.Label( "Directory" );
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-            this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
-            this.el.visible = true;
-        }
+                // my vars (def)
+            public int colspan;
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_path_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.path_lbl = this;
+                this.el = new Gtk.Label( "Full path" );
 
-    public class Xcls_dir : Object
-    {
-        public Gtk.ComboBox el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
+                this.colspan = 1;
 
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_dir(Xcls_PopoverFileDetails _owner )
+        public class Xcls_path : Object
         {
-            _this = _owner;
-            _this.dir = this;
-            this.el = new Gtk.ComboBox();
+            public Gtk.Entry el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
-
-            // set gobject values
-            var child_0 = new Xcls_dircellrenderer( _this );
-            child_0.ref();
-            this.el.pack_start (  child_0.el , true );
-            var child_1 = new Xcls_dirmodel( _this );
-            child_1.ref();
-            this.el.set_model (  child_1.el  );
 
-            // init method
+                // my vars (def)
+            public int colspan;
 
-            this.el.add_attribute(_this.dircellrenderer.el , "markup", 1 );
-        }
+            // ctor
+            public Xcls_path(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.path = this;
+                this.el = new Gtk.Entry();
 
-        // user defined functions
-    }
-    public class Xcls_dircellrenderer : Object
-    {
-        public Gtk.CellRendererText el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
+                this.colspan = 1;
 
+                // set gobject values
+                this.el.editable = false;
+                this.el.hexpand = true;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_dircellrenderer(Xcls_PopoverFileDetails _owner )
+        public class Xcls_gen_lbl : Object
         {
-            _this = _owner;
-            _this.dircellrenderer = this;
-            this.el = new Gtk.CellRendererText();
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-        }
+                // my vars (def)
+            public int colspan;
 
-        // user defined functions
-    }
+            // ctor
+            public Xcls_gen_lbl(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.gen_lbl = this;
+                this.el = new Gtk.Label( "Generate as Extended (no working)" );
 
-    public class Xcls_dirmodel : Object
-    {
-        public Gtk.ListStore el;
-        private Xcls_PopoverFileDetails  _this;
+                // my vars (dec)
+                this.colspan = 1;
 
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.visible = true;
+            }
 
-            // my vars (def)
+            // user defined functions
+        }
 
-        // ctor
-        public Xcls_dirmodel(Xcls_PopoverFileDetails _owner )
+        public class Xcls_gen : Object
         {
-            _this = _owner;
-            _this.dirmodel = this;
-            this.el = new Gtk.ListStore.newv(  { typeof(string),typeof(string) }  );
+            public Gtk.CheckButton el;
+            private Xcls_PopoverFileDetails  _this;
 
-            // my vars (dec)
 
-            // set gobject values
-        }
+                // my vars (def)
 
-        // user defined functions
-        public void loadData () {
-               
-               
-          
-            this.el.clear();                                    
-            
-            if (!(_this.project is Project.Gtk)) {
-                       return;
-               }
-            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);
-               // }
+            // ctor
+            public Xcls_gen(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.gen = this;
+                this.el = new Gtk.CheckButton();
+
+                // my vars (dec)
+
+                // set gobject values
+                this.el.label = "Wrapped";
+
+                //listeners
+                this.el.toggled.connect( ( ) => {
+                         
+                       this.el.label = this.el.active ? "Extended" : "Wrapped";
                 
+                });
             }
-          //  this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
-                                             
+
+            // user defined functions
         }
-    }
 
 
 
-    public class Xcls_ButtonBox29 : Object
-    {
-        public Gtk.ButtonBox el;
-        private Xcls_PopoverFileDetails  _this;
+        public class Xcls_HeaderBar29 : Object
+        {
+            public Gtk.HeaderBar el;
+            private Xcls_PopoverFileDetails  _this;
 
 
-            // my vars (def)
+                // my vars (def)
 
-        // ctor
-        public Xcls_ButtonBox29(Xcls_PopoverFileDetails _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.ButtonBox( Gtk.Orientation.HORIZONTAL );
+            // ctor
+            public Xcls_HeaderBar29(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                this.el = new Gtk.HeaderBar();
 
-            // my vars (dec)
+                // my vars (dec)
 
-            // set gobject values
-            this.el.margin_right = 4;
-            this.el.margin_left = 4;
-            this.el.margin_bottom = 4;
-            this.el.margin_top = 4;
-            var child_0 = new Xcls_Button30( _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  );
+                // set gobject values
+                this.el.show_title_buttons = false;
+                var child_1 = new Xcls_Button30( _this );
+                child_1.ref();
+                this.el.pack_start ( child_1.el  );
+                new Xcls_save_btn( _this );
+                this.el.pack_end ( _this.save_btn.el  );
+            }
+
+            // user defined functions
         }
+        public class Xcls_Button30 : Object
+        {
+            public Gtk.Button el;
+            private Xcls_PopoverFileDetails  _this;
 
-        // user defined functions
-    }
-    public class Xcls_Button30 : Object
-    {
-        public Gtk.Button el;
-        private Xcls_PopoverFileDetails  _this;
 
+                // my vars (def)
 
-            // my vars (def)
+            // ctor
+            public Xcls_Button30(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                this.el = new Gtk.Button();
 
-        // ctor
-        public Xcls_Button30(Xcls_PopoverFileDetails _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.Button();
+                // my vars (dec)
 
-            // my vars (dec)
+                // set gobject values
+                this.el.label = "Cancel";
 
-            // set gobject values
-            this.el.label = "Cancel";
+                //listeners
+                this.el.clicked.connect( () => { 
+                       _this.done = true;
+                    _this.el.hide(); 
+                });
+            }
 
-            //listeners
-            this.el.clicked.connect( () => { 
-            
-              _this.done = true;
-                _this.el.hide(); 
-            });
+            // user defined functions
         }
 
-        // user defined functions
-    }
+        public class Xcls_save_btn : Object
+        {
+            public Gtk.Button el;
+            private Xcls_PopoverFileDetails  _this;
 
-    public class Xcls_save_btn : Object
-    {
-        public Gtk.Button el;
-        private Xcls_PopoverFileDetails  _this;
 
+                // my vars (def)
+            public bool always_show_image;
 
-            // my vars (def)
+            // ctor
+            public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.save_btn = this;
+                this.el = new Gtk.Button();
 
-        // ctor
-        public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
-        {
-            _this = _owner;
-            _this.save_btn = this;
-            this.el = new Gtk.Button();
+                // my vars (dec)
+                this.always_show_image = true;
 
-            // my vars (dec)
+                // set gobject values
+                this.el.icon_name = "document-save";
+                this.el.hexpand = false;
+                this.el.css_classes = { "suggested-action" };
+                this.el.label = "Save";
 
-            // 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 a Component name "
+                           );
+                            
+                           return;
+                       }
+                        
+                
+                       if (!_this.is_new) {
+                         //  try {
+                         
+                               var old_target = _this.file.build_module;
+                         _this.updateFileFromEntry();
+                           if (_this.project.xtype == "Gtk" && old_target != _this.file.build_module) {
+                               var gp = (JsRender.Gtk)_this.file;
+                               gp.updateCompileGroup(old_target,  _this.file.build_module);
+                       }
+                
+                             _this.done = true;
+                           _this.file.save();
+                           _this.el.hide();
+                           return;
+                       }  
+                       
+                       // ---------------- NEW FILES...
+                       var ftype = _this.filetype.getValue();
+                
+                       if (ftype == "") {
+                               // 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();
+                       
+                        
+                       var ext = ftype;
+                       //var dir = _this.project.path; 
+                        
+                        var dir = _this.dir_dropdown.getValue();
+                       
+                        
+                       
+                        
+                       var targetfile  = _this.project.path;
+                       if (dir != "") {
+                               targetfile += dir;
+                       }
+                       targetfile += "/" + fn;
+                       
+                       // strip the file type off the end..
+                       
+                       try {
+                               var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
+                               fn = rx.replace(targetfile, targetfile.length, 0, ""); 
+                         } catch (RegexError e) {} // ignore.
+                         
+                         targetfile += "." + ext;
+                         
+                         
+                       if (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {
+                           Xcls_StandardErrorDialog.singleton().show(
+                               _this.mainwindow.el,
+                               "That file already exists"
+                           ); 
+                           return;
+                       }
+                       JsRender.JsRender f;
+                   try {
+                          f =  JsRender.JsRender.factory(
+                                       ext == "bjs" ? _this.file.project.xtype : "PlainFile",  
+                                       _this.file.project, 
+                                       targetfile);
+                       } catch (JsRender.Error e) {
+                               Xcls_StandardErrorDialog.singleton().show(
+                               _this.mainwindow.el,
+                               "Error creating file"
+                           ); 
+                               return;
+                       }
+                       _this.file = f;
+                       
+                       
+                
+                       
+                       _this.updateFileFromEntry();
+                       _this.file.loaded = true;
+                       _this.file.save();
+                     _this.file.project.addFile(_this.file);
+                     var sel = _this.filetype.getValue();
+                        if (_this.file.project.xtype == "Gtk" && 
+                               _this.file.build_module.length > 0 &&
+                               ( sel == "bjs" || sel == "vala")) {
+                        
+                               var pr = (Project.Gtk) _this.file.project;
+                               if (pr.compilegroups.has_key(_this.file.build_module)) {
+                                       var cg = pr.compilegroups.get(_this.file.build_module);
+                                       if (!cg.sources.contains(_this.file.relpath)) {
+                                               cg.sources.add(_this.file.relpath);
+                                       }
+                               }
+                       
+                       }
+                        
+                 
+                       // what about .js ?
+                   _this.done = true;
+                       _this.el.hide();
+                
+                // hopefull this will work with bjs files..
+                       
+                       _this.success(_this.project, _this.file);
+                   
+                });
+            }
 
-            //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
         }
 
-        // user defined functions
-    }
-
 
-
-}
+    }