3 public class Clones : Object
8 public static Clones singleton()
10 if (_Clones == null) {
11 _Clones= new Clones();
15 public Xcls_reposView reposView;
16 public Xcls_reposStore reposStore;
17 public Xcls_tv_autocommit tv_autocommit;
18 public Xcls_cr_autocommit cr_autocommit;
19 public Xcls_tv_autopush tv_autopush;
20 public Xcls_cr_autopush cr_autopush;
21 public Xcls_tv_autobranch tv_autobranch;
22 public Xcls_cr_autobranch cr_autobranch;
23 public Xcls_tv_repo tv_repo;
24 public Xcls_cr_repo cr_repo;
25 public Xcls_tv_active_ticket tv_active_ticket;
26 public Xcls_cr_active_ticket cr_active_ticket;
27 public Xcls_tv_current_branch tv_current_branch;
28 public Xcls_cr_current_branch cr_current_branch;
29 public Xcls_tv_last_updated tv_last_updated;
30 public Xcls_cr_last_updated cr_last_updated;
31 public Xcls_tv_all_branches tv_all_branches;
32 public Xcls_cr_all_branches cr_all_branches;
40 this.el = new Gtk.Dialog();
45 this.el.title = "Manage Clones";
46 this.el.border_width = 3;
47 this.el.default_height = 500;
48 this.el.default_width = 1024;
49 this.el.deletable = true;
51 var child_0 = new Xcls_Box2( _this );
53 this.el.get_content_area().add ( child_0.el );
56 this.el.delete_event.connect( (self, event) => {
61 this.el.response.connect( (self, response_id) => {
68 // user defined functions
72 this.el.set_deletable(true);
73 this.el.set_gravity(Gdk.Gravity.NORTH);
74 this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
76 this.el.set_default_size(
77 int.min(1024,Gdk.Screen.width()),
78 int.max(500,Gdk.Screen.height() - 300)
82 _this.reposStore.load();
83 this.el.set_keep_above(true);
86 // this.get('/reposStore').load();
88 //this.get('/ok_button').el.set_sensitive(false);
90 // block until we return.
91 // var run_ret = this.el.run();
92 // if (run_ret < 1 ) {
95 // print("RUN RETURN : " + run_ret);
97 //print(JSON.stringify(this.get('bug').getValue()));
98 // return this.get('bug').getValue();
99 //this.success = c.success;
101 public class Xcls_Box2 : Object
104 private Clones _this;
110 public Xcls_Box2(Clones _owner )
113 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
117 // set gobject values
118 var child_0 = new Xcls_Box3( _this );
120 this.el.pack_start ( child_0.el , false,false,0 );
121 var child_1 = new Xcls_ScrolledWindow5( _this );
123 this.el.pack_end ( child_1.el , true,true,0 );
126 // user defined functions
128 public class Xcls_Box3 : Object
131 private Clones _this;
137 public Xcls_Box3(Clones _owner )
140 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
144 // set gobject values
145 this.el.homogeneous = true;
146 var child_0 = new Xcls_Button4( _this );
148 this.el.add ( child_0.el );
151 // user defined functions
153 public class Xcls_Button4 : Object
155 public Gtk.Button el;
156 private Clones _this;
162 public Xcls_Button4(Clones _owner )
165 this.el = new Gtk.Button();
169 // set gobject values
170 this.el.label = "Add Repository";
173 this.el.clicked.connect( () => {
175 /* var rv = this.get('/reposView');
176 var rs = this.get('/reposStore');
177 if (rv.el.get_selection().count_selected_rows() != 1) {
182 var Remotes = imports.Remotes.Remotes;
186 var s = rv.el.get_selection();
188 s.selected_foreach(function(model,p,iter) {
190 path = model.get_value(iter, 6).value.get_string();
195 rs.repos.forEach(function(r) {
196 if (r.repopath == path) {
203 Remotes.el.set_transient_for(Clones.el);
204 Clones.el.set_title("Manage Clones - " + repo.repopath);
206 Clones.el.set_title("Manage Clones");
218 // user defined functions
222 public class Xcls_ScrolledWindow5 : Object
224 public Gtk.ScrolledWindow el;
225 private Clones _this;
231 public Xcls_ScrolledWindow5(Clones _owner )
234 this.el = new Gtk.ScrolledWindow( null, null );
238 // set gobject values
239 this.el.expand = true;
240 this.el.hexpand = true;
241 this.el.shadow_type = Gtk.ShadowType.IN;
242 var child_0 = new Xcls_reposView( _this );
244 this.el.add ( child_0.el );
250 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
254 // user defined functions
256 public class Xcls_reposView : Object
258 public Gtk.TreeView el;
259 private Clones _this;
265 public Xcls_reposView(Clones _owner )
268 _this.reposView = this;
269 this.el = new Gtk.TreeView();
273 // set gobject values
274 this.el.search_column = 0;
275 this.el.activate_on_single_click = true;
276 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
277 var child_0 = new Xcls_reposStore( _this );
279 this.el.set_model ( child_0.el );
280 var child_1 = new Xcls_tv_autocommit( _this );
282 this.el.append_column ( child_1.el );
283 var child_2 = new Xcls_tv_autopush( _this );
285 this.el.append_column ( child_2.el );
286 var child_3 = new Xcls_tv_autobranch( _this );
288 this.el.append_column ( child_3.el );
289 var child_4 = new Xcls_tv_repo( _this );
291 this.el.append_column ( child_4.el );
292 var child_5 = new Xcls_tv_active_ticket( _this );
294 this.el.append_column ( child_5.el );
295 var child_6 = new Xcls_tv_current_branch( _this );
297 this.el.append_column ( child_6.el );
298 var child_7 = new Xcls_tv_last_updated( _this );
300 this.el.append_column ( child_7.el );
301 var child_8 = new Xcls_tv_all_branches( _this );
303 this.el.append_column ( child_8.el );
308 var selection = this.el.get_selection();
309 selection.set_mode( Gtk.SelectionMode.SINGLE);
312 var description = new Pango.FontDescription();
313 description.set_size(10000);
314 this.el.override_font(description);
319 this.el.row_activated.connect( (path, col) => {
321 if (col.title != "Current Branch") {
328 _this.reposStore.el.get_iter(out iter, path);
330 _this.reposStore.el.get_value(iter, 6, out val);
331 var git_working_dir = (string)val;
333 var repo = GitRepo.singleton().get(git_working_dir);
336 _this.reposView.el.get_cell_area(path, col, out rect);
337 RepoStatusPopover.singleton().show(this.el, rect, repo);
342 this.el.cursor_changed.connect( () => {
343 // SEE SELECTION.CHANGED
348 if (this.el.get_selection().count_selected_rows() < 1) {
349 //nothing? - clea it?
353 var model = this.get('/changedFilesStore');
355 var s = this.el.get_selection();
357 s.selected_foreach(function(model,p,iter) {
359 files.push( model.get_value(iter, 0).value.get_string());
362 this.get('/patchview').showDiff(files);
363 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
364 //print("OUT?" + value);// id..
365 // load the list in the right grid..
372 // user defined functions
374 public class Xcls_reposStore : Object
376 public Gtk.ListStore el;
377 private Clones _this;
383 public Xcls_reposStore(Clones _owner )
386 _this.reposStore = this;
387 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
388 typeof(string), // 1 current branch
389 typeof(string), // 2 all branch
390 typeof(string), // 3 updated
391 typeof(bool), // 4 auto commit
392 typeof(bool), // 5 auto push
393 typeof(string), // 6 repopath
394 typeof(string), // 7 color highlighting?
395 typeof(bool), // 8 auto branch,
396 typeof(string) // 9 active Ticket
401 // set gobject values
404 // user defined functions
407 //this.insert(citer,iter,0);
408 print("getting list");
409 var tr = GitRepo.list();
413 // fixme .. sort by last updated ...
416 for(var i =0 ; i < tr.length; i++) {
417 var repo = tr.index(i);
418 // this is done before we display stuff...
419 //repo.loadBranches();
423 this.el.append(out iter);
425 //print(JSON.stringify(ret,null,4));
426 //tr[i].getBranches();
431 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
432 // print(JSON.stringify(hi,null,4));
433 // } catch(e) { print(e);}
435 this.el.set_value(iter, 0, repo.name );
436 this.el.set_value( iter, 1, repo.currentBranch.name );
437 this.el.set_value( iter, 2, repo.branchesToString() );
438 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
439 // function(e) { return e.name;
442 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
443 this.el.set_value(iter, 4, repo.is_autocommit() );
444 this.el.set_value(iter, 5, repo.is_autopush() );
445 this.el.set_value(iter, 6, repo.git_working_dir );
447 var cb = repo.currentBranch;
448 //print(JSON.stringify(cb,null,4));
451 if (cb.lastrev != cb.remoterev) {
453 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
454 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
458 if (repo.has_local_changes) {
460 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
462 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
464 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
465 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote") +
466 "\nHas uncommitted changes" );
469 this.el.set_value(iter, 7, col );
470 var ticket = repo.activeTicket;
472 this.el.set_value(iter, 8, repo.is_auto_branch() );
473 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
477 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
481 public class Xcls_tv_autocommit : Object
483 public Gtk.TreeViewColumn el;
484 private Clones _this;
490 public Xcls_tv_autocommit(Clones _owner )
493 _this.tv_autocommit = this;
494 this.el = new Gtk.TreeViewColumn();
498 // set gobject values
499 this.el.title = "Auto Commit";
500 this.el.min_width = 50;
501 var child_0 = new Xcls_cr_autocommit( _this );
503 this.el.pack_start ( child_0.el , false );
507 // this.items[0].el.set_activatable(true);
508 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
511 // user defined functions
513 public class Xcls_cr_autocommit : Object
515 public Gtk.CellRendererToggle el;
516 private Clones _this;
522 public Xcls_cr_autocommit(Clones _owner )
525 _this.cr_autocommit = this;
526 this.el = new Gtk.CellRendererToggle();
530 // set gobject values
531 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
534 this.el.toggled.connect( (self, path) => {
537 _this.reposStore.el.get_iter_from_string(out iter, path);
541 _this.reposStore.el.get_value(iter, 4, out val);
542 _this.reposStore.el.get_value(iter, 6, out rval);
544 var repopath = (string)rval;
545 var bval = (bool)val;
546 _this.reposStore.el.set_value(iter, 4, !bval);
547 GLib.debug("got repopath? %s", repopath);
549 var repo = GitRepo.get(repopath);
550 repo.set_autocommit(!bval);
558 // user defined functions
562 public class Xcls_tv_autopush : Object
564 public Gtk.TreeViewColumn el;
565 private Clones _this;
571 public Xcls_tv_autopush(Clones _owner )
574 _this.tv_autopush = this;
575 this.el = new Gtk.TreeViewColumn();
579 // set gobject values
580 this.el.title = "Auto Push";
581 this.el.min_width = 50;
582 var child_0 = new Xcls_cr_autopush( _this );
584 this.el.pack_start ( child_0.el , false );
588 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
589 // this.items[0].el.set_activatable(true);
592 // user defined functions
594 public class Xcls_cr_autopush : Object
596 public Gtk.CellRendererToggle el;
597 private Clones _this;
603 public Xcls_cr_autopush(Clones _owner )
606 _this.cr_autopush = this;
607 this.el = new Gtk.CellRendererToggle();
611 // set gobject values
612 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
615 this.el.toggled.connect( (self, path) => {
618 _this.reposStore.el.get_iter_from_string(out iter, path);
622 _this.reposStore.el.get_value(iter, 5, out val);
623 _this.reposStore.el.get_value(iter, 6, out rval);
625 var repopath = (string)rval;
626 var bval = (bool)val;
627 _this.reposStore.el.set_value(iter, 5, !bval);
628 var repo = GitRepo.get(repopath);
629 repo.set_autopush(!bval);
637 // user defined functions
641 public class Xcls_tv_autobranch : Object
643 public Gtk.TreeViewColumn el;
644 private Clones _this;
650 public Xcls_tv_autobranch(Clones _owner )
653 _this.tv_autobranch = this;
654 this.el = new Gtk.TreeViewColumn();
658 // set gobject values
659 this.el.title = "Auto Branch";
660 this.el.min_width = 50;
661 var child_0 = new Xcls_cr_autobranch( _this );
663 this.el.pack_start ( child_0.el , false );
667 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
668 // this.items[0].el.set_activatable(true);
671 // user defined functions
673 public class Xcls_cr_autobranch : Object
675 public Gtk.CellRendererToggle el;
676 private Clones _this;
682 public Xcls_cr_autobranch(Clones _owner )
685 _this.cr_autobranch = this;
686 this.el = new Gtk.CellRendererToggle();
690 // set gobject values
691 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
694 this.el.toggled.connect( (self, path) => {
697 _this.reposStore.el.get_iter_from_string(out iter, path);
701 _this.reposStore.el.get_value(iter, 8, out val);
702 _this.reposStore.el.get_value(iter, 6, out rval);
704 var repopath = (string)rval;
705 var bval = (bool)val;
706 _this.reposStore.el.set_value(iter, 8, !bval);
707 var repo = GitRepo.get(repopath);
708 repo.set_auto_branch(!bval);
716 // user defined functions
720 public class Xcls_tv_repo : Object
722 public Gtk.TreeViewColumn el;
723 private Clones _this;
729 public Xcls_tv_repo(Clones _owner )
732 _this.tv_repo = this;
733 this.el = new Gtk.TreeViewColumn();
737 // set gobject values
738 this.el.sort_column_id = 0;
739 this.el.title = "Repo";
740 this.el.min_width = 200;
741 this.el.sort_order = Gtk.SortType.ASCENDING;
742 this.el.resizable = true;
743 var child_0 = new Xcls_cr_repo( _this );
745 this.el.pack_start ( child_0.el , false );
749 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
752 // user defined functions
754 public class Xcls_cr_repo : Object
756 public Gtk.CellRendererText el;
757 private Clones _this;
763 public Xcls_cr_repo(Clones _owner )
766 _this.cr_repo = this;
767 this.el = new Gtk.CellRendererText();
771 // set gobject values
774 // user defined functions
778 public class Xcls_tv_active_ticket : Object
780 public Gtk.TreeViewColumn el;
781 private Clones _this;
787 public Xcls_tv_active_ticket(Clones _owner )
790 _this.tv_active_ticket = this;
791 this.el = new Gtk.TreeViewColumn();
795 // set gobject values
796 this.el.title = "Active Ticket";
797 this.el.min_width = 50;
798 var child_0 = new Xcls_cr_active_ticket( _this );
800 this.el.pack_start ( child_0.el , false );
804 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
807 // user defined functions
809 public class Xcls_cr_active_ticket : Object
811 public Gtk.CellRendererText el;
812 private Clones _this;
818 public Xcls_cr_active_ticket(Clones _owner )
821 _this.cr_active_ticket = this;
822 this.el = new Gtk.CellRendererText();
826 // set gobject values
829 // user defined functions
833 public class Xcls_tv_current_branch : Object
835 public Gtk.TreeViewColumn el;
836 private Clones _this;
842 public Xcls_tv_current_branch(Clones _owner )
845 _this.tv_current_branch = this;
846 this.el = new Gtk.TreeViewColumn();
850 // set gobject values
851 this.el.title = "Current Branch";
852 this.el.min_width = 50;
853 var child_0 = new Xcls_cr_current_branch( _this );
855 this.el.pack_start ( child_0.el , false );
859 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
860 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
863 // user defined functions
865 public class Xcls_cr_current_branch : Object
867 public Gtk.CellRendererText el;
868 private Clones _this;
874 public Xcls_cr_current_branch(Clones _owner )
877 _this.cr_current_branch = this;
878 this.el = new Gtk.CellRendererText();
882 // set gobject values
885 // user defined functions
889 public class Xcls_tv_last_updated : Object
891 public Gtk.TreeViewColumn el;
892 private Clones _this;
898 public Xcls_tv_last_updated(Clones _owner )
901 _this.tv_last_updated = this;
902 this.el = new Gtk.TreeViewColumn();
906 // set gobject values
907 this.el.title = "Last updated";
908 this.el.min_width = 50;
909 var child_0 = new Xcls_cr_last_updated( _this );
911 this.el.pack_start ( child_0.el , false );
915 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
918 // user defined functions
920 public class Xcls_cr_last_updated : Object
922 public Gtk.CellRendererText el;
923 private Clones _this;
929 public Xcls_cr_last_updated(Clones _owner )
932 _this.cr_last_updated = this;
933 this.el = new Gtk.CellRendererText();
937 // set gobject values
940 // user defined functions
944 public class Xcls_tv_all_branches : Object
946 public Gtk.TreeViewColumn el;
947 private Clones _this;
953 public Xcls_tv_all_branches(Clones _owner )
956 _this.tv_all_branches = this;
957 this.el = new Gtk.TreeViewColumn();
961 // set gobject values
962 this.el.title = "All Branches";
963 this.el.min_width = 50;
964 this.el.resizable = false;
965 var child_0 = new Xcls_cr_all_branches( _this );
967 this.el.pack_start ( child_0.el , false );
971 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
974 // user defined functions
976 public class Xcls_cr_all_branches : Object
978 public Gtk.CellRendererText el;
979 private Clones _this;
985 public Xcls_cr_all_branches(Clones _owner )
988 _this.cr_all_branches = this;
989 this.el = new Gtk.CellRendererText();
993 // set gobject values
996 // user defined functions