src/Project/Gtk.vala
[app.Builder.js] / src / Project / Gtk.vala
index e026af9..0c29891 100644 (file)
@@ -214,42 +214,104 @@ namespace Project {
                        var ret =  new Gee.ArrayList<string>();
                        
                        
-                       for (var i = 0; i < cfiles.size; i ++) {
-                               var fn = cfiles.get(i);
-                               if (Regex.match_simple("\\.vala$", fn)) {
-                                       ret.add( fn);
-                                       continue;
-                               }
-                               // vala.c -- ignore..
-                               if (Regex.match_simple("\\.vala\\.c$", fn)) {
-                                       continue;
-                               }
-                               // not a c file...
-                               if (!Regex.match_simple("\\.c$", fn)) {
-                                       continue;
-                               }
-                               
-                               // got a file that is not 
-                               
-                               var vv = fn;
+                       for (var i = 0; i < allfiles.size; i ++) {
+                               var fn = allfiles.get(i);
                                try {
-                                       vv = (new Regex("\\.c$")).replace( fn, fn, 0, ".vala");
+                                       if (Regex.match_simple("\\.vala$", fn)) {
+                                               ret.add( fn);
+                                               continue;
+                                       }
+                                       // vala.c -- ignore..
+                                       if (Regex.match_simple("\\.vala\\.c$", fn)) {
+                                               continue;
+                                       }
+                                       // not a c file...
+                                       if (!Regex.match_simple("\\.c$", fn)) {
+                                               continue;
+                                       }
+                                       
+                                       // is the c file the same as a vala file...
+                                       
+                                        
+                                       
+                                       var vv = (new Regex("\\.c$")).replace( fn, fn, 0, ".vala");
+                               
+                                       
+                                               
+                                       if (allfiles.index_of( vv) > -1) {
+                                               continue;
+                                       }
+                                       // add the 'c' file..
+                                       ret.add(fn);
                                } catch (Error e) {
                                        continue;
                                }
-                               if (Regex.match_simple("\\.vala\\.c$", fn)) {
+                       }
+                       // sort.
+                       ret.sort((fa,fb) => {
+                               return ((string)fa).collate(string) fb);
+                       });
+                       return ret;
+                       
+               }
+               
+               public Gee.ArrayList<string> filesForOpen(string in_path)
+               {
+                       var allfiles = this.fileAll();
+                       var ret =  new Gee.ArrayList<string>();
+                       
+                       
+                       for (var i = 0; i < allfiles.size; i ++) {
+                               var fn = cfiles.get(i);
+                               try {
+                                       
+                                       if (Regex.match_simple("\\.vala\\.c$", fn)) {
+                                               continue;
+                                       }
+                                       
+                                       if (Regex.match_simple("\\.bjs$", fn)) {
+                                               continue;
+                                       }
+                                       
+                                       if (Regex.match_simple("\\.vala$", fn)) {
+                                               ret.add( fn);
+                                               continue;
+                                       }
+                                       // vala.c -- ignore..
+                                       
+                                       // not a c file...
+                                       if (!Regex.match_simple("\\.c$", fn)) {
                                                continue;
-                                       }       
+                                       }
+                                       
+                                       // is the c file the same as a vala file...
+                                       
+                                       var vv = fn;
+                               
+                                       vv = (new Regex("\\.c$")).replace( fn, fn, 0, ".vala");
+                               
+                                       
                                                
-                               if (ret.index_of( vv) > -1) {
+                                       if (ret.index_of( vv) > -1) {
+                                               continue;
+                                       }
+                                       // add the 'c' file..
+                                       ret.add(fn);
+                               } catch (Error e) {
                                        continue;
                                }
-                               ret.add(fn);
                        }
+                       // sort.
+                       ret.sort((fa,fb) => {
+                               return ((string)fa).collate(string) fb);
+                       });
+                       return ret;
                        
                }
                
                
+               
+               
                public Gee.ArrayList<string> files(string in_path)
                {
                        var ret =  new Gee.ArrayList<string>();