src/Project/Gtk.vala
[app.Builder.js] / src / Project / Gtk.vala
index c033c79..1b719a2 100644 (file)
@@ -108,9 +108,21 @@ namespace Project {
                        return ;
                         
                }
+               /**
+                *  perhaps we should select the default in the window somewhere...
+                */ 
                public string firstBuildModule()
                {
-                       
+                       var iter = this.compilegroups.map_iterator();
+                       while(iter.next()) {
+                                
+                                if (iter.get_value().name == "__default__") {
+                                        continue;
+                                }
+                                
+                                return iter.get_value().name;
+                       }
+                       return "";
                }
                
                
@@ -139,6 +151,17 @@ namespace Project {
                        }
         
                }
+               /**
+                * get a list of files for a folder..
+                * 
+                * - in the project manager this has to list all possible compilable 
+                *   files  - eg. exclue XXX.vala.c or XXX.c with the same name as 
+                *   a vala file (so to ignore the generated files)
+                * 
+                * - for the editor navigation - this should exclude all files that
+                *   are vala based on a bjs file..
+                *  
+                */
                 
                
                public Gee.ArrayList<string> files(string in_path)
@@ -162,7 +185,7 @@ namespace Project {
           
                        try {
                                var file_enum = dir.enumerate_children(
-                                               GLib.FileAttribute.STANDARD_DISPLAY_NAME, 
+                                       GLib.FileAttribute.STANDARD_DISPLAY_NAME, 
                                        GLib.FileQueryInfoFlags.NONE, 
                                        null
                                );
@@ -192,22 +215,30 @@ namespace Project {
                                        // any other valid types???
                                
                                }
+                               
+                       } catch(Error e) {
+                               GLib.warning("oops - something went wrong scanning the projects\n");
+                       }       
+                                
                                // add the cfiles to ret - if they do not have a vala...
-                               for (var i = 0; i < cfiles.size; i ++) {
-                                       
-                                       var vv = (new Regex("\\.c$")).replace(  
-                                                       cfiles.get(i), cfiles.get(i).length, 0, ".vala");
-                                                       
-                                       if (ret.index_of( vv) > -1) {
-                                               continue;
-                                       }
-                                       ret.add(cfiles.get(i));
+                       for (var i = 0; i < cfiles.size; i ++) {
+                               
+                               var fn = cfiles.get(i);
+                               vv = fn;
+                               try {
+                                       vv = (new Regex("\\.c$")).replace( fn, fn, 0, ".vala");
+                               } catch (Error e) {
+                                       continue;
                                }
+                                       
                                                
-                                      
-                       } catch(Error e) {
-                               GLib.warning("oops - something went wrong scanning the projects\n");
+                               if (ret.index_of( vv) > -1) {
+                                       continue;
+                               }
+                               ret.add(fn);
                        }
+                                               
+                        
                        GLib.debug("SCAN %s = returning %d", dirname, ret.size);
                         
                        return ret;