3 // an object describing a build config (or generic ...)
4 public class GtkValaSettings : Object {
5 public string name { get; set; }
10 public Gee.ArrayList<string> sources; // list of files+dirs (relative to project)
13 public string execute_args;
15 public bool loading_ui = true;
17 public GtkValaSettings(Gtk project, string name)
20 this.project = project;
23 this.sources = new Gee.ArrayList<string>();
24 this.execute_args = "";
28 public GtkValaSettings.from_json(Gtk project, Json.Object el) {
30 this.project = project;
31 this.name = el.get_string_member("name");
33 if ( el.has_member("execute_args")) {
34 this.execute_args = el.get_string_member("execute_args");
36 this.execute_args = "";
38 // sources and packages.
39 this.sources = this.filterFiles(this.project.readArray(el.get_array_member("sources")));
44 // why not array of strings?
48 public Json.Object toJson()
50 var ret = new Json.Object();
51 ret.set_string_member("name", this.name);
52 ret.set_string_member("execute_args", this.execute_args);
54 ret.set_array_member("sources", this.writeArray( this.filterFiles(this.sources)));
59 public Json.Array writeArray(Gee.ArrayList<string> ar) {
60 var ret = new Json.Array();
61 for(var i =0; i< ar.size; i++) {
62 ret.add_string_element(ar.get(i));
66 public bool has_file(JsRender.JsRender file)
69 GLib.debug("Checking %s has file %s", this.name, file.path);
70 var pr = (Gtk) file.project;
71 for(var i = 0; i < this.sources.size;i++) {
72 var path = pr.path + "/" + this.sources.get(i);
73 GLib.debug("check %s", path);
75 if (path == file.path) {
80 GLib.debug("CANT FIND IT");
85 public Gee.ArrayList<string> filterFiles( Gee.ArrayList<string> ar)
87 var ret = new Gee.ArrayList<string>();
88 foreach(var f in ar) {
89 if (null == this.project.getByRelPath(f)) {