MergeBranch.bjs
[gitlive] / RooRepo.vala
index 4324b73..eb47406 100644 (file)
@@ -5,28 +5,34 @@ static RooRepo _RooRepo ;
 public class RooRepo : Object 
 {
  
-       
-
+       
        public string  id; // not really important that they are numbers..
        public string project_id;
        public string description;
        public string shortname;
        
        
+       // -- static below...
+       const string roourl = "https://roojs.com/admin.php/Roo";  
+       static Gee.ArrayList<RooRepo> _repos; // only available for singletonn.         
+       static int loadcount = 0;
+       
        static RooRepo init()
        {
                if (_RooRepo == null) {
                        _RooRepo = new RooRepo();
+               RooRepo.loadcount = 0;
                        RooRepo.load();
                }
                return _RooRepo;
        }
        
-       static Gee.ArrayList<RooRepo> _repos; // only available for singletonn.         
-       static public  Gee.ArrayList<RooRepo>() {
+
+       public static  Gee.ArrayList<RooRepo> repos() {
                RooRepo.init();
                return RooRepo._repos;
        }
+       
        static RooRepo add(Json.Object t)
        {
                var add = new RooRepo();
@@ -38,6 +44,16 @@ public class RooRepo : Object
                GLib.debug("ADD project  %s : %s : %s", add.id, add.shortname, add.project_id);
                return add;
        }
+       
+       public static void reload()  /// has to be called on singleton..
+       {
+               RooRepo.loadcount = 0;
+               RooRepo.init();
+               if (RooRepo.loadcount == 0 ) {
+                       RooRepo.load();
+               }
+       }
+       
        static void load() // only called from above
        {
 
@@ -84,7 +100,7 @@ public class RooRepo : Object
                        // got a valid result...
  
                        for(var i = 0; i < rd.get_length(); i++) {
-                               _this.add(rd.get_object_element(i));
+                               RooRepo.add(rd.get_object_element(i));
                        }