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;
74 pack : function(p,e) {
75 p.el.get_content_area().pack_start(e.el,true,true,0)
80 pack : "pack_start,false,true",
85 clicked : function (self) {
100 clicked : function (self) {
109 label : "Add Branch",
115 clicked : function (self) {
117 var rv = this.get('/reposView');
118 var rs = this.get('/reposStore');
119 if (rv.el.get_selection().count_selected_rows() != 1) {
124 var Merger = imports.Merger.Merger;
128 var s = rv.el.get_selection();
130 s.selected_foreach(function(model,p,iter) {
132 path = model.get_value(iter, 6).value.get_string();
137 rs.repos.forEach(function(r) {
138 if (r.repopath == path) {
160 label : "Run Merger",
166 clicked : function (self) {
175 label : "Switch Branch",
181 clicked : function (self) {
196 xtype: Gtk.ScrolledWindow,
198 XObject.prototype.init.call(this);
199 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
205 cursor_changed : function (self) {
206 // SEE SELECTION.CHANGED
211 if (this.el.get_selection().count_selected_rows() < 1) {
212 //nothing? - clea it?
216 var model = this.get('/changedFilesStore');
218 var s = this.el.get_selection();
220 s.selected_foreach(function(model,p,iter) {
222 files.push( model.get_value(iter, 0).value.get_string());
225 this.get('/patchview').showDiff(files);
226 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
227 //print("OUT?" + value);// id..
228 // load the list in the right grid..
237 XObject.prototype.init.call(this);
238 var description = new Pango.FontDescription.c_new();
239 description.set_size(10000);
240 this.el.modify_font(description);
242 this.selection = this.el.get_selection();
243 this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);
247 this.selection.signal['changed'].connect(function() {
248 _this.listeners.cursor_changed.apply(
255 xtype: Gtk.ListStore,
259 XObject.prototype.init.call(this);
260 this.el.set_column_types ( 7, [
261 GObject.TYPE_STRING, // repo
262 GObject.TYPE_STRING, // current branch
263 GObject.TYPE_STRING, // all branch
264 GObject.TYPE_STRING, // updated
265 GObject.TYPE_BOOLEAN, // auto-commit
266 GObject.TYPE_BOOLEAN, // auto-push
267 GObject.TYPE_STRING // repopath
272 //this.insert(citer,iter,0);
273 print("getting list");
274 this.repos = imports.Scm.Repo.Repo.list();
278 for(var i =0 ; i < tr.length; i++) {
283 //print(JSON.stringify(ret,null,4));
286 this.el.set_value(ret.iter, 0, '' + tr[i].repopath.split('/').pop() );
287 this.el.set_value(ret.iter, 1, '' + tr[i].currentBranch );
288 this.el.set_value(ret.iter, 2, '' + tr[i].branches.map(
289 function(e) { return e.name;
292 this.el.set_value(ret.iter, 3, '' + 'tbc' );
293 this.el.set_value(ret.iter, 4, tr[i].autocommit() );
294 this.el.set_value(ret.iter, 5, tr[i].autopush() );
295 this.el.set_value(ret.iter, 6, tr[i].repopath );
301 xtype: Gtk.TreeViewColumn,
303 pack : "append_column",
304 title : "Auto Commit",
306 XObject.prototype.init.call(this);
307 this.el.add_attribute(this.items[0].el , 'active', 4 );
308 this.items[0].el.set_activatable(true);
313 xtype: Gtk.CellRendererToggle,
315 toggled : function (self, path) {
317 var store = this.get('/reposStore');
318 store.el.get_iter_from_string(ret, path);
320 var value = store.el.get_value(ret.iter,4).value.get_boolean();
322 //print(JSON.stringify(value));
323 store.el.set_value(ret.iter,4, !value);
328 mode : Gtk.CellRendererMode.ACTIVATABLE
333 xtype: Gtk.TreeViewColumn,
335 pack : "append_column",
338 XObject.prototype.init.call(this);
339 this.el.add_attribute(this.items[0].el , 'active', 5 );
340 this.items[0].el.set_activatable(true);
344 xtype: Gtk.CellRendererToggle,
346 toggled : function (self, path) {
348 var store = this.get('/reposStore');
349 store.el.get_iter_from_string(ret, path);
351 var value = store.el.get_value(ret.iter,5).value.get_boolean();
353 //print(JSON.stringify(value));
354 store.el.set_value(ret.iter,5, !value);
359 mode : Gtk.CellRendererMode.ACTIVATABLE
364 xtype: Gtk.TreeViewColumn,
366 pack : "append_column",
370 XObject.prototype.init.call(this);
371 this.el.add_attribute(this.items[0].el , 'markup', 0 );
376 xtype: Gtk.CellRendererText,
382 xtype: Gtk.TreeViewColumn,
384 pack : "append_column",
385 title : "Current Branch",
387 XObject.prototype.init.call(this);
388 this.el.add_attribute(this.items[0].el , 'markup', 1 );
393 xtype: Gtk.CellRendererText,
399 xtype: Gtk.TreeViewColumn,
401 pack : "append_column",
402 title : "Last updated",
404 XObject.prototype.init.call(this);
405 this.el.add_attribute(this.items[0].el , 'markup', 3 );
410 xtype: Gtk.CellRendererText,
416 xtype: Gtk.TreeViewColumn,
418 pack : "append_column",
420 title : "All Branches",
422 XObject.prototype.init.call(this);
423 this.el.add_attribute(this.items[0].el , 'markup', 2 );
428 xtype: Gtk.CellRendererText,
440 xtype: Gtk.ListStore,
452 pack : "add_action_widget,0"
458 pack : "add_action_widget,1"
463 XObject.cache['/Clones'] = Clones;