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);
166 label : "Run Merger",
172 clicked : function (self) {
181 label : "Switch Branch",
187 clicked : function (self) {
202 xtype: Gtk.ScrolledWindow,
204 XObject.prototype.init.call(this);
205 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
211 cursor_changed : function (self) {
212 // SEE SELECTION.CHANGED
217 if (this.el.get_selection().count_selected_rows() < 1) {
218 //nothing? - clea it?
222 var model = this.get('/changedFilesStore');
224 var s = this.el.get_selection();
226 s.selected_foreach(function(model,p,iter) {
228 files.push( model.get_value(iter, 0).value.get_string());
231 this.get('/patchview').showDiff(files);
232 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
233 //print("OUT?" + value);// id..
234 // load the list in the right grid..
243 XObject.prototype.init.call(this);
244 var description = new Pango.FontDescription.c_new();
245 description.set_size(10000);
246 this.el.modify_font(description);
248 this.selection = this.el.get_selection();
249 this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);
253 this.selection.signal['changed'].connect(function() {
254 _this.listeners.cursor_changed.apply(
261 xtype: Gtk.ListStore,
265 XObject.prototype.init.call(this);
266 this.el.set_column_types ( 7, [
267 GObject.TYPE_STRING, // repo
268 GObject.TYPE_STRING, // current branch
269 GObject.TYPE_STRING, // all branch
270 GObject.TYPE_STRING, // updated
271 GObject.TYPE_BOOLEAN, // auto-commit
272 GObject.TYPE_BOOLEAN, // auto-push
273 GObject.TYPE_STRING // repopath
278 //this.insert(citer,iter,0);
279 print("getting list");
280 this.repos = imports.Scm.Repo.Repo.list();
284 for(var i =0 ; i < tr.length; i++) {
289 //print(JSON.stringify(ret,null,4));
292 this.el.set_value(ret.iter, 0, '' + tr[i].repopath.split('/').pop() );
293 this.el.set_value(ret.iter, 1, '' + tr[i].currentBranch );
294 this.el.set_value(ret.iter, 2, '' + tr[i].branches.map(
295 function(e) { return e.name;
298 this.el.set_value(ret.iter, 3, '' + 'tbc' );
299 this.el.set_value(ret.iter, 4, tr[i].autocommit() );
300 this.el.set_value(ret.iter, 5, tr[i].autopush() );
301 this.el.set_value(ret.iter, 6, tr[i].repopath );
307 xtype: Gtk.TreeViewColumn,
309 pack : "append_column",
310 title : "Auto Commit",
312 XObject.prototype.init.call(this);
313 this.el.add_attribute(this.items[0].el , 'active', 4 );
314 this.items[0].el.set_activatable(true);
319 xtype: Gtk.CellRendererToggle,
321 toggled : function (self, path) {
323 var store = this.get('/reposStore');
324 store.el.get_iter_from_string(ret, path);
326 var value = store.el.get_value(ret.iter,4).value.get_boolean();
328 //print(JSON.stringify(value));
329 store.el.set_value(ret.iter,4, !value);
334 mode : Gtk.CellRendererMode.ACTIVATABLE
339 xtype: Gtk.TreeViewColumn,
341 pack : "append_column",
344 XObject.prototype.init.call(this);
345 this.el.add_attribute(this.items[0].el , 'active', 5 );
346 this.items[0].el.set_activatable(true);
350 xtype: Gtk.CellRendererToggle,
352 toggled : function (self, path) {
354 var store = this.get('/reposStore');
355 store.el.get_iter_from_string(ret, path);
357 var value = store.el.get_value(ret.iter,5).value.get_boolean();
359 //print(JSON.stringify(value));
360 store.el.set_value(ret.iter,5, !value);
365 mode : Gtk.CellRendererMode.ACTIVATABLE
370 xtype: Gtk.TreeViewColumn,
372 pack : "append_column",
376 XObject.prototype.init.call(this);
377 this.el.add_attribute(this.items[0].el , 'markup', 0 );
382 xtype: Gtk.CellRendererText,
388 xtype: Gtk.TreeViewColumn,
390 pack : "append_column",
391 title : "Current Branch",
393 XObject.prototype.init.call(this);
394 this.el.add_attribute(this.items[0].el , 'markup', 1 );
399 xtype: Gtk.CellRendererText,
405 xtype: Gtk.TreeViewColumn,
407 pack : "append_column",
408 title : "Last updated",
410 XObject.prototype.init.call(this);
411 this.el.add_attribute(this.items[0].el , 'markup', 3 );
416 xtype: Gtk.CellRendererText,
422 xtype: Gtk.TreeViewColumn,
424 pack : "append_column",
426 title : "All Branches",
428 XObject.prototype.init.call(this);
429 this.el.add_attribute(this.items[0].el , 'markup', 2 );
434 xtype: Gtk.CellRendererText,
446 xtype: Gtk.ListStore,
458 pack : "add_action_widget,0"
464 pack : "add_action_widget,1"
469 XObject.cache['/Clones'] = Clones;