X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=RooRepo.vala;h=eb4740684450124ebd9303a074863ac3fc12a2c4;hb=29bc25b07236120c6aaa4e053bf6e78bba6c3156;hp=11df7a317b7c79605e7fd81a0a6a71df4da4c604;hpb=e72babd0e136a555062dc816bf360ac240e7e9f3;p=gitlive diff --git a/RooRepo.vala b/RooRepo.vala index 11df7a31..eb474068 100644 --- a/RooRepo.vala +++ b/RooRepo.vala @@ -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 _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. - static Gee.ArrayList init() { + + public static Gee.ArrayList 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)); }