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.width() - 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_ScrolledWindow9( _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 );
149 var child_1 = new Xcls_Button5( _this );
151 this.el.add ( child_1.el );
152 var child_2 = new Xcls_Button6( _this );
154 this.el.add ( child_2.el );
155 var child_3 = new Xcls_Button7( _this );
157 this.el.add ( child_3.el );
158 var child_4 = new Xcls_Button8( _this );
160 this.el.add ( child_4.el );
163 // user defined functions
165 public class Xcls_Button4 : Object
167 public Gtk.Button el;
168 private Clones _this;
174 public Xcls_Button4(Clones _owner )
177 this.el = new Gtk.Button();
181 // set gobject values
182 this.el.label = "Add Repository";
185 this.el.clicked.connect( () => {
187 /* var rv = this.get('/reposView');
188 var rs = this.get('/reposStore');
189 if (rv.el.get_selection().count_selected_rows() != 1) {
194 var Remotes = imports.Remotes.Remotes;
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 Remotes.el.set_transient_for(Clones.el);
216 Clones.el.set_title("Manage Clones - " + repo.repopath);
218 Clones.el.set_title("Manage Clones");
230 // user defined functions
233 public class Xcls_Button5 : Object
235 public Gtk.Button el;
236 private Clones _this;
242 public Xcls_Button5(Clones _owner )
245 this.el = new Gtk.Button();
249 // set gobject values
250 this.el.label = "Branches";
251 this.el.visible = false;
254 this.el.clicked.connect( () => {
257 //NewBranch.singleton().show();
260 var rv = this.get('/reposView');
261 var rs = this.get('/reposStore');
262 if (rv.el.get_selection().count_selected_rows() != 1) {
267 var Branches = imports.Branches.Branches;
271 var s = rv.el.get_selection();
273 s.selected_foreach(function(model,p,iter) {
275 path = model.get_value(iter, 6).value.get_string();
280 rs.repos.forEach(function(r) {
281 if (r.repopath == path) {
287 Branches.repo = repo;
288 Branches.el.set_transient_for(Clones.el);
289 Clones.el.set_title("Manage Clones - " + repo.repopath);
291 Clones.el.set_title("Manage Clones");
304 // user defined functions
307 public class Xcls_Button6 : Object
309 public Gtk.Button el;
310 private Clones _this;
316 public Xcls_Button6(Clones _owner )
319 this.el = new Gtk.Button();
323 // set gobject values
324 this.el.label = "Merge";
327 this.el.clicked.connect( () => {
329 var rv = _this.reposView;
330 var rs = _this.reposStore;
331 var s =rv.el.get_selection();
332 if (s.count_selected_rows() != 1) {
337 s.get_selected(out tm, out iter);
339 tm.get_value(iter, 6, out val);
340 var git_working_dir = (string)val;
342 var repo = GitRepo.singleton().get(git_working_dir);
344 // if you hit merge.... in master..
346 if (repo.currentBranch.name == "master") {
349 MergeBranch.singleton().show(repo.activeTicket, repo);
350 _this.reposStore.load();
357 // user defined functions
360 public class Xcls_Button7 : Object
362 public Gtk.Button el;
363 private Clones _this;
369 public Xcls_Button7(Clones _owner )
372 this.el = new Gtk.Button();
376 // set gobject values
377 this.el.label = "Switch Branch";
378 this.el.visible = false;
381 this.el.clicked.connect( () => {
391 // user defined functions
394 public class Xcls_Button8 : Object
396 public Gtk.Button el;
397 private Clones _this;
403 public Xcls_Button8(Clones _owner )
406 this.el = new Gtk.Button();
410 // set gobject values
411 this.el.label = "Pull";
414 this.el.clicked.connect( () => {
424 // user defined functions
428 public class Xcls_ScrolledWindow9 : Object
430 public Gtk.ScrolledWindow el;
431 private Clones _this;
437 public Xcls_ScrolledWindow9(Clones _owner )
440 this.el = new Gtk.ScrolledWindow( null, null );
444 // set gobject values
445 this.el.expand = true;
446 this.el.hexpand = true;
447 this.el.shadow_type = Gtk.ShadowType.IN;
448 var child_0 = new Xcls_reposView( _this );
450 this.el.add ( child_0.el );
456 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
460 // user defined functions
462 public class Xcls_reposView : Object
464 public Gtk.TreeView el;
465 private Clones _this;
471 public Xcls_reposView(Clones _owner )
474 _this.reposView = this;
475 this.el = new Gtk.TreeView();
479 // set gobject values
480 this.el.search_column = 0;
481 this.el.activate_on_single_click = true;
482 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
483 var child_0 = new Xcls_reposStore( _this );
485 this.el.set_model ( child_0.el );
486 var child_1 = new Xcls_tv_autocommit( _this );
488 this.el.append_column ( child_1.el );
489 var child_2 = new Xcls_tv_autopush( _this );
491 this.el.append_column ( child_2.el );
492 var child_3 = new Xcls_tv_autobranch( _this );
494 this.el.append_column ( child_3.el );
495 var child_4 = new Xcls_tv_repo( _this );
497 this.el.append_column ( child_4.el );
498 var child_5 = new Xcls_tv_active_ticket( _this );
500 this.el.append_column ( child_5.el );
501 var child_6 = new Xcls_tv_current_branch( _this );
503 this.el.append_column ( child_6.el );
504 var child_7 = new Xcls_tv_last_updated( _this );
506 this.el.append_column ( child_7.el );
507 var child_8 = new Xcls_tv_all_branches( _this );
509 this.el.append_column ( child_8.el );
514 var selection = this.el.get_selection();
515 selection.set_mode( Gtk.SelectionMode.SINGLE);
518 var description = new Pango.FontDescription();
519 description.set_size(10000);
520 this.el.override_font(description);
525 this.el.row_activated.connect( (path, col) => {
526 GLib.debug("row activated: %s", col.title);
527 if (col.title != "Current Branch") {
534 _this.reposStore.el.get_iter(out iter, path);
536 _this.reposStore.el.get_value(iter, 6, out val);
537 var git_working_dir = (string)val;
539 var repo = GitRepo.singleton().get(git_working_dir);
542 _this.reposView.el.get_cell_area(path, col, out rect);
543 RepoStatusPopover.singleton().show(this.el, rect, repo);
548 this.el.cursor_changed.connect( () => {
549 // SEE SELECTION.CHANGED
554 if (this.el.get_selection().count_selected_rows() < 1) {
555 //nothing? - clea it?
559 var model = this.get('/changedFilesStore');
561 var s = this.el.get_selection();
563 s.selected_foreach(function(model,p,iter) {
565 files.push( model.get_value(iter, 0).value.get_string());
568 this.get('/patchview').showDiff(files);
569 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
570 //print("OUT?" + value);// id..
571 // load the list in the right grid..
578 // user defined functions
580 public class Xcls_reposStore : Object
582 public Gtk.ListStore el;
583 private Clones _this;
589 public Xcls_reposStore(Clones _owner )
592 _this.reposStore = this;
593 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
594 typeof(string), // 1 current branch
595 typeof(string), // 2 all branch
596 typeof(string), // 3 updated
597 typeof(bool), // 4 auto commit
598 typeof(bool), // 5 auto push
599 typeof(string), // 6 repopath
600 typeof(string), // 7 color highlighting?
601 typeof(bool), // 8 auto branch,
602 typeof(string) // 9 active Ticket
607 // set gobject values
610 // user defined functions
613 //this.insert(citer,iter,0);
614 print("getting list");
615 var tr = GitRepo.list();
619 // fixme .. sort by last updated ...
622 for(var i =0 ; i < tr.length; i++) {
623 var repo = tr.index(i);
624 // this is done before we display stuff...
625 //repo.loadBranches();
629 this.el.append(out iter);
631 //print(JSON.stringify(ret,null,4));
632 //tr[i].getBranches();
637 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
638 // print(JSON.stringify(hi,null,4));
639 // } catch(e) { print(e);}
641 this.el.set_value(iter, 0, repo.name );
642 this.el.set_value( iter, 1, repo.currentBranch.name );
643 this.el.set_value( iter, 2, repo.branchesToString() );
644 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
645 // function(e) { return e.name;
648 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
649 this.el.set_value(iter, 4, repo.is_autocommit() );
650 this.el.set_value(iter, 5, repo.is_autopush() );
651 this.el.set_value(iter, 6, repo.git_working_dir );
653 var cb = repo.currentBranch;
654 //print(JSON.stringify(cb,null,4));
657 if (cb.lastrev != cb.remoterev) {
659 this.el.set_value( iter, 1, repo.currentBranch.name +"\nRemote != Local" );
661 if (repo.has_local_changes) {
663 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
665 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
667 this.el.set_value( iter, 1, repo.currentBranch.name +"\nRemote != Local\nHas uncommitted changes" );
670 this.el.set_value(iter, 7, col );
671 var ticket = repo.activeTicket;
673 this.el.set_value(iter, 8, repo.is_auto_branch() );
674 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
678 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
682 public class Xcls_tv_autocommit : Object
684 public Gtk.TreeViewColumn el;
685 private Clones _this;
691 public Xcls_tv_autocommit(Clones _owner )
694 _this.tv_autocommit = this;
695 this.el = new Gtk.TreeViewColumn();
699 // set gobject values
700 this.el.title = "Auto Commit";
701 this.el.min_width = 50;
702 var child_0 = new Xcls_cr_autocommit( _this );
704 this.el.pack_start ( child_0.el , false );
708 // this.items[0].el.set_activatable(true);
709 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
712 // user defined functions
714 public class Xcls_cr_autocommit : Object
716 public Gtk.CellRendererToggle el;
717 private Clones _this;
723 public Xcls_cr_autocommit(Clones _owner )
726 _this.cr_autocommit = this;
727 this.el = new Gtk.CellRendererToggle();
731 // set gobject values
732 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
735 this.el.toggled.connect( (self, path) => {
738 _this.reposStore.el.get_iter_from_string(out iter, path);
742 _this.reposStore.el.get_value(iter, 4, out val);
743 _this.reposStore.el.get_value(iter, 6, out rval);
745 var repopath = (string)rval;
746 var bval = (bool)val;
747 _this.reposStore.el.set_value(iter, 4, !bval);
748 GLib.debug("got repopath? %s", repopath);
750 var repo = GitRepo.get(repopath);
751 repo.set_autocommit(!bval);
759 // user defined functions
763 public class Xcls_tv_autopush : Object
765 public Gtk.TreeViewColumn el;
766 private Clones _this;
772 public Xcls_tv_autopush(Clones _owner )
775 _this.tv_autopush = this;
776 this.el = new Gtk.TreeViewColumn();
780 // set gobject values
781 this.el.title = "Auto Push";
782 this.el.min_width = 50;
783 var child_0 = new Xcls_cr_autopush( _this );
785 this.el.pack_start ( child_0.el , false );
789 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
790 // this.items[0].el.set_activatable(true);
793 // user defined functions
795 public class Xcls_cr_autopush : Object
797 public Gtk.CellRendererToggle el;
798 private Clones _this;
804 public Xcls_cr_autopush(Clones _owner )
807 _this.cr_autopush = this;
808 this.el = new Gtk.CellRendererToggle();
812 // set gobject values
813 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
816 this.el.toggled.connect( (self, path) => {
819 _this.reposStore.el.get_iter_from_string(out iter, path);
823 _this.reposStore.el.get_value(iter, 5, out val);
824 _this.reposStore.el.get_value(iter, 6, out rval);
826 var repopath = (string)rval;
827 var bval = (bool)val;
828 _this.reposStore.el.set_value(iter, 5, !bval);
829 var repo = GitRepo.get(repopath);
830 repo.set_autopush(!bval);
838 // user defined functions
842 public class Xcls_tv_autobranch : Object
844 public Gtk.TreeViewColumn el;
845 private Clones _this;
851 public Xcls_tv_autobranch(Clones _owner )
854 _this.tv_autobranch = this;
855 this.el = new Gtk.TreeViewColumn();
859 // set gobject values
860 this.el.title = "Auto Branch";
861 this.el.min_width = 50;
862 var child_0 = new Xcls_cr_autobranch( _this );
864 this.el.pack_start ( child_0.el , false );
868 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
869 // this.items[0].el.set_activatable(true);
872 // user defined functions
874 public class Xcls_cr_autobranch : Object
876 public Gtk.CellRendererToggle el;
877 private Clones _this;
883 public Xcls_cr_autobranch(Clones _owner )
886 _this.cr_autobranch = this;
887 this.el = new Gtk.CellRendererToggle();
891 // set gobject values
892 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
895 this.el.toggled.connect( (self, path) => {
898 _this.reposStore.el.get_iter_from_string(out iter, path);
902 _this.reposStore.el.get_value(iter, 8, out val);
903 _this.reposStore.el.get_value(iter, 6, out rval);
905 var repopath = (string)rval;
906 var bval = (bool)val;
907 _this.reposStore.el.set_value(iter, 8, !bval);
908 var repo = GitRepo.get(repopath);
909 repo.set_auto_branch(!bval);
917 // user defined functions
921 public class Xcls_tv_repo : Object
923 public Gtk.TreeViewColumn el;
924 private Clones _this;
930 public Xcls_tv_repo(Clones _owner )
933 _this.tv_repo = this;
934 this.el = new Gtk.TreeViewColumn();
938 // set gobject values
939 this.el.sort_column_id = 0;
940 this.el.title = "Repo";
941 this.el.min_width = 200;
942 this.el.sort_order = Gtk.SortType.ASCENDING;
943 this.el.resizable = true;
944 var child_0 = new Xcls_cr_repo( _this );
946 this.el.pack_start ( child_0.el , false );
950 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
953 // user defined functions
955 public class Xcls_cr_repo : Object
957 public Gtk.CellRendererText el;
958 private Clones _this;
964 public Xcls_cr_repo(Clones _owner )
967 _this.cr_repo = this;
968 this.el = new Gtk.CellRendererText();
972 // set gobject values
975 // user defined functions
979 public class Xcls_tv_active_ticket : Object
981 public Gtk.TreeViewColumn el;
982 private Clones _this;
988 public Xcls_tv_active_ticket(Clones _owner )
991 _this.tv_active_ticket = this;
992 this.el = new Gtk.TreeViewColumn();
996 // set gobject values
997 this.el.title = "Active Ticket";
998 this.el.min_width = 50;
999 var child_0 = new Xcls_cr_active_ticket( _this );
1001 this.el.pack_start ( child_0.el , false );
1005 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
1008 // user defined functions
1010 public class Xcls_cr_active_ticket : Object
1012 public Gtk.CellRendererText el;
1013 private Clones _this;
1019 public Xcls_cr_active_ticket(Clones _owner )
1022 _this.cr_active_ticket = this;
1023 this.el = new Gtk.CellRendererText();
1027 // set gobject values
1030 // user defined functions
1034 public class Xcls_tv_current_branch : Object
1036 public Gtk.TreeViewColumn el;
1037 private Clones _this;
1043 public Xcls_tv_current_branch(Clones _owner )
1046 _this.tv_current_branch = this;
1047 this.el = new Gtk.TreeViewColumn();
1051 // set gobject values
1052 this.el.title = "Current Branch";
1053 this.el.min_width = 50;
1054 var child_0 = new Xcls_cr_current_branch( _this );
1056 this.el.pack_start ( child_0.el , false );
1060 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
1061 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
1064 // user defined functions
1066 public class Xcls_cr_current_branch : Object
1068 public Gtk.CellRendererText el;
1069 private Clones _this;
1075 public Xcls_cr_current_branch(Clones _owner )
1078 _this.cr_current_branch = this;
1079 this.el = new Gtk.CellRendererText();
1083 // set gobject values
1086 // user defined functions
1090 public class Xcls_tv_last_updated : Object
1092 public Gtk.TreeViewColumn el;
1093 private Clones _this;
1099 public Xcls_tv_last_updated(Clones _owner )
1102 _this.tv_last_updated = this;
1103 this.el = new Gtk.TreeViewColumn();
1107 // set gobject values
1108 this.el.title = "Last updated";
1109 this.el.min_width = 50;
1110 var child_0 = new Xcls_cr_last_updated( _this );
1112 this.el.pack_start ( child_0.el , false );
1116 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
1119 // user defined functions
1121 public class Xcls_cr_last_updated : Object
1123 public Gtk.CellRendererText el;
1124 private Clones _this;
1130 public Xcls_cr_last_updated(Clones _owner )
1133 _this.cr_last_updated = this;
1134 this.el = new Gtk.CellRendererText();
1138 // set gobject values
1141 // user defined functions
1145 public class Xcls_tv_all_branches : Object
1147 public Gtk.TreeViewColumn el;
1148 private Clones _this;
1154 public Xcls_tv_all_branches(Clones _owner )
1157 _this.tv_all_branches = this;
1158 this.el = new Gtk.TreeViewColumn();
1162 // set gobject values
1163 this.el.title = "All Branches";
1164 this.el.min_width = 50;
1165 this.el.resizable = false;
1166 var child_0 = new Xcls_cr_all_branches( _this );
1168 this.el.pack_start ( child_0.el , false );
1172 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
1175 // user defined functions
1177 public class Xcls_cr_all_branches : Object
1179 public Gtk.CellRendererText el;
1180 private Clones _this;
1186 public Xcls_cr_all_branches(Clones _owner )
1189 _this.cr_all_branches = this;
1190 this.el = new Gtk.CellRendererText();
1194 // set gobject values
1197 // user defined functions