From 1b516e4c5d14956ab5ba743b361a36a746ffc8c3 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 30 Oct 2018 13:01:15 +0800 Subject: [PATCH] Clones.bjs Clones.vala --- Clones.bjs | 1 + Clones.vala | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Clones.bjs b/Clones.bjs index 84cf9d91..ce8b7aaa 100644 --- a/Clones.bjs +++ b/Clones.bjs @@ -109,6 +109,7 @@ "$ load" : "function()\n{\n //this.insert(citer,iter,0);\n print(\"getting list\");\n this.repos = imports.Scm.Repo.Repo.list();\n var tr= this.repos;\n this.el.clear();\n \n for(var i =0 ; i < tr.length; i++) {\n var ret = { };\n \n this.el.append(ret);\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(ret.iter, 0, '' + tr[i].repopath.split('/').pop() );\n this.el.set_value(ret.iter, 1, '' + tr[i].currentBranch.name );\n this.el.set_value(ret.iter, 2, '' + tr[i].branches.map(\n function(e) { return e.name; \n }).join(', ') \n );\n this.el.set_value(ret.iter, 3, '' + (!hi ? '??' : hi[0].changed_raw)); \n this.el.set_value(ret.iter, 4, tr[i].autocommit() ); \n this.el.set_value(ret.iter, 5, tr[i].autopush() ); \n this.el.set_value(ret.iter, 6, tr[i].repopath ); \n // highlight color.\n var cb = tr[i].currentBranch;\n //print(JSON.stringify(cb,null,4));\n var col = '#ffffff';\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}" }, { + "id" : "tv_autocommit", "* init" : "\n// this.items[0].el.set_activatable(true);\n this.el.add_attribute(_this.keyrender.el , \"active\", 4 );\n\n", "* pack" : "append_column", "title" : "Auto Commit", diff --git a/Clones.vala b/Clones.vala index 9a9d031d..d619b71b 100644 --- a/Clones.vala +++ b/Clones.vala @@ -15,6 +15,7 @@ public class Clones : Object public Xcls_Clones Clones; public Xcls_reposView reposView; public Xcls_reposStore reposStore; + public Xcls_tv_autocommit tv_autocommit; public Xcls_ok_button ok_button; // my vars (def) @@ -469,7 +470,7 @@ public class Clones : Object var child_0 = new Xcls_reposStore( _this ); child_0.ref(); this.el.set_model ( child_0.el ); - var child_1 = new Xcls_TreeViewColumn12( _this ); + var child_1 = new Xcls_tv_autocommit( _this ); child_1.ref(); this.el.append_column ( child_1.el ); var child_2 = new Xcls_TreeViewColumn14( _this ); @@ -563,7 +564,7 @@ public class Clones : Object // user defined functions } - public class Xcls_TreeViewColumn12 : Object + public class Xcls_tv_autocommit : Object { public Gtk.TreeViewColumn el; private Clones _this; @@ -572,9 +573,10 @@ public class Clones : Object // my vars (def) // ctor - public Xcls_TreeViewColumn12(Clones _owner ) + public Xcls_tv_autocommit(Clones _owner ) { _this = _owner; + _this.tv_autocommit = this; this.el = new Gtk.TreeViewColumn(); // my vars (dec) -- 2.39.2