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) {
161 label : "Run Merger",
167 clicked : function (self) {
176 label : "Switch Branch",
182 clicked : function (self) {
197 xtype: Gtk.ScrolledWindow,
199 XObject.prototype.init.call(this);
200 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
206 cursor_changed : function (self) {
207 // SEE SELECTION.CHANGED
212 if (this.el.get_selection().count_selected_rows() < 1) {
213 //nothing? - clea it?
217 var model = this.get('/changedFilesStore');
219 var s = this.el.get_selection();
221 s.selected_foreach(function(model,p,iter) {
223 files.push( model.get_value(iter, 0).value.get_string());
226 this.get('/patchview').showDiff(files);
227 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
228 //print("OUT?" + value);// id..
229 // load the list in the right grid..
238 XObject.prototype.init.call(this);
239 var description = new Pango.FontDescription.c_new();
240 description.set_size(10000);
241 this.el.modify_font(description);
243 this.selection = this.el.get_selection();
244 this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);
248 this.selection.signal['changed'].connect(function() {
249 _this.listeners.cursor_changed.apply(
256 xtype: Gtk.ListStore,
260 XObject.prototype.init.call(this);
261 this.el.set_column_types ( 7, [
262 GObject.TYPE_STRING, // repo
263 GObject.TYPE_STRING, // current branch
264 GObject.TYPE_STRING, // all branch
265 GObject.TYPE_STRING, // updated
266 GObject.TYPE_BOOLEAN, // auto-commit
267 GObject.TYPE_BOOLEAN, // auto-push
268 GObject.TYPE_STRING // repopath
273 //this.insert(citer,iter,0);
274 print("getting list");
275 this.repos = imports.Scm.Repo.Repo.list();
279 for(var i =0 ; i < tr.length; i++) {
284 //print(JSON.stringify(ret,null,4));
287 this.el.set_value(ret.iter, 0, '' + tr[i].repopath.split('/').pop() );
288 this.el.set_value(ret.iter, 1, '' + tr[i].currentBranch );
289 this.el.set_value(ret.iter, 2, '' + tr[i].branches.map(
290 function(e) { return e.name;
293 this.el.set_value(ret.iter, 3, '' + 'tbc' );
294 this.el.set_value(ret.iter, 4, tr[i].autocommit() );
295 this.el.set_value(ret.iter, 5, tr[i].autopush() );
296 this.el.set_value(ret.iter, 6, tr[i].repopath );
302 xtype: Gtk.TreeViewColumn,
304 pack : "append_column",
305 title : "Auto Commit",
307 XObject.prototype.init.call(this);
308 this.el.add_attribute(this.items[0].el , 'active', 4 );
309 this.items[0].el.set_activatable(true);
314 xtype: Gtk.CellRendererToggle,
316 toggled : function (self, path) {
318 var store = this.get('/reposStore');
319 store.el.get_iter_from_string(ret, path);
321 var value = store.el.get_value(ret.iter,4).value.get_boolean();
323 //print(JSON.stringify(value));
324 store.el.set_value(ret.iter,4, !value);
329 mode : Gtk.CellRendererMode.ACTIVATABLE
334 xtype: Gtk.TreeViewColumn,
336 pack : "append_column",
339 XObject.prototype.init.call(this);
340 this.el.add_attribute(this.items[0].el , 'active', 5 );
341 this.items[0].el.set_activatable(true);
345 xtype: Gtk.CellRendererToggle,
347 toggled : function (self, path) {
349 var store = this.get('/reposStore');
350 store.el.get_iter_from_string(ret, path);
352 var value = store.el.get_value(ret.iter,5).value.get_boolean();
354 //print(JSON.stringify(value));
355 store.el.set_value(ret.iter,5, !value);
360 mode : Gtk.CellRendererMode.ACTIVATABLE
365 xtype: Gtk.TreeViewColumn,
367 pack : "append_column",
371 XObject.prototype.init.call(this);
372 this.el.add_attribute(this.items[0].el , 'markup', 0 );
377 xtype: Gtk.CellRendererText,
383 xtype: Gtk.TreeViewColumn,
385 pack : "append_column",
386 title : "Current Branch",
388 XObject.prototype.init.call(this);
389 this.el.add_attribute(this.items[0].el , 'markup', 1 );
394 xtype: Gtk.CellRendererText,
400 xtype: Gtk.TreeViewColumn,
402 pack : "append_column",
403 title : "Last updated",
405 XObject.prototype.init.call(this);
406 this.el.add_attribute(this.items[0].el , 'markup', 3 );
411 xtype: Gtk.CellRendererText,
417 xtype: Gtk.TreeViewColumn,
419 pack : "append_column",
421 title : "All Branches",
423 XObject.prototype.init.call(this);
424 this.el.add_attribute(this.items[0].el , 'markup', 2 );
429 xtype: Gtk.CellRendererText,
441 xtype: Gtk.ListStore,
453 pack : "add_action_widget,0"
459 pack : "add_action_widget,1"
464 XObject.cache['/Clones'] = Clones;