Clones.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 30 Oct 2018 07:43:43 +0000 (15:43 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 30 Oct 2018 07:43:43 +0000 (15:43 +0800)
Clones.vala

Clones.bjs
Clones.vala

index 8e69726..c4768b0 100644 (file)
            "$ pathToRepo" : "function(path) {\n\n    var tr= this.repos;\n\n    \n    for(var i =0 ; i < tr.length; i++) {\n        if (tr[i].repopath == path) {\n            return tr[i];\n        }\n    } \n    return false; \n}\n",
            "xtype" : "ListStore",
            "* pack" : "set_model",
-           "$ xns" : "Gtk",
-           "$ load" : "()\n{\n    //this.insert(citer,iter,0);\n    print(\"getting list\");\n    var tr = GitRepo.list();\n    \n    this.el.clear();\n    \n    // fixme .. sort by last updated ...\n    \n    \n    for(var i =0 ; i < tr.length; i++) {\n\t    var repo = tr.index(i);\n\t    repo.loadBranches();\n\t    \n\t    Gtk.TreeIter iter;\n\t    this.el.append(out iter);\n     \n        \n        //print(JSON.stringify(ret,null,4));\n         //tr[i].getBranches();\n         //tr[i].getStatus();\n         //var hi;\n         //try {\n             //tr[i].debug=1;\n         //     hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );\n//             print(JSON.stringify(hi,null,4));\n        // } catch(e) { print(e);}\n          \n        this.el.set_value(iter, 0, '' +  repo.name) );\n//        this.el.set_value(ret.iter, 1, '' + repo.currentBranch.name   );\n//        this.el.set_value(ret.iter, 2, '' + repo.branches.map(\n//                        function(e) { return e.name; \n//                    }).join(', ') \n //        );\n//        this.el.set_value(iter, 3, '' +  (!hi  ? '??' : hi[0].changed_raw));        \n        this.el.set_value(iter, 4, repo.is_autocommit() );                \n        this.el.set_value(iter, 5, repo.is_autopush() );                        \n        this.el.set_value(ret.iter, 6,  repo.repopath );  \n        // highlight color.\n        var cb = repo.currentBranch;\n        //print(JSON.stringify(cb,null,4));\n        var col = '#ffffff';\n        /*\n        if (cb.lastrev != cb.remoterev) {\n            col =  '#ff0000';\n        }\n        if (tr[i].hasLocalChanges) {\n            col =  '#0000ff';\n        }\n        if  ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {\n            col =  '#ff00ff';\n        }\n        */\n        this.el.set_value(ret.iter, 7, col  );      \n        \n    }     \n}"
+           "| void load" : "()\n{\n    //this.insert(citer,iter,0);\n    print(\"getting list\");\n    var tr = GitRepo.list();\n    \n    this.el.clear();\n    \n    // fixme .. sort by last updated ...\n    \n    \n    for(var i =0 ; i < tr.length; i++) {\n\t    var repo = tr.index(i);\n\t    repo.loadBranches();\n\t    \n\t    Gtk.TreeIter iter;\n\t    this.el.append(out iter);\n     \n        \n        //print(JSON.stringify(ret,null,4));\n         //tr[i].getBranches();\n         //tr[i].getStatus();\n         //var hi;\n         //try {\n             //tr[i].debug=1;\n         //     hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );\n//             print(JSON.stringify(hi,null,4));\n        // } catch(e) { print(e);}\n          \n        this.el.set_value(iter, 0, '' +  repo.name) );\n//        this.el.set_value(ret.iter, 1, '' + repo.currentBranch.name   );\n//        this.el.set_value(ret.iter, 2, '' + repo.branches.map(\n//                        function(e) { return e.name; \n//                    }).join(', ') \n //        );\n//        this.el.set_value(iter, 3, '' +  (!hi  ? '??' : hi[0].changed_raw));        \n        this.el.set_value(iter, 4, repo.is_autocommit() );                \n        this.el.set_value(iter, 5, repo.is_autopush() );                        \n        this.el.set_value(ret.iter, 6,  repo.repopath );  \n        // highlight color.\n        var cb = repo.currentBranch;\n        //print(JSON.stringify(cb,null,4));\n        var col = '#ffffff';\n        /*\n        if (cb.lastrev != cb.remoterev) {\n            col =  '#ff0000';\n        }\n        if (tr[i].hasLocalChanges) {\n            col =  '#0000ff';\n        }\n        if  ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {\n            col =  '#ff00ff';\n        }\n        */\n        this.el.set_value(ret.iter, 7, col  );      \n        \n    }     \n}",
+           "$ xns" : "Gtk"
           },
           {
            "id" : "tv_autocommit",
index 3debbd8..d653e29 100644 (file)
@@ -574,6 +574,64 @@ public class Clones : Object
         }
 
         // user defined functions
+        public void load ()
+        {
+            //this.insert(citer,iter,0);
+            print("getting list");
+            var tr = GitRepo.list();
+            
+            this.el.clear();
+            
+            // fixme .. sort by last updated ...
+            
+            
+            for(var i =0 ; i < tr.length; i++) {
+                   var repo = tr.index(i);
+                   repo.loadBranches();
+                   
+                   Gtk.TreeIter iter;
+                   this.el.append(out iter);
+             
+                
+                //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(iter, 0, '' +  repo.name) );
+        //        this.el.set_value(ret.iter, 1, '' + repo.currentBranch.name   );
+        //        this.el.set_value(ret.iter, 2, '' + repo.branches.map(
+        //                        function(e) { return e.name; 
+        //                    }).join(', ') 
+         //        );
+        //        this.el.set_value(iter, 3, '' +  (!hi  ? '??' : hi[0].changed_raw));        
+                this.el.set_value(iter, 4, repo.is_autocommit() );                
+                this.el.set_value(iter, 5, repo.is_autopush() );                        
+                this.el.set_value(ret.iter, 6,  repo.repopath );  
+                // highlight color.
+                var cb = repo.currentBranch;
+                //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  );      
+                
+            }     
+        }
     }
 
     public class Xcls_tv_autocommit : Object