Clones.bjs
[gitlive] / Clones.bjs
1 {
2     "id": "file-gtk-3",
3     "name": "Clones",
4     "parent": "",
5     "title": false,
6     "path": "/home/alan/gitlive/gitlive/Clones.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "destroy_event": "function (self, event) {\n     this.el.hide();\n                return false;\n}",
11                 "response": "function (self, id) {\n  // hide\n     //if (id < 1) {\n        this.el.hide();\n        return;\n    //}\n    if (typeof(this.get('bug').getValue()) != 'object') {\n        print(\"ERROR\");\n        return;\n    }\n \n    this.el.hide();\n        \n    //var val = this.get('bug').getValue();\n     //   Seed.print(val);\n}"
12             },
13             "border_width": 3,
14             "default_height": 500,
15             "default_width": 600,
16             "title": "Manage Clones",
17             "xtype": "Dialog",
18             "|deletable": true,
19             "|modal": true,
20             "|show": "function(c) {\n    \n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    /*[ 'xtype'  ].forEach(function(k) {\n        _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);\n    });\n\t// shouild set path..\n    */\n \n    this.el.show_all();\n    // load clones..\n        this.get('/reposStore').load();\n    \n    //this.get('/ok_button').el.set_sensitive(false);\n    \n    // block until we return.\n    var run_ret = this.el.run();\n    if (run_ret < 1 ) {\n        return  \"DONE\";\n    }\n    print(\"RUN RETURN : \" + run_ret);\n    return \"DONE\";\n    //print(JSON.stringify(this.get('bug').getValue()));\n   // return this.get('bug').getValue();\n    //this.success = c.success;\n}\n",
21             "|xns": "Gtk",
22             "items": [
23                 {
24                     "xtype": "VBox",
25                     "|pack": " function(p,e) {\n        p.el.get_content_area().pack_start(e.el,true,true,0)\n    }\n",
26                     "|xns": "Gtk",
27                     "items": [
28                         {
29                             "pack": "pack_start,false,true",
30                             "xtype": "HBox",
31                             "|xns": "Gtk",
32                             "items": [
33                                 {
34                                     "listeners": {
35                                         "clicked": "function (self) {\n    \n    \n \n       \n    \n    \n}"
36                                     },
37                                     "label": "Add Clone",
38                                     "pack": "add",
39                                     "xtype": "Button",
40                                     "|xns": "Gtk"
41                                 },
42                                 {
43                                     "listeners": {
44                                         "clicked": "function (self) {\n    \n    \n \n       \n    \n    \n}"
45                                     },
46                                     "label": "Add Branch",
47                                     "pack": "add",
48                                     "xtype": "Button",
49                                     "|xns": "Gtk"
50                                 },
51                                 {
52                                     "listeners": {
53                                         "clicked": "function (self) {\n\n    var rv = this.get('/reposView');\n    \n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Merger =     imports.Merger.Merger;\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\n    rv.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            Merger.repo = r;\n            Merger.show();\n        \n        }\n    \n    });\n    \n    \n\n    \n\n    \n    \n    \n    \n\n       \n    \n    \n}"
54                                     },
55                                     "label": "Run Merger",
56                                     "pack": "add",
57                                     "xtype": "Button",
58                                     "|xns": "Gtk"
59                                 },
60                                 {
61                                     "listeners": {
62                                         "clicked": "function (self) {\n    \n    \n \n       \n    \n    \n}"
63                                     },
64                                     "label": "Switch Branch",
65                                     "pack": "add",
66                                     "xtype": "Button",
67                                     "|xns": "Gtk"
68                                 },
69                                 {
70                                     "listeners": {
71                                         "clicked": "function (self) {\n    \n    \n \n       \n    \n    \n}"
72                                     },
73                                     "label": "Pull",
74                                     "pack": "add",
75                                     "xtype": "Button",
76                                     "|xns": "Gtk"
77                                 }
78                             ]
79                         },
80                         {
81                             "xtype": "ScrolledWindow",
82                             "|init": "function() {\n    XObject.prototype.init.call(this);\n      this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
83                             "|xns": "Gtk",
84                             "items": [
85                                 {
86                                     "listeners": {
87                                         "cursor_changed": "function (self) {\n  // SEE SELECTION.CHANGED\n  \n  \n  return;\n  \n    if (this.el.get_selection().count_selected_rows() < 1) {\n        //nothing? - clea it?\n        return;\n    }\n        var ret = {};         \n    var model = this.get('/changedFilesStore');\n\n     var s = this.el.get_selection();\n     var files = [];\n    s.selected_foreach(function(model,p,iter) {\n    \n       files.push( model.get_value(iter, 0).value.get_string());\n     \n    });\n    this.get('/patchview').showDiff(files); \n    //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();\n     //print(\"OUT?\" + value);// id..\n    // load the list in the right grid..\n     \n    return true;\n\n}"
88                                     },
89                                     "id": "reposView",
90                                     "pack": "add",
91                                     "xtype": "TreeView",
92                                     "|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",
93                                     "|xns": "Gtk",
94                                     "items": [
95                                         {
96                                             "id": "reposStore",
97                                             "pack": "set_model",
98                                             "xtype": "ListStore",
99                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 7, [\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  ] );\n}\n",
100                                             "|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          \n        this.el.set_value(ret.iter, 0, '' +  tr[i].repopath.split('/').pop() );\n        this.el.set_value(ret.iter, 1, '' + tr[i].currentBranch   );\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, '' + 'tbc' );        \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        \n    }     \n}",
101                                             "|xns": "Gtk"
102                                         },
103                                         {
104                                             "min_width": 50,
105                                             "pack": "append_column",
106                                             "title": "Auto Commit",
107                                             "xtype": "TreeViewColumn",
108                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'active', 4 );\n    this.items[0].el.set_activatable(true);\n\n}\n",
109                                             "|xns": "Gtk",
110                                             "items": [
111                                                 {
112                                                     "listeners": {
113                                                         "toggled": "function (self, path) {\n    var ret ={} ;\n    var store = this.get('/reposStore');\n    store.el.get_iter_from_string(ret, path);\n                                                                 \n    var value =   store.el.get_value(ret.iter,4).value.get_boolean();\n                                                                 \n    //print(JSON.stringify(value));\n    store.el.set_value(ret.iter,4, !value);\n    \n}"
114                                                     },
115                                                     "pack": "pack_start",
116                                                     "xtype": "CellRendererToggle",
117                                                     "|mode": "Gtk.CellRendererMode.ACTIVATABLE",
118                                                     "|xns": "Gtk"
119                                                 }
120                                             ]
121                                         },
122                                         {
123                                             "min_width": 50,
124                                             "pack": "append_column",
125                                             "title": "Auto Push",
126                                             "xtype": "TreeViewColumn",
127                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'active', 5 );\n      this.items[0].el.set_activatable(true);\n}\n",
128                                             "|xns": "Gtk",
129                                             "items": [
130                                                 {
131                                                     "listeners": {
132                                                         "toggled": "function (self, path) {\n    var ret ={} ;\n    var store = this.get('/reposStore');\n    store.el.get_iter_from_string(ret, path);\n                                                                 \n    var value =   store.el.get_value(ret.iter,5).value.get_boolean();\n                                                                 \n    //print(JSON.stringify(value));\n    store.el.set_value(ret.iter,5, !value);\n    \n}"
133                                                     },
134                                                     "pack": "pack_start",
135                                                     "xtype": "CellRendererToggle",
136                                                     "|mode": "Gtk.CellRendererMode.ACTIVATABLE",
137                                                     "|xns": "Gtk"
138                                                 }
139                                             ]
140                                         },
141                                         {
142                                             "min_width": 200,
143                                             "pack": "append_column",
144                                             "resizable": true,
145                                             "title": "Repo",
146                                             "xtype": "TreeViewColumn",
147                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 0 );\n\n}\n",
148                                             "|xns": "Gtk",
149                                             "items": [
150                                                 {
151                                                     "pack": "pack_start",
152                                                     "xtype": "CellRendererText",
153                                                     "|xns": "Gtk"
154                                                 }
155                                             ]
156                                         },
157                                         {
158                                             "min_width": 50,
159                                             "pack": "append_column",
160                                             "title": "Current Branch",
161                                             "xtype": "TreeViewColumn",
162                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 1 );\n\n}\n",
163                                             "|xns": "Gtk",
164                                             "items": [
165                                                 {
166                                                     "pack": "pack_start",
167                                                     "xtype": "CellRendererText",
168                                                     "|xns": "Gtk"
169                                                 }
170                                             ]
171                                         },
172                                         {
173                                             "min_width": 50,
174                                             "pack": "append_column",
175                                             "title": "Last updated",
176                                             "xtype": "TreeViewColumn",
177                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 3 );\n\n}\n",
178                                             "|xns": "Gtk",
179                                             "items": [
180                                                 {
181                                                     "pack": "pack_start",
182                                                     "xtype": "CellRendererText",
183                                                     "|xns": "Gtk"
184                                                 }
185                                             ]
186                                         },
187                                         {
188                                             "min_width": 50,
189                                             "pack": "append_column",
190                                             "resizable": false,
191                                             "title": "All Branches",
192                                             "xtype": "TreeViewColumn",
193                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 2 );\n\n}\n",
194                                             "|xns": "Gtk",
195                                             "items": [
196                                                 {
197                                                     "pack": "pack_start",
198                                                     "xtype": "CellRendererText",
199                                                     "|xns": "Gtk"
200                                                 }
201                                             ]
202                                         }
203                                     ]
204                                 },
205                                 {
206                                     "|xns": "Gtk",
207                                     "xtype": "TreeView",
208                                     "pack": false,
209                                     "items": [
210                                         {
211                                             "|xns": "Gtk",
212                                             "xtype": "ListStore",
213                                             "pack": false
214                                         }
215                                     ]
216                                 }
217                             ]
218                         }
219                     ]
220                 },
221                 {
222                     "label": "Cancel",
223                     "pack": "add_action_widget,0",
224                     "xtype": "Button",
225                     "|xns": "Gtk",
226                     "listeners": {}
227                 },
228                 {
229                     "id": "ok_button",
230                     "label": "OK",
231                     "pack": "add_action_widget,1",
232                     "xtype": "Button",
233                     "|xns": "Gtk"
234                 }
235             ]
236         }
237     ],
238     "permname": "",
239     "modOrder": "0"
240 }