Fix #7959 - new project flow - use void func to callback after each step, tidy up...
authorAlan <alan@roojs.com>
Thu, 4 Jan 2024 10:43:12 +0000 (18:43 +0800)
committerAlan <alan@roojs.com>
Thu, 4 Jan 2024 10:43:12 +0000 (18:43 +0800)
13 files changed:
src/Builder4/DialogFiles.bjs
src/Builder4/DialogFiles.vala
src/Builder4/EditProject.bjs
src/Builder4/EditProject.vala
src/Builder4/MainWindow.bjs
src/Builder4/MainWindow.vala
src/Builder4/PopoverFileDetails.bjs
src/Builder4/PopoverFileDetails.vala
src/Builder4/ValaProjectSettingsPopover.bjs
src/Builder4/ValaProjectSettingsPopover.vala
src/Builder4/WindowState.vala
src/JsRender/JsRender.vala
src/Project/Project.vala

index 1ecf130..d53a5a2 100644 (file)
          "   pe.el.application = _this.win.el.application;",
          "    pe.el.set_transient_for( _this.el );",
          " ",
-         "  ",
-         "    pe.selected.connect((pr) => {",
-         "     \t ",
-         "\t     _this.show(  pr, _this.new_window);",
-         "",
-         "    });",
-         "    ",
+         "    var cb = new Project.Callback();",
+         "    cb.call.connect((pr) => {",
+         "    \t_this.show(  pr , _this.new_window);",
+         "\t});",
          "      ",
-         "    pe.show();",
+         "    pe.show( cb);",
          "   ",
          "",
          "}"
         ]
        },
-       "xtype" : "Button"
+       "xtype" : "Button",
+       "| void onCreated" : [
+        "() {",
+        "\tvar pe =      EditProject.singleton();",
+        "",
+        "\t_this.show(  pe.result , _this.new_window);",
+        "}"
+       ]
       },
       {
        "$ xns" : "Gtk",
          "   if (_this.selectedProject == null) {",
          "\t   return;",
          "   }",
-         "\t_this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject);",
+         "\t_this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);",
          " }"
         ]
        },
     " ",
     "\t",
     "\t this.el.show();",
-    "\t \tthis.load();",
+    " this.load();",
     "\tthis.selectProject(project);",
     "\tthis.onProjectSelected(project);   //?? twice?",
     "\t ",
index 5b5d5b0..36e4387 100644 (file)
          
                
                 this.el.show();
-                       this.load();
+         this.load();
                this.selectProject(project);
                this.onProjectSelected(project);   //?? twice?
                 
                 var child_1 = new Xcls_Box3( _this );
                 child_1.ref();
                 this.el.append( child_1.el );
-                var child_2 = new Xcls_mainpane( _this );
-                this.el.append( child_2.el );
+                new Xcls_mainpane( _this );
+                this.el.append( _this.mainpane.el );
             }
 
             // user defined functions
                 this.el.hexpand = true;
                 this.el.vexpand = true;
                 this.el.position = 200;
-                var child_1 = new Xcls_projectscroll( _this );
-                this.el.start_child = child_1.el;
-                var child_2 = new Xcls_filepane( _this );
-                this.el.end_child = child_2.el;
+                new Xcls_projectscroll( _this );
+                this.el.start_child = _this.projectscroll.el;
+                new Xcls_filepane( _this );
+                this.el.end_child = _this.filepane.el;
             }
 
             // user defined functions
                 this.el.has_frame = true;
                 this.el.hexpand = true;
                 this.el.vexpand = true;
-                var child_1 = new Xcls_project_list( _this );
-                this.el.child = child_1.el;
+                new Xcls_project_list( _this );
+                this.el.child = _this.project_list.el;
 
                 // init method
 
             {
                 _this = _owner;
                 _this.project_list = this;
-                var child_1 = new Xcls_projectselection( _this );
-                this.el = new Gtk.ColumnView( child_1.el );
+                new Xcls_projectselection( _this );
+                this.el = new Gtk.ColumnView( _this.projectselection.el );
 
                 // my vars (dec)
 
             {
                 _this = _owner;
                 _this.projectselection = this;
-                var child_1 = new Xcls_projectsort( _this );
-                this.el = new Gtk.SingleSelection( child_1.el );
+                new Xcls_projectsort( _this );
+                this.el = new Gtk.SingleSelection( _this.projectsort.el );
 
                 // my vars (dec)
 
             {
                 _this = _owner;
                 _this.projectsort = this;
-                var child_1 = new Xcls_projectmodel( _this );
+                new Xcls_projectmodel( _this );
                 var child_2 = new Xcls_StringSorter10( _this );
                 child_2.ref();
-                this.el = new Gtk.SortListModel( child_1.el, child_2.el );
+                this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
 
                 // my vars (dec)
 
                 this.el.visible = false;
                 var child_1 = new Xcls_Box15( _this );
                 this.el.end_child = child_1.el;
-                var child_2 = new Xcls_treescroll( _this );
-                this.el.start_child = child_2.el;
+                new Xcls_treescroll( _this );
+                this.el.start_child = _this.treescroll.el;
             }
 
             // user defined functions
                 var child_1 = new Xcls_Box16( _this );
                 child_1.ref();
                 this.el.append( child_1.el );
-                var child_2 = new Xcls_iconscroll( _this );
-                this.el.append( child_2.el );
+                new Xcls_iconscroll( _this );
+                this.el.append( _this.iconscroll.el );
             }
 
             // user defined functions
 
                 // set gobject values
                 this.el.hexpand = true;
-                var child_1 = new Xcls_searchbox( _this );
-                this.el.append( child_1.el );
+                new Xcls_searchbox( _this );
+                this.el.append( _this.searchbox.el );
             }
 
             // user defined functions
                 this.el.has_frame = true;
                 this.el.hexpand = true;
                 this.el.vexpand = true;
-                var child_1 = new Xcls_gridview( _this );
-                this.el.child = child_1.el;
+                new Xcls_gridview( _this );
+                this.el.child = _this.gridview.el;
 
                 // init method
 
             {
                 _this = _owner;
                 _this.gridview = this;
-                var child_1 = new Xcls_iconsel( _this );
+                new Xcls_iconsel( _this );
                 var child_2 = new Xcls_SignalListItemFactory29( _this );
                 child_2.ref();
-                this.el = new Gtk.GridView( child_1.el, child_2.el );
+                this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
 
                 // my vars (dec)
 
             public Xcls_FilterListModel22(DialogFiles _owner )
             {
                 _this = _owner;
-                var child_1 = new Xcls_gridsort( _this );
-                var child_2 = new Xcls_iconsearch( _this );
-                this.el = new Gtk.FilterListModel( child_1.el, child_2.el );
+                new Xcls_gridsort( _this );
+                new Xcls_iconsearch( _this );
+                this.el = new Gtk.FilterListModel( _this.gridsort.el, _this.iconsearch.el );
 
                 // my vars (dec)
 
             {
                 _this = _owner;
                 _this.gridsort = this;
-                var child_1 = new Xcls_gridmodel( _this );
+                new Xcls_gridmodel( _this );
                 var child_2 = new Xcls_StringSorter25( _this );
                 child_2.ref();
-                this.el = new Gtk.SortListModel( child_1.el, child_2.el );
+                this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
 
                 // my vars (dec)
 
                 this.el.hexpand = true;
                 this.el.vexpand = true;
                 this.el.visible = true;
-                var child_1 = new Xcls_treeview( _this );
-                this.el.child = child_1.el;
+                new Xcls_treeview( _this );
+                this.el.child = _this.treeview.el;
 
                 // init method
 
             {
                 _this = _owner;
                 _this.treeview = this;
-                var child_1 = new Xcls_treeselmodel( _this );
-                this.el = new Gtk.ColumnView( child_1.el );
+                new Xcls_treeselmodel( _this );
+                this.el = new Gtk.ColumnView( _this.treeselmodel.el );
 
                 // my vars (dec)
 
                 var child_2 = new Xcls_GestureClick32( _this );
                 child_2.ref();
                 this.el.add_controller(  child_2.el );
-                var child_3 = new Xcls_name( _this );
-                this.el.append_column ( child_3.el  );
+                new Xcls_name( _this );
+                this.el.append_column ( _this.name.el  );
 
                 // init method
 
             public Xcls_FilterListModel34(DialogFiles _owner )
             {
                 _this = _owner;
-                var child_1 = new Xcls_treelistsort( _this );
-                var child_2 = new Xcls_treefilter( _this );
-                this.el = new Gtk.FilterListModel( child_1.el, child_2.el );
+                new Xcls_treelistsort( _this );
+                new Xcls_treefilter( _this );
+                this.el = new Gtk.FilterListModel( _this.treelistsort.el, _this.treefilter.el );
 
                 // my vars (dec)
 
             {
                 _this = _owner;
                 _this.treelistsort = this;
-                var child_1 = new Xcls_treelistmodel( _this );
+                new Xcls_treelistmodel( _this );
                 var child_2 = new Xcls_TreeListRowSorter38( _this );
                 child_2.ref();
-                this.el = new Gtk.SortListModel( child_1.el, child_2.el );
+                this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
 
                 // my vars (dec)
 
             {
                 _this = _owner;
                 _this.treelistmodel = this;
-                var child_1 = new Xcls_treemodel( _this );
-                this.el = new Gtk.TreeListModel( child_1.el, false, true, (item) => {
+                new Xcls_treemodel( _this );
+                this.el = new Gtk.TreeListModel( _this.treemodel.el, false, true, (item) => {
        //GLib.debug("liststore got %s", item.get_type().name());
        return ((JsRender.JsRender)item).childfiles;
 }  );
                 var child_1 = new Xcls_Button45( _this );
                 child_1.ref();
                 this.el.pack_end ( child_1.el  );
-                var child_2 = new Xcls_btn_newproj( _this );
-                this.el.pack_start ( child_2.el  );
-                var child_3 = new Xcls_btn_projprop( _this );
-                this.el.pack_start ( child_3.el  );
-                var child_4 = new Xcls_btn_delproj( _this );
-                this.el.pack_start ( child_4.el  );
-                var child_5 = new Xcls_btn_addfile( _this );
-                this.el.pack_start ( child_5.el  );
-                var child_6 = new Xcls_btn_delfile( _this );
-                this.el.pack_start ( child_6.el  );
+                new Xcls_btn_newproj( _this );
+                this.el.pack_start ( _this.btn_newproj.el  );
+                new Xcls_btn_projprop( _this );
+                this.el.pack_start ( _this.btn_projprop.el  );
+                new Xcls_btn_delproj( _this );
+                this.el.pack_start ( _this.btn_delproj.el  );
+                new Xcls_btn_addfile( _this );
+                this.el.pack_start ( _this.btn_addfile.el  );
+                new Xcls_btn_delfile( _this );
+                this.el.pack_start ( _this.btn_delfile.el  );
             }
 
             // user defined functions
                    pe.el.application = _this.win.el.application;
                     pe.el.set_transient_for( _this.el );
                  
-                  
-                    pe.selected.connect((pr) => {
-                        
-                            _this.show(  pr, _this.new_window);
-                
-                    });
-                    
+                    var cb = new Project.Callback();
+                    cb.call.connect((pr) => {
+                       _this.show(  pr , _this.new_window);
+                       });
                       
-                    pe.show();
+                    pe.show( cb);
                    
                 
                 });
             }
 
             // user defined functions
+            public void onCreated () {
+               var pe =      EditProject.singleton();
+            
+               _this.show(  pe.result , _this.new_window);
+            }
         }
         public class Xcls_Box47 : Object
         {
                    if (_this.selectedProject == null) {
                           return;
                    }
-                       _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject);
+                       _this.win.windowstate.projectPopoverShow(_this.el, _this.selectedProject, null);
                  });
             }
 
index edd9723..b45ca28 100644 (file)
@@ -4,10 +4,11 @@
  "items" : [
   {
    "# WindowState? windowstate" : "null",
+   "$ Project.Callback doneObj" : "null",
    "$ deletable" : true,
    "$ xns" : "Gtk",
    "@ void canceled" : "()",
-   "@ void selected" : "(Project.Project? proj)",
+   "Project.Project result" : "null",
    "bool modal" : true,
    "default_width" : 600,
    "items" : [
          "\t\t",
          "\t\tproject.save();",
          "\t\t Project.Project.saveProjectList();",
-         "\t\t_this.selected(project); // this should trigger a load()",
+         " \t\t_this.result = project;",
          "\t\tif (is_new_folder || is_existing) {",
-         "\t    \t _this.windowstate.projectPopoverShow(_this.el, project);",
+         "\t\t\t   ",
+         "\t\t",
+         "\t    \t _this.windowstate.projectPopoverShow(",
+         "\t    \t \t_this.el.transient_for, project,  _this.doneObj ",
+         "    \t \t);",
+         "    \t } else {",
+         "    \t \tif (_this.doneObj != null) {",
+         "\t\t    \t _this.doneObj.call(project);",
+         "\t    \t }",
          "    \t }",
          "\t\t",
          "\t\treturn;",
           {
            "$ xns" : "Gtk",
            "* prop" : "model",
-           "strings" : "{ \"Roo\", \"Gtk\" /*, \"WrappedGtk\", \"Flutter\" */ }",
+           "strings" : [
+            "{  ",
+            "\t\"Gtk - A Gtk / Vala Desktop project\", ",
+            "\t\"Roo - A Web  Javascript Project using the Roo Library\"",
+            "\t/*,  \"Flutter\" */ ",
+            "}"
+           ],
            "xtype" : "StringList"
           }
          ],
          "| string getValue" : [
           "() {",
           "\tvar m = (Gtk.StringList) this.el.model;",
-          "\treturn this.el.selected == Gtk.INVALID_LIST_POSITION ?",
+          "\tvar str = this.el.selected == Gtk.INVALID_LIST_POSITION ?",
           "\t\t\t \"\" : m.get_string(this.el.selected);",
+          "\t\t\t ",
+          " \tvar ar = str.split(\" \");",
+          " \treturn ar[0];",
           "\t",
           "}"
          ],
     }
    ],
    "name" : "EditProject",
-   "title" : "New Project",
+   "string title" : "New Project",
    "xtype" : "Window",
    "| void hideAll" : [
     "() {",
     "}"
    ],
    "| void show" : [
-    "() {",
-    "     ",
+    "(Project.Callback doneObj) {",
+    "     this.doneObj= doneObj;",
     "    _this.hideAll(); ",
     "     // hide stuff..",
     "     _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION;",
index 080846d..04e1592 100644 (file)
         public Xcls_ptype_dd ptype_dd;
 
             // my vars (def)
+        public Project.Callback doneObj;
         public WindowState? windowstate;
         public signal void canceled ();
-        public signal void selected (Project.Project? proj);
+        public Project.Project result;
 
         // ctor
         public EditProject()
@@ -36,7 +37,9 @@
             this.el = new Gtk.Window();
 
             // my vars (dec)
+            this.doneObj = null;
             this.windowstate = null;
+            this.result = null;
 
             // set gobject values
             this.el.title = "New Project";
@@ -51,8 +54,8 @@
         }
 
         // user defined functions
-        public void show () {
-             
+        public void show (Project.Callback doneObj) {
+             this.doneObj= doneObj;
             _this.hideAll(); 
              // hide stuff..
              _this.type_dd.el.selected = Gtk.INVALID_LIST_POSITION;
                                
                                project.save();
                                 Project.Project.saveProjectList();
-                               _this.selected(project); // this should trigger a load()
+                               _this.result = project;
                                if (is_new_folder || is_existing) {
-                                _this.windowstate.projectPopoverShow(_this.el, project);
+                                          
+                               
+                                _this.windowstate.projectPopoverShow(
+                                       _this.el.transient_for, project,  _this.doneObj 
+                               );
+                        } else {
+                               if (_this.doneObj != null) {
+                                        _this.doneObj.call(project);
+                                }
                         }
                                
                                return;
             // user defined functions
             public string getValue () {
                var m = (Gtk.StringList) this.el.model;
-               return this.el.selected == Gtk.INVALID_LIST_POSITION ?
+               var str = this.el.selected == Gtk.INVALID_LIST_POSITION ?
                                 "" : m.get_string(this.el.selected);
+                                
+               var ar = str.split(" ");
+               return ar[0];
                
             }
             public void setValue (string val) {
             public Xcls_StringList20(EditProject _owner )
             {
                 _this = _owner;
-                this.el = new Gtk.StringList( { "Roo", "Gtk" /*, "WrappedGtk", "Flutter" */ } );
+                this.el = new Gtk.StringList( {  
+       "Gtk - A Gtk / Vala Desktop project", 
+       "Roo - A Web  Javascript Project using the Roo Library"
+       /*,  "Flutter" */ 
+} );
 
                 // my vars (dec)
 
index 2d956ba..337bf15 100644 (file)
           "clicked" : [
            "  ( ) => {",
            "     ",
-           "     _this.windowstate.projectPopoverShow(_this.el, null);",
+           "     _this.windowstate.projectPopoverShow(_this.el, null, null);",
            "   ",
            "  ",
            "}"
     "\t\treq.totalErrors(\"DEPR\"),",
     "\t\treq.totalErrors(\"DEPR\", this.windowstate.file)",
     "\t);",
+    "",
+    "\t_this.statusbar_run.el.hide();",
+    "",
+    "\tif (req.totalErrors(\"ERR\") < 1) {",
+    "\t\t_this.statusbar_run.el.show();",
+    "\t}",
+    "\t",
     "}"
    ]
   }
index e5c8b87..76242bb 100644 (file)
                        req.totalErrors("DEPR"),
                        req.totalErrors("DEPR", this.windowstate.file)
                );
+        
+               _this.statusbar_run.el.hide();
+        
+               if (req.totalErrors("ERR") < 1) {
+                       _this.statusbar_run.el.show();
+               }
+               
         }
         public void initChildren () {
             // this needs putting in a better place..
                 //listeners
                 this.el.clicked.connect( ( ) => {
                      
-                     _this.windowstate.projectPopoverShow(_this.el, null);
+                     _this.windowstate.projectPopoverShow(_this.el, null, null);
                    
                   
                 });
index 158deed..a698a48 100644 (file)
@@ -10,6 +10,7 @@
    "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
    "Xcls_MainWindow mainwindow" : "null",
    "bool done" : false,
+   "bool is_new" : true,
    "bool modal" : true,
    "id" : "PopoverFileDetails",
    "items" : [
        "int margin_end" : 4,
        "int margin_start" : 4,
        "items" : [
-        {
-         "$ justify" : "Gtk.Justification.RIGHT",
-         "$ visible" : true,
-         "$ xns" : "Gtk",
-         "id" : "dir_dropdown_lbl",
-         "label" : "Create File in this Directory",
-         "x_options" : 4,
-         "xalign" : 0.90000000000000002,
-         "xtype" : "Label"
-        },
-        {
-         "$ xns" : "Gtk",
-         "id" : "dir_dropdown",
-         "int colspan" : 1,
-         "items" : [
-          {
-           "$ xns" : "Gtk",
-           "* prop" : "model",
-           "id" : "dir_model",
-           "strings" : "{}",
-           "xtype" : "StringList"
-          }
-         ],
-         "xtype" : "DropDown",
-         "| string getValue" : [
-          "() {",
-          "\treturn _this.dir_model.el.get_string(this.el.selected);",
-          "}"
-         ]
-        },
         {
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ xns" : "Gtk",
          "xtype" : "DropDown",
          "| string getValue" : [
           "() {",
+          "\t",
+          "\tif (!_this.is_new) {",
+          "\t\treturn _this.file.xtype != \"Plainfile\" ? \"bjs\" :  _this.file.file_ext;",
+          "\t}",
+          "\t",
           "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
           "\t\treturn \"\";",
           "\t}",
          ],
          "| void showhide" : [
           "()   {",
+          "\t ",
           "",
-          "",
-          "\t",
+          "\t_this.path_lbl.el.hide();",
+          "    _this.path.el.hide();",
+          "    ",
+          "    ",
+          "    _this.name_lbl.el.hide();",
+          "    _this.name.el.hide();",
+          "    ",
+          "    _this.dir_dropdown_lbl.el.hide();",
+          "    _this.dir_dropdown.el.hide();",
           "\t",
           "\t_this.title_lbl.el.hide();",
           "\t_this.title.el.hide();",
           "\t",
           "\t_this.gen_lbl.el.hide();",
           "\t_this.gen.el.hide();",
-          " ",
+          "\t",
+          "  ",
           "\tvar sel = this.getValue();",
+          "",
+          "\tGLib.debug(\"showhide is new ? %s / sel = '%s'\" , _this.is_new ? \"YES\" :\"NO\", sel); ",
+          "\t",
+          "    if (_this.is_new) {",
+          "\t\tif (sel == \"\" &&  _this.project.xtype == \"Gtk\") {",
+          "\t\t\treturn;",
+          "\t\t}",
+          "\t\t ",
+          "\t  ",
+          "        _this.dir_dropdown_lbl.el.show();",
+          "\t    _this.dir_dropdown.el.show();",
+          "\t    ",
+          "        _this.name_lbl.el.show();",
+          "    \t_this.name.el.show();",
+          "",
+          "\t    ",
+          "\t    ",
+          "    }   else {",
+          "        _this.path.el.set_text(_this.file.relpath);",
+          "    }",
+          "    ",
+          "\t",
+          "\t",
           "\t",
           "\tswitch(_this.project.xtype) {",
           "\t\tcase \"Roo\":",
           "\t \t\t_this.build_module_lbl.el.show();",
           "\t\t\t_this.build_module.el.show();",
           "\t",
-          "\t\t\t_this.gen_lbl.el.show();",
-          "\t\t\t_this.gen.el.show();",
-          "\t\t    ",
+          "\t\t\t ",
+          "\t\t\t",
+          "\t\t\tif (sel == \"bjs\" || sel == \"vala\") {",
+          "\t\t\t\t _this.project.loadDirsToStringList(_this.dir_model.el, \"/src\");",
+          "\t\t\t\t _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
+          "\t\t        _this.name_lbl.el.label = \"Component Name (Filename with-out extension)\";\t\t\t\t ",
+          "\t\t        ",
+          "\t\t        if (sel == \"bjs\") {",
+          "\t\t\t        _this.gen_lbl.el.show();",
+          "\t\t\t        _this.gen.el.show();",
+          "\t\t        }",
+          "\t\t        ",
+          "\t\t        ",
+          "\t\t        ",
+          "\t\t\t} else {",
+          "\t\t        _this.project.loadDirsToStringList(_this.dir_model.el, \"\");",
+          "\t\t        _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
+          "\t\t        _this.name_lbl.el.label = \"File Name (with extension)\";",
+          "\t        }",
           "\t\t\tbreak;",
           "\t}",
           " ",
         },
         {
          "$ justify" : "Gtk.Justification.RIGHT",
+         "$ visible" : true,
          "$ xns" : "Gtk",
+         "id" : "dir_dropdown_lbl",
+         "label" : "Create File in this Directory",
+         "x_options" : 4,
+         "xalign" : 0.90000000000000002,
+         "xtype" : "Label"
+        },
+        {
+         "$ xns" : "Gtk",
+         "id" : "dir_dropdown",
+         "int colspan" : 1,
+         "items" : [
+          {
+           "$ xns" : "Gtk",
+           "* prop" : "model",
+           "id" : "dir_model",
+           "strings" : "{}",
+           "xtype" : "StringList"
+          }
+         ],
+         "xtype" : "DropDown",
+         "| string getValue" : [
+          "() {",
+          "\treturn _this.dir_model.el.get_string(this.el.selected);",
+          "}"
+         ]
+        },
+        {
+         "$ justify" : "Gtk.Justification.RIGHT",
+         "$ xns" : "Gtk",
+         "id" : "name_lbl",
          "label" : "Component Name (File name without extension)",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
          "$ xns" : "Gtk",
          "id" : "gen_lbl",
          "int colspan" : 1,
-         "label" : "Generate as Extended (experimental)",
+         "label" : "Generate as Extended (no working)",
          "x_options" : 4,
          "xalign" : 0.90000000000000002,
          "xtype" : "Label"
        ],
        "uint row_spacing" : 2,
        "xtype" : "Grid",
-       "| void hideRow" : [
+       "| void xhideRow" : [
         "(int row) ",
         "{",
         "\tvar el = _this.grid.el.get_child_at(0,row);",
         "",
         "}"
        ],
-       "| void showAllRows" : [
+       "| void xshowAllRows" : [
         "() {",
         "\tfor (var i = 2; i < 10;i++) {",
         "\t\tvar el = _this.grid.el.get_child_at(0,i);",
    "uint border_width" : 0,
    "xtype" : "Window",
    "| void show" : [
-    "(JsRender.JsRender c, Gtk.Window pwin, bool new_window) ",
+    "(JsRender.JsRender  c, Gtk.Window pwin, bool new_window) ",
     "{",
     "    ",
     "    this.project = c.project;",
     "        //this.init();",
     "     //} ",
     "     ",
-    "     ",
+    "      this.is_new = c.name == \"\";",
     "",
     "    _this.name.el.set_text(c.name);",
     "    _this.title.el.set_text(c.title);",
     " ",
     "   _this.gen.el.active = c.gen_extended;",
     "   ",
-    "\t_this.path_lbl.el.show();",
-    "    _this.path.el.show();",
-    "    _this.dir_dropdown_lbl.el.hide();",
-    "    _this.dir_dropdown.el.hide();",
-    "    if (c.name == \"\") {",
-    "    \t_this.path_lbl.el.hide();",
-    "\t    _this.path.el.hide();",
-    "\t    this.filetype_model.load();",
-    "        _this.dir_dropdown_lbl.el.show();",
-    "\t    _this.dir_dropdown.el.show();",
-    "\t    ",
-    "    }   else {",
-    "        _this.path.el.set_text(c.relpath);",
-    "    }",
-    "    ",
+    "",
     "    ",
     "    if (this.project.xtype == \"Gtk\") {",
     "    \tvar p = (Project.Gtk) this.project;",
     "\t    this.build_module_model.load(p.compilegroups);",
     "\t    // it will select first if available...",
     "\t    // only for new files.",
-    "\t    if (c.name != \"\") {",
+    "\t    if (!this.is_new) {",
     "\t\t    this.build_module.setValue(c.build_module);",
     "\t    }",
     "    }",
     "    this.el.set_transient_for(pwin);",
     "    ",
     "    // window + header?",
-    "     print(\"SHOWALL - POPIP\\n\");",
+    "     ",
     "    this.el.show();",
-    "    this.name.el.grab_focus();",
+    "   // this.name.el.grab_focus();",
     "    ",
-    "    _this.project.loadDirsToStringList(this.dir_model.el);",
     "    ",
-    "    if (c.path.length > 0) {",
+    "    if (!this.is_new) {",
     "\t    this.save_btn.el.set_label(\"Save\");",
-    "\t\t_this.filetype_lbl.el.hide();",
-    "\t\t_this.filetype.el.hide();",
-    "\t\t_this.filetype.showhide(); // as we only work on bjs files currently",
+    "\t\tthis.filetype_lbl.el.hide();",
+    "\t\tthis.filetype.el.hide();",
+    "\t\tthis.filetype.showhide(); // as we only work on bjs files currently",
     "    } else {",
+    "    ",
+    "\t\t//_this.project.loadDirsToStringList(this.dir_model.el, \"\");",
+    "\t\t//_this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
+    "    ",
     "        this.save_btn.el.set_label(\"Create\");",
-    "\t    _this.filetype.el.show();",
-    "\t    _this.filetype_lbl.el.show();",
-    "\t    _this.filetype.showhide();",
+    "\t    this.filetype.el.show();",
+    "\t    this.filetype_lbl.el.show();",
+    "\t    this.filetype_model.load();",
+    "\t\tthis.filetype.el.selected = Gtk.INVALID_LIST_POSITION;",
+    "\t    this.filetype.showhide();",
+    "\t    ",
     "    }",
     "    ",
     "    ",
index 49b9736..7181e95 100644 (file)
             return _PopoverFileDetails;
         }
         public Xcls_grid grid;
-        public Xcls_dir_dropdown_lbl dir_dropdown_lbl;
-        public Xcls_dir_dropdown dir_dropdown;
-        public Xcls_dir_model dir_model;
         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;
@@ -40,6 +41,7 @@
         public Xcls_save_btn save_btn;
 
             // 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;
@@ -55,6 +57,7 @@
             this.el = new Gtk.Window();
 
             // my vars (dec)
+            this.is_new = true;
             this.new_window = true;
             this.file = null;
             this.border_width = 0;
@@ -78,7 +81,7 @@
         }
 
         // user defined functions
-        public void show (JsRender.JsRender c, Gtk.Window pwin, bool new_window) 
+        public void show (JsRender.JsRender  c, Gtk.Window pwin, bool new_window) 
         {
             
             this.project = c.project;
@@ -89,7 +92,7 @@
                 //this.init();
              //} 
              
-             
+              this.is_new = c.name == "";
         
             _this.name.el.set_text(c.name);
             _this.title.el.set_text(c.title);
          
            _this.gen.el.active = c.gen_extended;
            
-               _this.path_lbl.el.show();
-            _this.path.el.show();
-            _this.dir_dropdown_lbl.el.hide();
-            _this.dir_dropdown.el.hide();
-            if (c.name == "") {
-               _this.path_lbl.el.hide();
-                   _this.path.el.hide();
-                   this.filetype_model.load();
-                _this.dir_dropdown_lbl.el.show();
-                   _this.dir_dropdown.el.show();
-                   
-            }   else {
-                _this.path.el.set_text(c.relpath);
-            }
-            
+        
             
             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 (c.name != "") {
+                   if (!this.is_new) {
                            this.build_module.setValue(c.build_module);
                    }
             }
             this.el.set_transient_for(pwin);
             
             // window + header?
-             print("SHOWALL - POPIP\n");
+             
             this.el.show();
-            this.name.el.grab_focus();
+           // this.name.el.grab_focus();
             
-            _this.project.loadDirsToStringList(this.dir_model.el);
             
-            if (c.path.length > 0) {
+            if (!this.is_new) {
                    this.save_btn.el.set_label("Save");
-                       _this.filetype_lbl.el.hide();
-                       _this.filetype.el.hide();
-                       _this.filetype.showhide(); // as we only work on bjs files currently
+                       this.filetype_lbl.el.hide();
+                       this.filetype.el.hide();
+                       this.filetype.showhide(); // as we only work on bjs files currently
             } else {
+            
+                       //_this.project.loadDirsToStringList(this.dir_model.el, "");
+                       //_this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
+            
                 this.save_btn.el.set_label("Create");
-                   _this.filetype.el.show();
-                   _this.filetype_lbl.el.show();
-                   _this.filetype.showhide();
+                   this.filetype.el.show();
+                   this.filetype_lbl.el.show();
+                   this.filetype_model.load();
+                       this.filetype.el.selected = Gtk.INVALID_LIST_POSITION;
+                   this.filetype.showhide();
+                   
             }
             
             
                 this.el.hexpand = true;
                 this.el.margin_bottom = 4;
                 this.el.margin_top = 4;
-                var child_1 = new Xcls_grid( _this );
-                this.el.append ( child_1.el  );
+                new Xcls_grid( _this );
+                this.el.append ( _this.grid.el  );
             }
 
             // user defined functions
                 this.el.hexpand = true;
                 this.el.column_spacing = 4;
                 this.el.row_spacing = 2;
-                var child_1 = new Xcls_dir_dropdown_lbl( _this );
-                this.el.attach( child_1.el, 0, 0, 1, 1 );
-                var child_2 = new Xcls_dir_dropdown( _this );
-                this.el.attach( child_2.el, 1, 0, 1, 1 );
-                var child_3 = new Xcls_filetype_lbl( _this );
-                this.el.attach( child_3.el, 0, 1, 1, 1 );
-                var child_4 = new Xcls_filetype( _this );
-                this.el.attach( child_4.el, 1, 1, 1, 1 );
-                var child_5 = new Xcls_Label10( _this );
-                child_5.ref();
-                this.el.attach( child_5.el, 0, 2, 1, 1 );
-                var child_6 = new Xcls_name( _this );
-                this.el.attach( child_6.el, 1, 2, 1, 1 );
-                var child_7 = new Xcls_title_lbl( _this );
-                this.el.attach( child_7.el, 0, 3, 1, 1 );
-                var child_8 = new Xcls_title( _this );
-                this.el.attach ( child_8.el , 1,2,1,1 );
-                var child_9 = new Xcls_region_lbl( _this );
-                this.el.attach( child_9.el, 0, 4, 1, 1 );
-                var child_10 = new Xcls_region( _this );
-                this.el.attach( child_10.el, 1, 4, 1, 1 );
-                var child_11 = new Xcls_parent_lbl( _this );
-                this.el.attach( child_11.el, 0, 5, 1, 1 );
-                var child_12 = new Xcls_parent( _this );
-                this.el.attach( child_12.el, 1, 5, 1, 1 );
-                var child_13 = new Xcls_permname_lbl( _this );
-                this.el.attach( child_13.el, 0, 6, 1, 1 );
-                var child_14 = new Xcls_permname( _this );
-                this.el.attach( child_14.el, 1, 6, 1, 1 );
-                var child_15 = new Xcls_modOrder_lbl( _this );
-                this.el.attach( child_15.el, 0, 7, 1, 1 );
-                var child_16 = new Xcls_modOrder( _this );
-                this.el.attach( child_16.el, 1, 7, 1, 1 );
-                var child_17 = new Xcls_build_module_lbl( _this );
-                this.el.attach( child_17.el, 0, 8, 1, 1 );
-                var child_18 = new Xcls_build_module( _this );
-                this.el.attach( child_18.el, 1, 8, 1, 1 );
-                var child_19 = new Xcls_path_lbl( _this );
-                this.el.attach( child_19.el, 0, 9, 1, 1 );
-                var child_20 = new Xcls_path( _this );
-                this.el.attach( child_20.el, 1, 9, 1, 1 );
-                var child_21 = new Xcls_gen_lbl( _this );
-                this.el.attach( child_21.el, 0, 10, 1, 1 );
-                var child_22 = new Xcls_gen( _this );
-                this.el.attach( child_22.el, 1, 10, 1, 1 );
+                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 );
             }
 
             // user defined functions
-            public void showAllRows () {
-               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 void hideRow (int row) 
+            public void xhideRow (int row) 
             {
                var el = _this.grid.el.get_child_at(0,row);
             
                el.hide();
             
             }
-        }
-        public class Xcls_dir_dropdown_lbl : Object
-        {
-            public Gtk.Label el;
-            private Xcls_PopoverFileDetails  _this;
-
-
-                // 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" );
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.justify = Gtk.Justification.RIGHT;
-                this.el.xalign = 0.900000f;
-                this.el.visible = true;
-            }
-
-            // user defined functions
-        }
-
-        public class Xcls_dir_dropdown : Object
-        {
-            public Gtk.DropDown 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;
-                var child_1 = new Xcls_dir_model( _this );
-                this.el = new Gtk.DropDown( child_1.el, null );
-
-                // my vars (dec)
-                this.colspan = 1;
-
-                // set gobject values
-            }
-
-            // user defined functions
-            public string getValue () {
-               return _this.dir_model.el.get_string(this.el.selected);
-            }
-        }
-        public class Xcls_dir_model : Object
-        {
-            public Gtk.StringList el;
-            private Xcls_PopoverFileDetails  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
-            {
-                _this = _owner;
-                _this.dir_model = this;
-                this.el = new Gtk.StringList( {} );
-
-                // my vars (dec)
-
-                // set gobject values
+            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();
+                }
             }
-
-            // user defined functions
         }
-
-
         public class Xcls_filetype_lbl : Object
         {
             public Gtk.Label el;
             {
                 _this = _owner;
                 _this.filetype = this;
-                var child_1 = new Xcls_filetype_model( _this );
-                this.el = new Gtk.DropDown( child_1.el, null );
+                new Xcls_filetype_model( _this );
+                this.el = new Gtk.DropDown( _this.filetype_model.el, null );
 
                 // my vars (dec)
 
 
             // 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 showhide ()   {
+                
             
-            
-               
+               _this.path_lbl.el.hide();
+                _this.path.el.hide();
+                
+                
+                _this.name_lbl.el.hide();
+                _this.name.el.hide();
+                
+                _this.dir_dropdown_lbl.el.hide();
+                _this.dir_dropdown.el.hide();
                
                _this.title_lbl.el.hide();
                _this.title.el.hide();
                
                _this.gen_lbl.el.hide();
                _this.gen.el.hide();
-             
+               
+              
                var sel = this.getValue();
+            
+               GLib.debug("showhide is new ? %s / sel = '%s'" , _this.is_new ? "YES" :"NO", sel); 
+               
+                if (_this.is_new) {
+                       if (sel == "" &&  _this.project.xtype == "Gtk") {
+                               return;
+                       }
+                        
+                 
+                    _this.dir_dropdown_lbl.el.show();
+                   _this.dir_dropdown.el.show();
+                   
+                    _this.name_lbl.el.show();
+                       _this.name.el.show();
+            
+                   
+                   
+                }   else {
+                    _this.path.el.set_text(_this.file.relpath);
+                }
+                
+               
+               
                
                switch(_this.project.xtype) {
                        case "Roo":
                                _this.build_module_lbl.el.show();
                                _this.build_module.el.show();
                
-                               _this.gen_lbl.el.show();
-                               _this.gen.el.show();
-                           
+                                
+                               
+                               if (sel == "bjs" || sel == "vala") {
+                                        _this.project.loadDirsToStringList(_this.dir_model.el, "/src");
+                                        _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
+                               _this.name_lbl.el.label = "Component Name (Filename with-out extension)";                                
+                               
+                               if (sel == "bjs") {
+                                       _this.gen_lbl.el.show();
+                                       _this.gen.el.show();
+                               }
+                               
+                               
+                               
+                               } else {
+                               _this.project.loadDirsToStringList(_this.dir_model.el, "");
+                               _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;
+                               _this.name_lbl.el.label = "File Name (with extension)";
+                       }
                                break;
                }
              
         }
 
 
-        public class Xcls_Label10 : Object
+        public class Xcls_dir_dropdown_lbl : Object
+        {
+            public Gtk.Label el;
+            private Xcls_PopoverFileDetails  _this;
+
+
+                // 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" );
+
+                // my vars (dec)
+
+                // set gobject values
+                this.el.justify = Gtk.Justification.RIGHT;
+                this.el.xalign = 0.900000f;
+                this.el.visible = true;
+            }
+
+            // user defined functions
+        }
+
+        public class Xcls_dir_dropdown : Object
+        {
+            public Gtk.DropDown 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 (dec)
+                this.colspan = 1;
+
+                // set gobject values
+            }
+
+            // user defined functions
+            public string getValue () {
+               return _this.dir_model.el.get_string(this.el.selected);
+            }
+        }
+        public class Xcls_dir_model : Object
+        {
+            public Gtk.StringList el;
+            private Xcls_PopoverFileDetails  _this;
+
+
+                // my vars (def)
+
+            // ctor
+            public Xcls_dir_model(Xcls_PopoverFileDetails _owner )
+            {
+                _this = _owner;
+                _this.dir_model = this;
+                this.el = new Gtk.StringList( {} );
+
+                // my vars (dec)
+
+                // set gobject values
+            }
+
+            // user defined functions
+        }
+
+
+        public class Xcls_name_lbl : Object
         {
             public Gtk.Label el;
             private Xcls_PopoverFileDetails  _this;
                 // my vars (def)
 
             // ctor
-            public Xcls_Label10(Xcls_PopoverFileDetails _owner )
+            public Xcls_name_lbl(Xcls_PopoverFileDetails _owner )
             {
                 _this = _owner;
+                _this.name_lbl = this;
                 this.el = new Gtk.Label( "Component Name (File name without extension)" );
 
                 // my vars (dec)
             {
                 _this = _owner;
                 _this.build_module = this;
-                var child_1 = new Xcls_build_module_model( _this );
-                this.el = new Gtk.DropDown( child_1.el, null );
+                new Xcls_build_module_model( _this );
+                this.el = new Gtk.DropDown( _this.build_module_model.el, null );
 
                 // my vars (dec)
 
             {
                 _this = _owner;
                 _this.gen_lbl = this;
-                this.el = new Gtk.Label( "Generate as Extended (experimental)" );
+                this.el = new Gtk.Label( "Generate as Extended (no working)" );
 
                 // my vars (dec)
                 this.colspan = 1;
                 var child_1 = new Xcls_Button30( _this );
                 child_1.ref();
                 this.el.pack_start ( child_1.el  );
-                var child_2 = new Xcls_save_btn( _this );
-                this.el.pack_end ( child_2.el  );
+                new Xcls_save_btn( _this );
+                this.el.pack_end ( _this.save_btn.el  );
             }
 
             // user defined functions
index 907773c..df33c1b 100644 (file)
@@ -3,8 +3,8 @@
  "gen_extended" : false,
  "items" : [
   {
+   "$ Project.Callback doneObj" : "null",
    "$ xns" : "Gtk",
-   "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "Project.Gtk project" : "null",
    "Project.GtkValaSettings? selected_target" : "null",
    "Xcls_MainWindow window" : "null",
            "_this.project.save(); ",
            " ",
            "\t// what about .js ?",
-           "   _this.done = true;",
-           "\t_this.el.hide();",
-           "",
+           "_this.done = true;",
+           "_this.el.hide();",
+           "if (_this.doneObj != null) {",
+           "\t_this.doneObj.call(_this.project);",
+           "}",
            "// hopefull this will work with bjs files..",
            "\t",
            " ",
     "}"
    ],
    "| void show" : [
-    "(Gtk.Window pwin, Project.Gtk project) {",
+    "(Gtk.Window pwin, Project.Gtk project, Project.Callback doneObj) {",
     "     ",
     "    //print(\"ValaProjectSettings show\\n\");",
-    "    ",
+    "    this.doneObj = doneObj;",
     "    this.project=  project;",
     "\t ",
     "    this.compile_flags.el.buffer.set_text(",
     "//\tGtk.Allocation rect;",
     "\t//btn.get_allocation(out rect);",
     " //   this.el.set_pointing_to(rect);",
-    "\tthis.el.set_transient_for(pwin);",
+    " this.el.application = pwin.application; // ??? make it modal?",
+    "\t this.el.set_transient_for(pwin);",
+    "\t ",
     "\t// window + header?",
     "\t// print(\"SHOWALL - POPIP\\n\");",
     "\tthis.el.set_size_request(800,800);",
index 7969950..cdbf088 100644 (file)
@@ -35,8 +35,8 @@
         public Xcls_save_btn save_btn;
 
             // my vars (def)
+        public Project.Callback doneObj;
         public Xcls_MainWindow window;
-        public Gtk.PositionType position;
         public Project.GtkValaSettings? selected_target;
         public uint border_width;
         public bool done;
@@ -50,8 +50,8 @@
             this.el = new Gtk.Window();
 
             // my vars (dec)
+            this.doneObj = null;
             this.window = null;
-            this.position = Gtk.PositionType.RIGHT;
             this.selected_target = null;
             this.border_width = 0;
             this.done = false;
         }
 
         // user defined functions
-        public void show (Gtk.Window pwin, Project.Gtk project) {
+        public void show (Gtk.Window pwin, Project.Gtk project, Project.Callback doneObj) {
              
             //print("ValaProjectSettings show\n");
-            
+            this.doneObj = doneObj;
             this.project=  project;
                 
             this.compile_flags.el.buffer.set_text(
         //     Gtk.Allocation rect;
                //btn.get_allocation(out rect);
          //   this.el.set_pointing_to(rect);
-               this.el.set_transient_for(pwin);
+         this.el.application = pwin.application; // ??? make it modal?
+                this.el.set_transient_for(pwin);
+                
                // window + header?
                // print("SHOWALL - POPIP\n");
                this.el.set_size_request(800,800);
                 _this.project.save(); 
                  
                        // what about .js ?
-                   _this.done = true;
-                       _this.el.hide();
-                
+                _this.done = true;
+                _this.el.hide();
+                if (_this.doneObj != null) {
+                       _this.doneObj.call(_this.project);
+                }
                 // hopefull this will work with bjs files..
                        
                  
index efd164d..832c367 100644 (file)
@@ -421,7 +421,7 @@ public class WindowState : Object
 
        }
        
-       public void projectPopoverShow(Gtk.Window pwin, Project.Project? pr) 
+       public void projectPopoverShow(Gtk.Window pwin, Project.Project? pr, Project.Callback? doneObj
        { 
                if (pr == null) {
                    pr = this.project;
@@ -438,7 +438,7 @@ public class WindowState : Object
 
                // gtk..
                
-               this.vala_projectsettings_pop.show(pwin,(Project.Gtk)pr);
+               this.vala_projectsettings_pop.show(pwin,(Project.Gtk)pr,  doneObj);
        
        }
        
index adf5d55..04f590b 100644 (file)
@@ -61,7 +61,16 @@ namespace JsRender {
                        private set {}
                }
                
-               
+               public string file_ext {
+                       public owned get {
+                               if (!this.path.contains(".")) {
+                                       return "";
+                               }
+                               var bits = this.name.split(".");
+                               return bits[bits.length-1];
+                       }
+                       private set {}
+               }
                public string parent = "";  // JS parent.
                public string region = "";  // RooJS - insert region.
         
index fe034ff..716a252 100644 (file)
@@ -40,15 +40,21 @@ namespace Project {
                INVALID_FORMAT
        }
 
+
+       
        // static array of all projects.
        private Gee.ArrayList<Project>  projects;
        
        
        
        public bool  projects_loaded = false;
-
        
        
+       // used to pass around callbacks with project as a return
+       public class Callback : Object {
+               public signal void call(Project project);
+       }
+       
        public abstract class Project : Object {
                
                public signal void on_changed (); 
@@ -930,7 +936,8 @@ namespace Project {
                        return false;
                        
                }
-               public void loadDirsToStringList( global::Gtk.StringList sl) 
+               
+               public void loadDirsToStringList( global::Gtk.StringList sl, string prefix) 
                {
                         
                        while (sl.get_n_items() > 0) {
@@ -938,8 +945,11 @@ namespace Project {
                        }
                        
                        foreach(var sp in this.sub_paths) {
-                                
-                               sl.append( sp.path == this.path ? "/" : sp.path.substring(this.path.length));
+                                var add = sp.path == this.path ? "/" : sp.path.substring(this.path.length);
+                               if (prefix.length > 0 && !add.has_prefix(prefix)) {
+                                       continue;
+                               }
+                               sl.append(add);
                        }
                
                }