Clones.bjs
authorAlan Knowles <alan@akbkhome.com>
Sat, 9 Jun 2012 15:43:46 +0000 (23:43 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sat, 9 Jun 2012 15:43:46 +0000 (23:43 +0800)
Clones.js

Clones.bjs
Clones.js

index 645a3c7..27a874e 100644 (file)
                                 {
                                     "listeners": {
                                         "clicked": "function (self) {\n\n    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Remotes =     imports.Remotes.Remotes;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Remotes.repo = repo;\n    Remotes.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Remotes.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n     \n    \n    \n    \n\n       \n    \n    \n}"
-                                    },
-                                    "label": "Remotes / Clones",
-                                    "pack": "add",
-                                    "xtype": "Button",
-                                    "|xns": "Gtk"
+                                    }
                                 },
                                 {
                                     "listeners": {
                                     "id": "reposView",
                                     "pack": "add",
                                     "xtype": "TreeView",
-                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n        var description = new Pango.FontDescription.c_new();\n   description.set_size(10000);\n     this.el.modify_font(description);\n\n     this.selection = this.el.get_selection();\n      this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);\n    var _this = this;\n    \n    \n  this.selection.signal['changed'].connect(function() {\n     _this.listeners.cursor_changed.apply(\n          _this, [ _this, '']\n       );\n             });\n  }\n",
+                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n        var description = new Pango.FontDescription.c_new();\n   description.set_size(10000);\n     this.el.modify_font(description);\n\n     this.selection = this.el.get_selection();\n      this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);\n    var _this = this;\n    \n    \n  this.selection.signal['changed'].connect(function() {\n     _this.listeners.cursor_changed.apply(\n          _this, [ _this, '']\n       );\n             });\n          \n          \n          this.el.set_tooltip_column(8); \n             \n            \n  }\n",
                                     "|xns": "Gtk",
                                     "items": [
                                         {
                                             "id": "reposStore",
                                             "pack": "set_model",
                                             "xtype": "ListStore",
-                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 8, [\n       GObject.TYPE_STRING, // repo  \n      GObject.TYPE_STRING, // current branch\n      GObject.TYPE_STRING, // all branch      \n      GObject.TYPE_STRING, // updated\n       GObject.TYPE_BOOLEAN, // auto-commit\n        GObject.TYPE_BOOLEAN, // auto-push\n           GObject.TYPE_STRING, // repopath\n           GObject.TYPE_STRING // color highighling \n  ] );\n}\n",
-                                            "|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}",
+                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 9, [\n       GObject.TYPE_STRING, // repo  \n      GObject.TYPE_STRING, // current branch\n      GObject.TYPE_STRING, // all branch      \n      GObject.TYPE_STRING, // updated\n       GObject.TYPE_BOOLEAN, // auto-commit\n        GObject.TYPE_BOOLEAN, // auto-push\n           GObject.TYPE_STRING, // repopath\n           GObject.TYPE_STRING, // color highighling \n           GObject.TYPE_STRING // uncommited. (tip) \n  ] );\n}\n",
+                                            "|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        this.el.set_value(ret.iter, 8, tr[i].localChanges  );      \n        \n    }     \n}",
                                             "|xns": "Gtk"
                                         },
                                         {
                                             ]
                                         },
                                         {
+                                            "resizable": true,
                                             "min_width": 200,
                                             "pack": "append_column",
-                                            "resizable": true,
                                             "title": "Repo",
                                             "xtype": "TreeViewColumn",
                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 0 );\n\n}\n",
index 6f64404..5ce9053 100644 (file)
--- a/Clones.js
+++ b/Clones.js
@@ -81,7 +81,6 @@ Clones=new XObject({
                     pack : "pack_start,false,true",
                     items : [
                         {
-                            xtype: Gtk.Button,
                             listeners : {
                                 clicked : function (self) {
                                 
@@ -127,9 +126,7 @@ Clones=new XObject({
                                     
                                     
                                 }
-                            },
-                            label : "Remotes / Clones",
-                            pack : "add"
+                            }
                         },
                         {
                             xtype: Gtk.Button,
@@ -327,6 +324,11 @@ Clones=new XObject({
                                       _this, [ _this, '']
                                    );
                                          });
+                                      
+                                      
+                                      this.el.set_tooltip_column(8); 
+                                         
+                                        
                               },
                             items : [
                                 {
@@ -335,7 +337,7 @@ Clones=new XObject({
                                     pack : "set_model",
                                     init : function() {
                                         XObject.prototype.init.call(this);
-                                        this.el.set_column_types ( 8, [
+                                        this.el.set_column_types ( 9, [
                                            GObject.TYPE_STRING, // repo  
                                           GObject.TYPE_STRING, // current branch
                                           GObject.TYPE_STRING, // all branch      
@@ -343,7 +345,8 @@ Clones=new XObject({
                                            GObject.TYPE_BOOLEAN, // auto-commit
                                             GObject.TYPE_BOOLEAN, // auto-push
                                                GObject.TYPE_STRING, // repopath
-                                               GObject.TYPE_STRING // color highighling 
+                                               GObject.TYPE_STRING, // color highighling 
+                                               GObject.TYPE_STRING // uncommited. (tip) 
                                       ] );
                                     },
                                     load : function()
@@ -393,7 +396,8 @@ Clones=new XObject({
                                                 col =  '#ff00ff';
                                             }
                                             
-                                            this.el.set_value(ret.iter, 7, col  );      
+                                            this.el.set_value(ret.iter, 7, col  );
+                                            this.el.set_value(ret.iter, 8, tr[i].localChanges  );      
                                             
                                         }     
                                     }
@@ -463,9 +467,9 @@ Clones=new XObject({
                                 },
                                 {
                                     xtype: Gtk.TreeViewColumn,
+                                    resizable : true,
                                     min_width : 200,
                                     pack : "append_column",
-                                    resizable : true,
                                     title : "Repo",
                                     init : function() {
                                         XObject.prototype.init.call(this);