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]);
53 this.el.set_deletable(false);
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) {
88 var rv = this.get('/reposView');
89 var rs = this.get('/reposStore');
90 if (rv.el.get_selection().count_selected_rows() != 1) {
95 var Remotes = imports.Remotes.Remotes;
99 var s = rv.el.get_selection();
101 s.selected_foreach(function(model,p,iter) {
103 path = model.get_value(iter, 6).value.get_string();
108 rs.repos.forEach(function(r) {
109 if (r.repopath == path) {
116 Remotes.el.set_transient_for(Clones.el);
117 Clones.el.set_title("Manage Clones - " + repo.repopath);
119 Clones.el.set_title("Manage Clones");
131 label : "Remotes / Clones",
137 clicked : function (self) {
139 var rv = this.get('/reposView');
140 var rs = this.get('/reposStore');
141 if (rv.el.get_selection().count_selected_rows() != 1) {
146 var Branches = imports.Branches.Branches;
150 var s = rv.el.get_selection();
152 s.selected_foreach(function(model,p,iter) {
154 path = model.get_value(iter, 6).value.get_string();
159 rs.repos.forEach(function(r) {
160 if (r.repopath == path) {
166 Branches.repo = repo;
167 Branches.el.set_transient_for(Clones.el);
168 Clones.el.set_title("Manage Clones - " + repo.repopath);
170 Clones.el.set_title("Manage Clones");
188 clicked : function (self) {
190 var rv = this.get('/reposView');
191 var rs = this.get('/reposStore');
192 if (rv.el.get_selection().count_selected_rows() != 1) {
197 var Merger = imports.Merger.Merger;
201 var s = rv.el.get_selection();
203 s.selected_foreach(function(model,p,iter) {
205 path = model.get_value(iter, 6).value.get_string();
210 rs.repos.forEach(function(r) {
211 if (r.repopath == path) {
218 Merger.el.set_transient_for(Clones.el);
219 Clones.el.set_title("Manage Clones - " + repo.repopath);
221 Clones.el.set_title("Manage Clones");
238 label : "Run Merger",
244 clicked : function (self) {
253 label : "Switch Branch",
259 clicked : function (self) {
274 xtype: Gtk.ScrolledWindow,
276 XObject.prototype.init.call(this);
277 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
283 cursor_changed : function (self) {
284 // SEE SELECTION.CHANGED
289 if (this.el.get_selection().count_selected_rows() < 1) {
290 //nothing? - clea it?
294 var model = this.get('/changedFilesStore');
296 var s = this.el.get_selection();
298 s.selected_foreach(function(model,p,iter) {
300 files.push( model.get_value(iter, 0).value.get_string());
303 this.get('/patchview').showDiff(files);
304 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
305 //print("OUT?" + value);// id..
306 // load the list in the right grid..
315 XObject.prototype.init.call(this);
316 var description = new Pango.FontDescription.c_new();
317 description.set_size(10000);
318 this.el.modify_font(description);
320 this.selection = this.el.get_selection();
321 this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);
325 this.selection.signal['changed'].connect(function() {
326 _this.listeners.cursor_changed.apply(
332 this.el.set_tooltip_column(8);
338 xtype: Gtk.ListStore,
342 XObject.prototype.init.call(this);
343 this.el.set_column_types ( 9, [
344 GObject.TYPE_STRING, // repo
345 GObject.TYPE_STRING, // current branch
346 GObject.TYPE_STRING, // all branch
347 GObject.TYPE_STRING, // updated
348 GObject.TYPE_BOOLEAN, // auto-commit
349 GObject.TYPE_BOOLEAN, // auto-push
350 GObject.TYPE_STRING, // repopath
351 GObject.TYPE_STRING, // color highighling
352 GObject.TYPE_STRING // uncommited. (tip)
357 //this.insert(citer,iter,0);
358 print("getting list");
359 this.repos = imports.Scm.Repo.Repo.list();
363 for(var i =0 ; i < tr.length; i++) {
368 //print(JSON.stringify(ret,null,4));
374 hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
375 // print(JSON.stringify(hi,null,4));
376 } catch(e) { print(e);}
378 this.el.set_value(ret.iter, 0, '' + tr[i].repopath.split('/').pop() );
379 this.el.set_value(ret.iter, 1, '' + tr[i].currentBranch.name );
380 this.el.set_value(ret.iter, 2, '' + tr[i].branches.map(
381 function(e) { return e.name;
384 this.el.set_value(ret.iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
385 this.el.set_value(ret.iter, 4, tr[i].autocommit() );
386 this.el.set_value(ret.iter, 5, tr[i].autopush() );
387 this.el.set_value(ret.iter, 6, tr[i].repopath );
389 var cb = tr[i].currentBranch;
390 //print(JSON.stringify(cb,null,4));
392 if (cb.lastrev != cb.remoterev) {
395 if (tr[i].hasLocalChanges) {
398 if ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
402 this.el.set_value(ret.iter, 7, col );
403 this.el.set_value(ret.iter, 8, tr[i].localChanges );
409 xtype: Gtk.TreeViewColumn,
411 pack : "append_column",
412 title : "Auto Commit",
414 XObject.prototype.init.call(this);
415 this.el.add_attribute(this.items[0].el , 'active', 4 );
416 this.items[0].el.set_activatable(true);
421 xtype: Gtk.CellRendererToggle,
423 toggled : function (self, path) {
425 var store = this.get('/reposStore');
426 store.el.get_iter_from_string(ret, path);
428 var value = store.el.get_value(ret.iter,4).value.get_boolean();
430 //print(JSON.stringify(value));
431 store.el.set_value(ret.iter,4, !value);
436 mode : Gtk.CellRendererMode.ACTIVATABLE
441 xtype: Gtk.TreeViewColumn,
443 pack : "append_column",
446 XObject.prototype.init.call(this);
447 this.el.add_attribute(this.items[0].el , 'active', 5 );
448 this.items[0].el.set_activatable(true);
452 xtype: Gtk.CellRendererToggle,
454 toggled : function (self, path) {
456 var store = this.get('/reposStore');
457 store.el.get_iter_from_string(ret, path);
459 var value = store.el.get_value(ret.iter,5).value.get_boolean();
461 //print(JSON.stringify(value));
462 store.el.set_value(ret.iter,5, !value);
467 mode : Gtk.CellRendererMode.ACTIVATABLE
472 xtype: Gtk.TreeViewColumn,
475 pack : "append_column",
478 XObject.prototype.init.call(this);
479 this.el.add_attribute(this.items[0].el , 'markup', 0 );
484 xtype: Gtk.CellRendererText,
490 xtype: Gtk.TreeViewColumn,
492 pack : "append_column",
493 title : "Current Branch",
495 XObject.prototype.init.call(this);
496 this.el.add_attribute(this.items[0].el , 'markup', 1 );
497 this.el.add_attribute(this.items[0].el , 'cell-background', 7 );
502 xtype: Gtk.CellRendererText,
508 xtype: Gtk.TreeViewColumn,
510 pack : "append_column",
511 title : "Last updated",
513 XObject.prototype.init.call(this);
514 this.el.add_attribute(this.items[0].el , 'markup', 3 );
519 xtype: Gtk.CellRendererText,
525 xtype: Gtk.TreeViewColumn,
527 pack : "append_column",
529 title : "All Branches",
531 XObject.prototype.init.call(this);
532 this.el.add_attribute(this.items[0].el , 'markup', 2 );
537 xtype: Gtk.CellRendererText,
549 xtype: Gtk.ListStore,
562 pack : "add_action_widget,1"
567 XObject.cache['/Clones'] = Clones;