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",
85 clicked : function (self) {
87 var rv = this.get('/reposView');
88 var rs = this.get('/reposStore');
89 if (rv.el.get_selection().count_selected_rows() != 1) {
94 var Remotes = imports.Remotes.Remotes;
98 var s = rv.el.get_selection();
100 s.selected_foreach(function(model,p,iter) {
102 path = model.get_value(iter, 6).value.get_string();
107 rs.repos.forEach(function(r) {
108 if (r.repopath == path) {
115 Remotes.el.set_transient_for(Clones.el);
116 Clones.el.set_title("Manage Clones - " + repo.repopath);
118 Clones.el.set_title("Manage Clones");
134 clicked : function (self) {
136 var rv = this.get('/reposView');
137 var rs = this.get('/reposStore');
138 if (rv.el.get_selection().count_selected_rows() != 1) {
143 var Branches = imports.Branches.Branches;
147 var s = rv.el.get_selection();
149 s.selected_foreach(function(model,p,iter) {
151 path = model.get_value(iter, 6).value.get_string();
156 rs.repos.forEach(function(r) {
157 if (r.repopath == path) {
163 Branches.repo = repo;
164 Branches.el.set_transient_for(Clones.el);
165 Clones.el.set_title("Manage Clones - " + repo.repopath);
167 Clones.el.set_title("Manage Clones");
185 clicked : function (self) {
187 var rv = this.get('/reposView');
188 var rs = this.get('/reposStore');
189 if (rv.el.get_selection().count_selected_rows() != 1) {
194 var Merger = imports.Merger.Merger;
198 var s = rv.el.get_selection();
200 s.selected_foreach(function(model,p,iter) {
202 path = model.get_value(iter, 6).value.get_string();
207 rs.repos.forEach(function(r) {
208 if (r.repopath == path) {
215 Merger.el.set_transient_for(Clones.el);
216 Clones.el.set_title("Manage Clones - " + repo.repopath);
218 Clones.el.set_title("Manage Clones");
235 label : "Run Merger",
241 clicked : function (self) {
250 label : "Switch Branch",
256 clicked : function (self) {
271 xtype: Gtk.ScrolledWindow,
273 XObject.prototype.init.call(this);
274 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
280 cursor_changed : function (self) {
281 // SEE SELECTION.CHANGED
286 if (this.el.get_selection().count_selected_rows() < 1) {
287 //nothing? - clea it?
291 var model = this.get('/changedFilesStore');
293 var s = this.el.get_selection();
295 s.selected_foreach(function(model,p,iter) {
297 files.push( model.get_value(iter, 0).value.get_string());
300 this.get('/patchview').showDiff(files);
301 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
302 //print("OUT?" + value);// id..
303 // load the list in the right grid..
312 XObject.prototype.init.call(this);
313 var description = new Pango.FontDescription.c_new();
314 description.set_size(10000);
315 this.el.modify_font(description);
317 this.selection = this.el.get_selection();
318 this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);
322 this.selection.signal['changed'].connect(function() {
323 _this.listeners.cursor_changed.apply(
329 this.el.set_tooltip_column(8);
335 xtype: Gtk.ListStore,
339 XObject.prototype.init.call(this);
340 this.el.set_column_types ( 9, [
341 GObject.TYPE_STRING, // repo
342 GObject.TYPE_STRING, // current branch
343 GObject.TYPE_STRING, // all branch
344 GObject.TYPE_STRING, // updated
345 GObject.TYPE_BOOLEAN, // auto-commit
346 GObject.TYPE_BOOLEAN, // auto-push
347 GObject.TYPE_STRING, // repopath
348 GObject.TYPE_STRING, // color highighling
349 GObject.TYPE_STRING // uncommited. (tip)
354 //this.insert(citer,iter,0);
355 print("getting list");
356 this.repos = imports.Scm.Repo.Repo.list();
360 for(var i =0 ; i < tr.length; i++) {
365 //print(JSON.stringify(ret,null,4));
371 hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
372 // print(JSON.stringify(hi,null,4));
373 } catch(e) { print(e);}
375 this.el.set_value(ret.iter, 0, '' + tr[i].repopath.split('/').pop() );
376 this.el.set_value(ret.iter, 1, '' + tr[i].currentBranch.name );
377 this.el.set_value(ret.iter, 2, '' + tr[i].branches.map(
378 function(e) { return e.name;
381 this.el.set_value(ret.iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
382 this.el.set_value(ret.iter, 4, tr[i].autocommit() );
383 this.el.set_value(ret.iter, 5, tr[i].autopush() );
384 this.el.set_value(ret.iter, 6, tr[i].repopath );
386 var cb = tr[i].currentBranch;
387 //print(JSON.stringify(cb,null,4));
389 if (cb.lastrev != cb.remoterev) {
392 if (tr[i].hasLocalChanges) {
395 if ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
399 this.el.set_value(ret.iter, 7, col );
400 this.el.set_value(ret.iter, 8, tr[i].localChanges );
406 xtype: Gtk.TreeViewColumn,
408 pack : "append_column",
409 title : "Auto Commit",
411 XObject.prototype.init.call(this);
412 this.el.add_attribute(this.items[0].el , 'active', 4 );
413 this.items[0].el.set_activatable(true);
418 xtype: Gtk.CellRendererToggle,
420 toggled : function (self, path) {
422 var store = this.get('/reposStore');
423 store.el.get_iter_from_string(ret, path);
425 var value = store.el.get_value(ret.iter,4).value.get_boolean();
427 //print(JSON.stringify(value));
428 store.el.set_value(ret.iter,4, !value);
433 mode : Gtk.CellRendererMode.ACTIVATABLE
438 xtype: Gtk.TreeViewColumn,
440 pack : "append_column",
443 XObject.prototype.init.call(this);
444 this.el.add_attribute(this.items[0].el , 'active', 5 );
445 this.items[0].el.set_activatable(true);
449 xtype: Gtk.CellRendererToggle,
451 toggled : function (self, path) {
453 var store = this.get('/reposStore');
454 store.el.get_iter_from_string(ret, path);
456 var value = store.el.get_value(ret.iter,5).value.get_boolean();
458 //print(JSON.stringify(value));
459 store.el.set_value(ret.iter,5, !value);
464 mode : Gtk.CellRendererMode.ACTIVATABLE
469 xtype: Gtk.TreeViewColumn,
472 pack : "append_column",
475 XObject.prototype.init.call(this);
476 this.el.add_attribute(this.items[0].el , 'markup', 0 );
481 xtype: Gtk.CellRendererText,
487 xtype: Gtk.TreeViewColumn,
489 pack : "append_column",
490 title : "Current Branch",
492 XObject.prototype.init.call(this);
493 this.el.add_attribute(this.items[0].el , 'markup', 1 );
494 this.el.add_attribute(this.items[0].el , 'cell-background', 7 );
499 xtype: Gtk.CellRendererText,
505 xtype: Gtk.TreeViewColumn,
507 pack : "append_column",
508 title : "Last updated",
510 XObject.prototype.init.call(this);
511 this.el.add_attribute(this.items[0].el , 'markup', 3 );
516 xtype: Gtk.CellRendererText,
522 xtype: Gtk.TreeViewColumn,
524 pack : "append_column",
526 title : "All Branches",
528 XObject.prototype.init.call(this);
529 this.el.add_attribute(this.items[0].el , 'markup', 2 );
534 xtype: Gtk.CellRendererText,
546 xtype: Gtk.ListStore,
559 pack : "add_action_widget,1"
564 XObject.cache['/Clones'] = Clones;