X-Git-Url: http://git.roojs.org/?p=app.Builder.js;a=blobdiff_plain;f=src%2FResources.vala;h=f35b38972fc9799cfbd3515fa3ca2886af21cc0c;hp=41670be6eb38f94e4ae60edfaf66827243eae6af;hb=7e857d8072408ca9f7a3384f2bff241200b5991c;hpb=daec156f98cb2d1390da2598bf19b3fa1583f4da diff --git a/src/Resources.vala b/src/Resources.vala index 41670be6e..f35b38972 100644 --- a/src/Resources.vala +++ b/src/Resources.vala @@ -61,7 +61,7 @@ public class ResourcesItem : Object { public class Resources : Object { - public signal void updateProgress(uint cur_pos); + public signal void updateProgress(uint cur_pos, uint total); static Resources singleton_val; @@ -88,7 +88,8 @@ public class Resources : Object string[] avail_files = { "roodata.json", "*", - "Editors/*.js" + "Editors/*.js", + "vapi/*" }; this.fetch_files = new Gee.ArrayList(); @@ -102,7 +103,13 @@ public class Resources : Object } if (target.contains("*")) { var split = target.split("*"); + src = "https://api.github.com/repos/roojs/app.Builder.js/contents/resources/" + split[0]; + if (split[0] == "vapi/") { + src = "https://api.github.com/repos/roojs/app.Builder.js/contents/src/vapi"; + + } + } this.fetch_files.add(new ResourcesItem(src,target, "")); @@ -126,11 +133,11 @@ public class Resources : Object { var cur = this.fetch_pos; this.fetch_pos++; - this.updateProgress(this.fetch_pos); // min=0; + this.updateProgress(this.fetch_pos, this.fetch_files.size); // min=0; if (this.fetch_pos > this.fetch_files.size) { - this.updateProgress(0); + this.updateProgress(0,0); this.fetch_pos = 0; return; @@ -157,7 +164,7 @@ public class Resources : Object "roo.builder.js", "roodata.json", "RooUsage.txt" - } + }; for (var i = 0; i < required.length; i++ ) { @@ -176,6 +183,7 @@ public class Resources : Object public void parseDirectory(string json, string target) { + print("%s\n", json); var pa = new Json.Parser(); pa.load_from_data(json); var node = pa.get_root(); @@ -199,7 +207,11 @@ public class Resources : Object if (this.files_has_target(split[0] + n)) { continue; } - var src = "https://raw.githubusercontent.com/roojs/app.Builder.js/master/resources/" + split[0] + n; + + + + var src = ob.get_string_member("download_url"); + // "https://raw.githubusercontent.com/roojs/app.Builder.js/master/resources/" + split[0] + n; var add = new ResourcesItem(src, split[0] + n, ob.get_string_member("sha") ); //add.new_sha = ob.get_string_member("sha"); this.fetch_files.add(add);