Clones.bjs
[gitlive] / Clones.js
index 26ed4a1..1a423e7 100644 (file)
--- a/Clones.js
+++ b/Clones.js
@@ -13,8 +13,8 @@ Clones=new XObject({
     xtype: Gtk.Dialog,
     listeners : {
         destroy_event : function (self, event) {
-             this.el.hide();
-                        return false;
+              print("DESTROY?!");
+             return true;
         },
         response : function (self, id) {
           // hide
@@ -50,7 +50,7 @@ Clones=new XObject({
         });
        // shouild set path..
         */
-     
+        this.el.set_deletable(false);
         this.el.show_all();
         // load clones..
             this.get('/reposStore').load();
@@ -333,6 +333,18 @@ Clones=new XObject({
                                     xtype: Gtk.ListStore,
                                     id : "reposStore",
                                     pack : "set_model",
+                                    pathToRepo : function(path) {
+                                    
+                                        var tr= this.repos;
+                                    
+                                        
+                                        for(var i =0 ; i < tr.length; i++) {
+                                            if (tr[i].repopath == path) {
+                                                return tr;
+                                            }
+                                        } 
+                                        return false; 
+                                    },
                                     init : function() {
                                         XObject.prototype.init.call(this);
                                         this.el.set_column_types ( 8, [
@@ -361,6 +373,13 @@ Clones=new XObject({
                                             
                                             //print(JSON.stringify(ret,null,4));
                                              tr[i].getBranches();
+                                             tr[i].getStatus();
+                                             var hi;
+                                             try {
+                                                 //tr[i].debug=1;
+                                                  hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
+                                    //             print(JSON.stringify(hi,null,4));
+                                             } catch(e) { print(e);}
                                               
                                             this.el.set_value(ret.iter, 0, '' +  tr[i].repopath.split('/').pop() );
                                             this.el.set_value(ret.iter, 1, '' + tr[i].currentBranch.name   );
@@ -368,13 +387,24 @@ Clones=new XObject({
                                                             function(e) { return e.name; 
                                                         }).join(', ') 
                                              );
-                                            this.el.set_value(ret.iter, 3, '' + 'tbc' );        
+                                            this.el.set_value(ret.iter, 3, '' +  (!hi  ? '??' : hi[0].changed_raw));        
                                             this.el.set_value(ret.iter, 4, tr[i].autocommit() );                
                                             this.el.set_value(ret.iter, 5, tr[i].autopush() );                        
                                             this.el.set_value(ret.iter, 6,  tr[i].repopath );  
                                             // highlight color.
                                             var cb = tr[i].currentBranch;
-                                            var col = cb.lastrev == cb.remoterev ? '#ff0000' : '#ffffff';
+                                            //print(JSON.stringify(cb,null,4));
+                                            var col = '#ffffff';
+                                            if (cb.lastrev != cb.remoterev) {
+                                                col =  '#ff0000';
+                                            }
+                                            if (tr[i].hasLocalChanges) {
+                                                col =  '#0000ff';
+                                            }
+                                            if  ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
+                                                col =  '#ff00ff';
+                                            }
+                                            
                                             this.el.set_value(ret.iter, 7, col  );      
                                             
                                         }     
@@ -405,6 +435,12 @@ Clones=new XObject({
                                                     //print(JSON.stringify(value));
                                                     store.el.set_value(ret.iter,4, !value);
                                                     
+                                                     var path =  this.el.set_value(ret.iter, 6).value.get_string();
+                                                     var repo = store.pathToRepo(path);
+                                                     repo.autocommit(!value);
+                                                     
+                                                    
+                                                    
                                                 }
                                             },
                                             pack : "pack_start",
@@ -435,7 +471,10 @@ Clones=new XObject({
                                                                                                                  
                                                     //print(JSON.stringify(value));
                                                     store.el.set_value(ret.iter,5, !value);
-                                                    
+                                                      var path =  this.el.get_value(ret.iter, 6).value.get_string();
+                                                     var repo = store.pathToRepo(path);
+                                                     repo.autopush(!value);
+                                                     
                                                 }
                                             },
                                             pack : "pack_start",
@@ -469,6 +508,7 @@ Clones=new XObject({
                                     init : function() {
                                         XObject.prototype.init.call(this);
                                         this.el.add_attribute(this.items[0].el , 'markup', 1 );
+                                         this.el.add_attribute(this.items[0].el , 'cell-background', 7 );
                                     
                                     },
                                     items : [