X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=RooRepo.vala;h=eb4740684450124ebd9303a074863ac3fc12a2c4;hb=a6c214d30b033aadeec72b2532daccacbfadadf8;hp=db200269a939c2451df0647e488248e3d6cdc36a;hpb=3f56c2a09d7b4dedf2980b10a1c3af0d8d30cf5b;p=gitlive diff --git a/RooRepo.vala b/RooRepo.vala index db200269..eb474068 100644 --- a/RooRepo.vala +++ b/RooRepo.vala @@ -5,24 +5,29 @@ 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 _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 _repos; // only available for singletonn. + public static Gee.ArrayList repos() { RooRepo.init(); return RooRepo._repos; @@ -39,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 { @@ -85,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)); }