3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
10 console = imports.console;
11 XObject = imports.XObject.XObject;
15 destroy_event : function (self, event) {
19 response : function (self, id) {
25 if (typeof(this.get('bug').getValue()) != 'object') {
32 //var val = this.get('bug').getValue();
39 title : "Manage Clones",
48 /*[ 'xtype' ].forEach(function(k) {
49 _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
56 this.get('/reposStore').load();
58 //this.get('/ok_button').el.set_sensitive(false);
60 // block until we return.
61 var run_ret = this.el.run();
65 print("RUN RETURN : " + run_ret);
67 //print(JSON.stringify(this.get('bug').getValue()));
68 // return this.get('bug').getValue();
69 //this.success = c.success;
75 pack : function(p,e) {
76 p.el.get_content_area().pack_start(e.el,true,true,0)
81 pack : "pack_start,false,true",
86 clicked : function (self) {
101 clicked : function (self) {
110 label : "Add Branch",
116 clicked : function (self) {
118 var rv = this.get('/reposView');
119 var rs = this.get('/reposStore');
120 if (rv.el.get_selection().count_selected_rows() != 1) {
125 var Merger = imports.Merger.Merger;
129 var s = rv.el.get_selection();
131 s.selected_foreach(function(model,p,iter) {
133 path = model.get_value(iter, 6).value.get_string();
138 rs.repos.forEach(function(r) {
139 if (r.repopath == path) {
146 Merger.el.set_transient_for(Clones.el);
165 label : "Run Merger",
171 clicked : function (self) {
180 label : "Switch Branch",
186 clicked : function (self) {
201 xtype: Gtk.ScrolledWindow,
203 XObject.prototype.init.call(this);
204 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
210 cursor_changed : function (self) {
211 // SEE SELECTION.CHANGED
216 if (this.el.get_selection().count_selected_rows() < 1) {
217 //nothing? - clea it?
221 var model = this.get('/changedFilesStore');
223 var s = this.el.get_selection();
225 s.selected_foreach(function(model,p,iter) {
227 files.push( model.get_value(iter, 0).value.get_string());
230 this.get('/patchview').showDiff(files);
231 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
232 //print("OUT?" + value);// id..
233 // load the list in the right grid..
242 XObject.prototype.init.call(this);
243 var description = new Pango.FontDescription.c_new();
244 description.set_size(10000);
245 this.el.modify_font(description);
247 this.selection = this.el.get_selection();
248 this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);
252 this.selection.signal['changed'].connect(function() {
253 _this.listeners.cursor_changed.apply(
260 xtype: Gtk.ListStore,
264 XObject.prototype.init.call(this);
265 this.el.set_column_types ( 7, [
266 GObject.TYPE_STRING, // repo
267 GObject.TYPE_STRING, // current branch
268 GObject.TYPE_STRING, // all branch
269 GObject.TYPE_STRING, // updated
270 GObject.TYPE_BOOLEAN, // auto-commit
271 GObject.TYPE_BOOLEAN, // auto-push
272 GObject.TYPE_STRING // repopath
277 //this.insert(citer,iter,0);
278 print("getting list");
279 this.repos = imports.Scm.Repo.Repo.list();
283 for(var i =0 ; i < tr.length; i++) {
288 //print(JSON.stringify(ret,null,4));
291 this.el.set_value(ret.iter, 0, '' + tr[i].repopath.split('/').pop() );
292 this.el.set_value(ret.iter, 1, '' + tr[i].currentBranch );
293 this.el.set_value(ret.iter, 2, '' + tr[i].branches.map(
294 function(e) { return e.name;
297 this.el.set_value(ret.iter, 3, '' + 'tbc' );
298 this.el.set_value(ret.iter, 4, tr[i].autocommit() );
299 this.el.set_value(ret.iter, 5, tr[i].autopush() );
300 this.el.set_value(ret.iter, 6, tr[i].repopath );
306 xtype: Gtk.TreeViewColumn,
308 pack : "append_column",
309 title : "Auto Commit",
311 XObject.prototype.init.call(this);
312 this.el.add_attribute(this.items[0].el , 'active', 4 );
313 this.items[0].el.set_activatable(true);
318 xtype: Gtk.CellRendererToggle,
320 toggled : function (self, path) {
322 var store = this.get('/reposStore');
323 store.el.get_iter_from_string(ret, path);
325 var value = store.el.get_value(ret.iter,4).value.get_boolean();
327 //print(JSON.stringify(value));
328 store.el.set_value(ret.iter,4, !value);
333 mode : Gtk.CellRendererMode.ACTIVATABLE
338 xtype: Gtk.TreeViewColumn,
340 pack : "append_column",
343 XObject.prototype.init.call(this);
344 this.el.add_attribute(this.items[0].el , 'active', 5 );
345 this.items[0].el.set_activatable(true);
349 xtype: Gtk.CellRendererToggle,
351 toggled : function (self, path) {
353 var store = this.get('/reposStore');
354 store.el.get_iter_from_string(ret, path);
356 var value = store.el.get_value(ret.iter,5).value.get_boolean();
358 //print(JSON.stringify(value));
359 store.el.set_value(ret.iter,5, !value);
364 mode : Gtk.CellRendererMode.ACTIVATABLE
369 xtype: Gtk.TreeViewColumn,
371 pack : "append_column",
375 XObject.prototype.init.call(this);
376 this.el.add_attribute(this.items[0].el , 'markup', 0 );
381 xtype: Gtk.CellRendererText,
387 xtype: Gtk.TreeViewColumn,
389 pack : "append_column",
390 title : "Current Branch",
392 XObject.prototype.init.call(this);
393 this.el.add_attribute(this.items[0].el , 'markup', 1 );
398 xtype: Gtk.CellRendererText,
404 xtype: Gtk.TreeViewColumn,
406 pack : "append_column",
407 title : "Last updated",
409 XObject.prototype.init.call(this);
410 this.el.add_attribute(this.items[0].el , 'markup', 3 );
415 xtype: Gtk.CellRendererText,
421 xtype: Gtk.TreeViewColumn,
423 pack : "append_column",
425 title : "All Branches",
427 XObject.prototype.init.call(this);
428 this.el.add_attribute(this.items[0].el , 'markup', 2 );
433 xtype: Gtk.CellRendererText,
445 xtype: Gtk.ListStore,
457 pack : "add_action_widget,0"
463 pack : "add_action_widget,1"
468 XObject.cache['/Clones'] = Clones;