src/Builder4/ValaProjectSettings.bjs
[app.Builder.js] / src / Builder4 / ValaProjectSettings.vala
index d23de63..28c3e6a 100644 (file)
@@ -1157,7 +1157,7 @@ public class ValaProjectSettings : Object
                    
                    _this.build_pack_target.el.set_text(cg.target_bin);
                    _this.build_compile_flags.el.set_text(cg.compile_flags);
-                   
+                   _this.set_vbox.cgroup = cg;
                    //_this.files_tree_store.updatesel(cg);
                    // load the srouces
                    
@@ -1212,7 +1212,7 @@ public class ValaProjectSettings : Object
                 //this.el.set_value(citer, 1,   items.get(i) );
             };
             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-            
+            _this.set_vbox.el.hide();
         }
     }
     public class Xcls_TreeViewColumn35 : Object 
@@ -1282,7 +1282,7 @@ public class ValaProjectSettings : Object
                     cg.name = newtext;
                     _this.project.compilegroups.unset(oldval);
                     _this.project.compilegroups.set(newtext, cg);
-                _this.targets_tree_store.load();
+                   _this.targets_tree_store.load();
               });
         }
 
@@ -1295,6 +1295,7 @@ public class ValaProjectSettings : Object
 
 
             // my vars (def)
+        public Project.GtkValaSettings cgroup;
 
         // ctor 
         public Xcls_set_vbox(ValaProjectSettings _owner )
@@ -1304,6 +1305,7 @@ public class ValaProjectSettings : Object
             this.el = new Gtk.VBox( false, 0 );
 
             // my vars (dec)
+            this.cgroup = null;
 
             // set gobject values
             var child_0 = new Xcls_Label38( _this );
@@ -1470,6 +1472,7 @@ public class ValaProjectSettings : Object
             // set gobject values
             var child_0 = new Xcls_files_tree( _this );
             child_0.ref();
+            this.el.add (  child_0.el  );
         }
 
         // user defined functions 
@@ -1517,7 +1520,8 @@ public class ValaProjectSettings : Object
         {
             _this = _owner;
             _this.files_tree_store = this;
-            this.el = new Gtk.ListStore( 3,     typeof(string),  // 0 file name
+            this.el = new Gtk.ListStore( 4,     typeof(string),  // 0 file name
+        typeof(string),  // 0 basename
      typeof(string), // type (dir orfile)
      typeof(bool)  // is checked.
       );
@@ -1530,7 +1534,7 @@ public class ValaProjectSettings : Object
         // user defined functions 
         public void load () {
          
-          this.el.clear();
+              this.el.clear();
           
             
              var def = _this.project.compilegroups.get("_default_");
@@ -1546,17 +1550,22 @@ public class ValaProjectSettings : Object
                  this.el.append(out citer);   
                  
                 this.el.set_value(citer, 0,   items.get(i) ); // title 
-                this.el.set_value(citer, 1,   "dir"); // type         
-                this.el.set_value(citer, 2,   false ); // checked 
+                this.el.set_value(citer, 1,   "<span foreground=\"green\" font_weight=\"bold\">" + 
+                            GLib.Markup.escape_text(items.get(i)) + "</span>"
+                    ); // title 
+                print("ADD item %s", items.get(i));
+                this.el.set_value(citer, 2,   "dir"); // type         
+                this.el.set_value(citer, 3,   false ); // checked 
         
                 var files = _this.project.files(items.get(i));
                 
                  for(var j =0 ; j < files.size; j++) {
                     this.el.append(out citer);   
-                 
+                         print("ADD item %s", files.get(j));
                     this.el.set_value(citer, 0,   files.get(j) ); // title 
-                    this.el.set_value(citer, 1,   "file"); // type         
-                    this.el.set_value(citer, 2,   false ); // checked 
+                    this.el.set_value(citer, 1,   GLib.Markup.escape_text( Path.get_basename (files.get(j))) ); // title             
+                    this.el.set_value(citer, 2,   "file"); // type         
+                    this.el.set_value(citer, 3,   false ); // checked 
         
                 }
                 
@@ -1565,6 +1574,28 @@ public class ValaProjectSettings : Object
             }
             this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
             
+        }
+        public void update () {
+        
+        
+            Gtk.TreeIter citer;
+        
+            for(var i =0 ; i < this.el.iter_n_children(null); i++) {
+                this.el.iter_nth_child(citer,null,i);
+        
+                GLib.Value val;
+                this.el.get_value(iter,0, out val);
+                var fn = (string) val;
+                
+                var active = false;
+                if (_this.set_vbox.cgroup.sources.contains(fn)) {
+                    active = true;
+                }
+                
+                this.el.set_value(citer, 3,   active ); // checked 
+            }
+        
+        
         }
     }
     public class Xcls_TreeViewColumn46 : Object 
@@ -1592,7 +1623,7 @@ public class ValaProjectSettings : Object
 
             // init method 
 
-            this.el.add_attribute(_this.files_render.el , "text", 0 ); 
+            this.el.add_attribute(_this.files_render.el , "markup", 1 ); // basnemae
              
             /*  this.el.add_attribute(_this.files_render.el , "markup", 2 );
             */
@@ -1649,7 +1680,7 @@ public class ValaProjectSettings : Object
             // init method 
 
             {
-             this.el.add_attribute(_this.files_render_use.el , "active", 2 );
+             this.el.add_attribute(_this.files_render_use.el , "active", 3 );
              }
         }
 
@@ -1677,24 +1708,40 @@ public class ValaProjectSettings : Object
 
             // listeners 
             this.el.toggled.connect( (  path_string) =>  { 
-                var m = _this.default_packages_tree_store.el;
+            
+            
+            
+                var m = _this.files_tree_store.el;
                Gtk.TreeIter iter;
                Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
                m.get_iter (out iter, path);
                GLib.Value val;
-               m.get_value(iter, 1, out val);
-               m.set_value(iter, 1,  ((bool) val) ? false :true); 
-                 GLib.Value fval;  
+               m.get_value(iter, 3, out val);
+               m.set_value(iter, 3,  ((bool) val) ? false :true); 
+               
+               // type.
+               GLib.Value ftval;  
+               m.get_value(iter, 2, out ftval);
+               var ftype = (string)ftval;   
+               
+               // full name...  
+               GLib.Value fval;     
                m.get_value(iter, 0, out fval);
                var fn = (string)fval;
                 
-                var def = _this.project.compilegroups.get("_default_");
-                var items  = def.packages;
+                
+                var cg =   _this.set_vbox.cgroup;
+                // what's the sleected target?
+                // update the list..
+                // if ftype is a dir == then toggle all the bellow.
+                // if ftype is a file .. see if all the files in that directory are check and check the dir.
+            
+                 
                 if ((bool)val) {
                     // renive
-                    items.remove(fn);
+                    cg.sources.remove(fn);
                 } else {
-                    items.add(fn);
+                    cg.sources.add(fn);
                 }
                 
             });