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;
33 public Xcls_ok_button ok_button;
41 this.el = new Gtk.Dialog();
46 this.el.title = "Manage Clones";
47 this.el.border_width = 3;
48 this.el.default_height = 500;
49 this.el.default_width = 800;
50 this.el.deletable = true;
52 var child_0 = new Xcls_Box2( _this );
54 this.el.get_content_area().add ( child_0.el );
55 var child_1 = new Xcls_ok_button( _this );
57 this.el.add_action_widget ( child_1.el , 1 );
60 this.el.delete_event.connect( (self, event) => {
65 this.el.response.connect( (self, response_id) => {
72 // user defined functions
76 this.el.set_deletable(false);
77 this.el.set_gravity(Gdk.Gravity.NORTH);
78 this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
80 _this.reposStore.load();
82 // this.get('/reposStore').load();
84 //this.get('/ok_button').el.set_sensitive(false);
86 // block until we return.
87 // var run_ret = this.el.run();
88 // if (run_ret < 1 ) {
91 // print("RUN RETURN : " + run_ret);
93 //print(JSON.stringify(this.get('bug').getValue()));
94 // return this.get('bug').getValue();
95 //this.success = c.success;
97 public class Xcls_Box2 : Object
100 private Clones _this;
106 public Xcls_Box2(Clones _owner )
109 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
113 // set gobject values
114 var child_0 = new Xcls_Box3( _this );
116 this.el.pack_start ( child_0.el , false,false,0 );
117 var child_1 = new Xcls_ScrolledWindow9( _this );
119 this.el.pack_end ( child_1.el , true,true,0 );
122 // user defined functions
124 public class Xcls_Box3 : Object
127 private Clones _this;
133 public Xcls_Box3(Clones _owner )
136 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
140 // set gobject values
141 var child_0 = new Xcls_Button4( _this );
143 this.el.add ( child_0.el );
144 var child_1 = new Xcls_Button5( _this );
146 this.el.add ( child_1.el );
147 var child_2 = new Xcls_Button6( _this );
149 this.el.add ( child_2.el );
150 var child_3 = new Xcls_Button7( _this );
152 this.el.add ( child_3.el );
153 var child_4 = new Xcls_Button8( _this );
155 this.el.add ( child_4.el );
158 // user defined functions
160 public class Xcls_Button4 : Object
162 public Gtk.Button el;
163 private Clones _this;
169 public Xcls_Button4(Clones _owner )
172 this.el = new Gtk.Button();
176 // set gobject values
177 this.el.label = "Remotes / Clones";
180 this.el.clicked.connect( () => {
182 /* var rv = this.get('/reposView');
183 var rs = this.get('/reposStore');
184 if (rv.el.get_selection().count_selected_rows() != 1) {
189 var Remotes = imports.Remotes.Remotes;
193 var s = rv.el.get_selection();
195 s.selected_foreach(function(model,p,iter) {
197 path = model.get_value(iter, 6).value.get_string();
202 rs.repos.forEach(function(r) {
203 if (r.repopath == path) {
210 Remotes.el.set_transient_for(Clones.el);
211 Clones.el.set_title("Manage Clones - " + repo.repopath);
213 Clones.el.set_title("Manage Clones");
225 // user defined functions
228 public class Xcls_Button5 : Object
230 public Gtk.Button el;
231 private Clones _this;
237 public Xcls_Button5(Clones _owner )
240 this.el = new Gtk.Button();
244 // set gobject values
245 this.el.label = "Branches";
248 this.el.clicked.connect( () => {
251 //NewBranch.singleton().show();
254 var rv = this.get('/reposView');
255 var rs = this.get('/reposStore');
256 if (rv.el.get_selection().count_selected_rows() != 1) {
261 var Branches = imports.Branches.Branches;
265 var s = rv.el.get_selection();
267 s.selected_foreach(function(model,p,iter) {
269 path = model.get_value(iter, 6).value.get_string();
274 rs.repos.forEach(function(r) {
275 if (r.repopath == path) {
281 Branches.repo = repo;
282 Branches.el.set_transient_for(Clones.el);
283 Clones.el.set_title("Manage Clones - " + repo.repopath);
285 Clones.el.set_title("Manage Clones");
298 // user defined functions
301 public class Xcls_Button6 : Object
303 public Gtk.Button el;
304 private Clones _this;
310 public Xcls_Button6(Clones _owner )
313 this.el = new Gtk.Button();
317 // set gobject values
318 this.el.label = "Merge";
321 this.el.clicked.connect( () => {
323 var rv = this.get('/reposView');
324 var rs = this.get('/reposStore');
325 if (rv.el.get_selection().count_selected_rows() != 1) {
330 var Merger = imports.Merger.Merger;
334 var s = rv.el.get_selection();
336 s.selected_foreach(function(model,p,iter) {
338 path = model.get_value(iter, 6).value.get_string();
343 rs.repos.forEach(function(r) {
344 if (r.repopath == path) {
351 Merger.el.set_transient_for(Clones.el);
352 Clones.el.set_title("Manage Clones - " + repo.repopath);
354 Clones.el.set_title("Manage Clones");
368 // user defined functions
371 public class Xcls_Button7 : Object
373 public Gtk.Button el;
374 private Clones _this;
380 public Xcls_Button7(Clones _owner )
383 this.el = new Gtk.Button();
387 // set gobject values
388 this.el.label = "Switch Branch";
391 this.el.clicked.connect( () => {
401 // user defined functions
404 public class Xcls_Button8 : Object
406 public Gtk.Button el;
407 private Clones _this;
413 public Xcls_Button8(Clones _owner )
416 this.el = new Gtk.Button();
420 // set gobject values
421 this.el.label = "Pull";
424 this.el.clicked.connect( () => {
434 // user defined functions
438 public class Xcls_ScrolledWindow9 : Object
440 public Gtk.ScrolledWindow el;
441 private Clones _this;
447 public Xcls_ScrolledWindow9(Clones _owner )
450 this.el = new Gtk.ScrolledWindow( null, null );
454 // set gobject values
455 this.el.expand = true;
456 this.el.hexpand = true;
457 this.el.shadow_type = Gtk.ShadowType.IN;
458 var child_0 = new Xcls_reposView( _this );
460 this.el.add ( child_0.el );
466 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
470 // user defined functions
472 public class Xcls_reposView : Object
474 public Gtk.TreeView el;
475 private Clones _this;
481 public Xcls_reposView(Clones _owner )
484 _this.reposView = this;
485 this.el = new Gtk.TreeView();
489 // set gobject values
490 var child_0 = new Xcls_reposStore( _this );
492 this.el.set_model ( child_0.el );
493 var child_1 = new Xcls_tv_autocommit( _this );
495 this.el.append_column ( child_1.el );
496 var child_2 = new Xcls_tv_autopush( _this );
498 this.el.append_column ( child_2.el );
499 var child_3 = new Xcls_tv_autobranch( _this );
501 this.el.append_column ( child_3.el );
502 var child_4 = new Xcls_tv_repo( _this );
504 this.el.append_column ( child_4.el );
505 var child_5 = new Xcls_tv_active_ticket( _this );
507 this.el.append_column ( child_5.el );
508 var child_6 = new Xcls_tv_current_branch( _this );
510 this.el.append_column ( child_6.el );
511 var child_7 = new Xcls_tv_last_updated( _this );
513 this.el.append_column ( child_7.el );
514 var child_8 = new Xcls_tv_all_branches( _this );
516 this.el.append_column ( child_8.el );
521 var selection = this.el.get_selection();
522 selection.set_mode( Gtk.SelectionMode.SINGLE);
525 var description = new Pango.FontDescription();
526 description.set_size(10000);
527 this.el.override_font(description);
532 this.el.cursor_changed.connect( () => {
533 // SEE SELECTION.CHANGED
538 if (this.el.get_selection().count_selected_rows() < 1) {
539 //nothing? - clea it?
543 var model = this.get('/changedFilesStore');
545 var s = this.el.get_selection();
547 s.selected_foreach(function(model,p,iter) {
549 files.push( model.get_value(iter, 0).value.get_string());
552 this.get('/patchview').showDiff(files);
553 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
554 //print("OUT?" + value);// id..
555 // load the list in the right grid..
562 // user defined functions
564 public class Xcls_reposStore : Object
566 public Gtk.ListStore el;
567 private Clones _this;
573 public Xcls_reposStore(Clones _owner )
576 _this.reposStore = this;
577 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
578 typeof(string), // 1 current branch
579 typeof(string), // 2 all branch
580 typeof(string), // 3 updated
581 typeof(bool), // 4 auto commit
582 typeof(bool), // 5 auto push
583 typeof(string), // 6 repopath
584 typeof(string), // 7 color highlighting?
585 typeof(bool), // 8 auto branch,
586 typeof(string) // 9 active Ticket
591 // set gobject values
594 // user defined functions
597 //this.insert(citer,iter,0);
598 print("getting list");
599 var tr = GitRepo.list();
603 // fixme .. sort by last updated ...
606 for(var i =0 ; i < tr.length; i++) {
607 var repo = tr.index(i);
611 this.el.append(out iter);
614 //print(JSON.stringify(ret,null,4));
615 //tr[i].getBranches();
620 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
621 // print(JSON.stringify(hi,null,4));
622 // } catch(e) { print(e);}
624 this.el.set_value(iter, 0, repo.name );
625 this.el.set_value( iter, 1, repo.currentBranch.name );
626 this.el.set_value( iter, 2, repo.branchesToString() );
627 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
628 // function(e) { return e.name;
631 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
632 this.el.set_value(iter, 4, repo.is_autocommit() );
633 this.el.set_value(iter, 5, repo.is_autopush() );
634 this.el.set_value(iter, 6, repo.git_working_dir );
636 var cb = repo.currentBranch;
637 //print(JSON.stringify(cb,null,4));
640 if (cb.lastrev != cb.remoterev) {
643 if (tr[i].hasLocalChanges) {
646 if ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
650 this.el.set_value(iter, 7, col );
651 var ticket = repo.activeTicket;
653 this.el.set_value(iter, 8, repo.is_auto_branch() );
654 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
658 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
662 public class Xcls_tv_autocommit : Object
664 public Gtk.TreeViewColumn el;
665 private Clones _this;
671 public Xcls_tv_autocommit(Clones _owner )
674 _this.tv_autocommit = this;
675 this.el = new Gtk.TreeViewColumn();
679 // set gobject values
680 this.el.title = "Auto Commit";
681 this.el.min_width = 50;
682 var child_0 = new Xcls_cr_autocommit( _this );
684 this.el.pack_start ( child_0.el , false );
688 // this.items[0].el.set_activatable(true);
689 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
692 // user defined functions
694 public class Xcls_cr_autocommit : Object
696 public Gtk.CellRendererToggle el;
697 private Clones _this;
703 public Xcls_cr_autocommit(Clones _owner )
706 _this.cr_autocommit = this;
707 this.el = new Gtk.CellRendererToggle();
711 // set gobject values
712 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
715 this.el.toggled.connect( (self, path) => {
718 _this.reposStore.el.get_iter_from_string(out iter, path);
722 _this.reposStore.el.get_value(iter, 4, out val);
723 _this.reposStore.el.get_value(iter, 6, out rval);
725 var repopath = (string)rval;
726 var bval = (bool)val;
727 _this.reposStore.el.set_value(iter, 4, !bval);
728 GLib.debug("got repopath? %s", repopath);
730 var repo = GitRepo.get(repopath);
731 repo.set_autocommit(!bval);
739 // user defined functions
743 public class Xcls_tv_autopush : Object
745 public Gtk.TreeViewColumn el;
746 private Clones _this;
752 public Xcls_tv_autopush(Clones _owner )
755 _this.tv_autopush = this;
756 this.el = new Gtk.TreeViewColumn();
760 // set gobject values
761 this.el.title = "Auto Push";
762 this.el.min_width = 50;
763 var child_0 = new Xcls_cr_autopush( _this );
765 this.el.pack_start ( child_0.el , false );
769 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
770 // this.items[0].el.set_activatable(true);
773 // user defined functions
775 public class Xcls_cr_autopush : Object
777 public Gtk.CellRendererToggle el;
778 private Clones _this;
784 public Xcls_cr_autopush(Clones _owner )
787 _this.cr_autopush = this;
788 this.el = new Gtk.CellRendererToggle();
792 // set gobject values
793 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
796 this.el.toggled.connect( (self, path) => {
799 _this.reposStore.el.get_iter_from_string(out iter, path);
803 _this.reposStore.el.get_value(iter, 5, out val);
804 _this.reposStore.el.get_value(iter, 6, out rval);
806 var repopath = (string)rval;
807 var bval = (bool)val;
808 _this.reposStore.el.set_value(iter, 5, !bval);
809 var repo = GitRepo.get(repopath);
810 repo.set_autopush(!bval);
818 // user defined functions
822 public class Xcls_tv_autobranch : Object
824 public Gtk.TreeViewColumn el;
825 private Clones _this;
831 public Xcls_tv_autobranch(Clones _owner )
834 _this.tv_autobranch = this;
835 this.el = new Gtk.TreeViewColumn();
839 // set gobject values
840 this.el.title = "Auto Branch";
841 this.el.min_width = 50;
842 var child_0 = new Xcls_cr_autobranch( _this );
844 this.el.pack_start ( child_0.el , false );
848 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
849 // this.items[0].el.set_activatable(true);
852 // user defined functions
854 public class Xcls_cr_autobranch : Object
856 public Gtk.CellRendererToggle el;
857 private Clones _this;
863 public Xcls_cr_autobranch(Clones _owner )
866 _this.cr_autobranch = this;
867 this.el = new Gtk.CellRendererToggle();
871 // set gobject values
872 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
875 this.el.toggled.connect( (self, path) => {
878 _this.reposStore.el.get_iter_from_string(out iter, path);
882 _this.reposStore.el.get_value(iter, 8, out val);
883 _this.reposStore.el.get_value(iter, 6, out rval);
885 var repopath = (string)rval;
886 var bval = (bool)val;
887 _this.reposStore.el.set_value(iter, 8, !bval);
888 var repo = GitRepo.get(repopath);
889 repo.set_auto_branch(!bval);
897 // user defined functions
901 public class Xcls_tv_repo : Object
903 public Gtk.TreeViewColumn el;
904 private Clones _this;
910 public Xcls_tv_repo(Clones _owner )
913 _this.tv_repo = this;
914 this.el = new Gtk.TreeViewColumn();
918 // set gobject values
919 this.el.sort_column_id = 0;
920 this.el.title = "Repo";
921 this.el.min_width = 200;
922 this.el.sort_order = Gtk.SortType.ASCENDING;
923 this.el.resizable = true;
924 var child_0 = new Xcls_cr_repo( _this );
926 this.el.pack_start ( child_0.el , false );
930 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
933 // user defined functions
935 public class Xcls_cr_repo : Object
937 public Gtk.CellRendererText el;
938 private Clones _this;
944 public Xcls_cr_repo(Clones _owner )
947 _this.cr_repo = this;
948 this.el = new Gtk.CellRendererText();
952 // set gobject values
955 // user defined functions
959 public class Xcls_tv_active_ticket : Object
961 public Gtk.TreeViewColumn el;
962 private Clones _this;
968 public Xcls_tv_active_ticket(Clones _owner )
971 _this.tv_active_ticket = this;
972 this.el = new Gtk.TreeViewColumn();
976 // set gobject values
977 this.el.title = "Active Ticket";
978 this.el.min_width = 50;
979 var child_0 = new Xcls_cr_active_ticket( _this );
981 this.el.pack_start ( child_0.el , false );
985 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
988 // user defined functions
990 public class Xcls_cr_active_ticket : Object
992 public Gtk.CellRendererText el;
993 private Clones _this;
999 public Xcls_cr_active_ticket(Clones _owner )
1002 _this.cr_active_ticket = this;
1003 this.el = new Gtk.CellRendererText();
1007 // set gobject values
1010 // user defined functions
1014 public class Xcls_tv_current_branch : Object
1016 public Gtk.TreeViewColumn el;
1017 private Clones _this;
1023 public Xcls_tv_current_branch(Clones _owner )
1026 _this.tv_current_branch = this;
1027 this.el = new Gtk.TreeViewColumn();
1031 // set gobject values
1032 this.el.title = "Current Branch";
1033 this.el.min_width = 50;
1034 var child_0 = new Xcls_cr_current_branch( _this );
1036 this.el.pack_start ( child_0.el , false );
1040 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
1041 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
1044 // user defined functions
1046 public class Xcls_cr_current_branch : Object
1048 public Gtk.CellRendererText el;
1049 private Clones _this;
1055 public Xcls_cr_current_branch(Clones _owner )
1058 _this.cr_current_branch = this;
1059 this.el = new Gtk.CellRendererText();
1063 // set gobject values
1066 // user defined functions
1070 public class Xcls_tv_last_updated : Object
1072 public Gtk.TreeViewColumn el;
1073 private Clones _this;
1079 public Xcls_tv_last_updated(Clones _owner )
1082 _this.tv_last_updated = this;
1083 this.el = new Gtk.TreeViewColumn();
1087 // set gobject values
1088 this.el.title = "Last updated";
1089 this.el.min_width = 50;
1090 var child_0 = new Xcls_cr_last_updated( _this );
1092 this.el.pack_start ( child_0.el , false );
1096 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
1099 // user defined functions
1101 public class Xcls_cr_last_updated : Object
1103 public Gtk.CellRendererText el;
1104 private Clones _this;
1110 public Xcls_cr_last_updated(Clones _owner )
1113 _this.cr_last_updated = this;
1114 this.el = new Gtk.CellRendererText();
1118 // set gobject values
1121 // user defined functions
1125 public class Xcls_tv_all_branches : Object
1127 public Gtk.TreeViewColumn el;
1128 private Clones _this;
1134 public Xcls_tv_all_branches(Clones _owner )
1137 _this.tv_all_branches = this;
1138 this.el = new Gtk.TreeViewColumn();
1142 // set gobject values
1143 this.el.title = "All Branches";
1144 this.el.min_width = 50;
1145 this.el.resizable = false;
1146 var child_0 = new Xcls_cr_all_branches( _this );
1148 this.el.pack_start ( child_0.el , false );
1152 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
1155 // user defined functions
1157 public class Xcls_cr_all_branches : Object
1159 public Gtk.CellRendererText el;
1160 private Clones _this;
1166 public Xcls_cr_all_branches(Clones _owner )
1169 _this.cr_all_branches = this;
1170 this.el = new Gtk.CellRendererText();
1174 // set gobject values
1177 // user defined functions
1184 public class Xcls_ok_button : Object
1186 public Gtk.Button el;
1187 private Clones _this;
1193 public Xcls_ok_button(Clones _owner )
1196 _this.ok_button = this;
1197 this.el = new Gtk.Button();
1201 // set gobject values
1202 this.el.expand = false;
1203 this.el.label = "Close";
1206 // user defined functions