pre release fixes
[roobuilder] / src / Project / VapiSelection.vala
1 /**
2   Simple wrapper around selected vapi packages
3   for list store
4 */
5
6 public class Project.VapiSelection : Object 
7 {
8         //Project project;
9         public string name { get;  set; }
10         public string sortkey {
11                  owned get {
12                         return (this.vapi_list.contains(this.name)? "A" : "Z" ) + "-"+ this.name;
13                 }
14                 set {}
15                 
16         }
17         public bool selected {
18                 get {
19                         var res = this.vapi_list.contains(this.name);
20                         GLib.debug("vapi %s = %s", this.name, res ? "X" : "");
21                         return res;
22                 }
23                 set {
24                         if (value) {
25                                 if (!vapi_list.contains(this.name)) {
26                                         GLib.debug("vapi set %s = X", this.name);
27                                         this.vapi_list.add(this.name);
28                                         this.sortkey = "";
29                                         if (this.btn != null) {
30                                                 this.btn.active = true;
31                                         }
32                                          
33                                 }
34                         } else {
35                                 if (vapi_list.contains(this.name)) {
36                                         GLib.debug("vapi set %s = .", this.name);
37                                         this.vapi_list.remove(this.name);
38                                         if (this.btn != null) {
39                                                 this.btn.active = false;
40                                         }
41                                         this.sortkey = "";
42                                          
43                                 }
44                         }
45                 }
46         }
47         Gee.ArrayList<string> vapi_list;
48         public global::Gtk.CheckButton? btn = null;
49         
50         public VapiSelection( Gee.ArrayList<string> vapi_list, string name)
51         {
52                 //this.project = project;
53                 this.vapi_list = vapi_list;
54                 this.name = name;
55         }
56 }