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 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
491 var child_0 = new Xcls_reposStore( _this );
493 this.el.set_model ( child_0.el );
494 var child_1 = new Xcls_tv_autocommit( _this );
496 this.el.append_column ( child_1.el );
497 var child_2 = new Xcls_tv_autopush( _this );
499 this.el.append_column ( child_2.el );
500 var child_3 = new Xcls_tv_autobranch( _this );
502 this.el.append_column ( child_3.el );
503 var child_4 = new Xcls_tv_repo( _this );
505 this.el.append_column ( child_4.el );
506 var child_5 = new Xcls_tv_active_ticket( _this );
508 this.el.append_column ( child_5.el );
509 var child_6 = new Xcls_tv_current_branch( _this );
511 this.el.append_column ( child_6.el );
512 var child_7 = new Xcls_tv_last_updated( _this );
514 this.el.append_column ( child_7.el );
515 var child_8 = new Xcls_tv_all_branches( _this );
517 this.el.append_column ( child_8.el );
522 var selection = this.el.get_selection();
523 selection.set_mode( Gtk.SelectionMode.SINGLE);
526 var description = new Pango.FontDescription();
527 description.set_size(10000);
528 this.el.override_font(description);
533 this.el.cursor_changed.connect( () => {
534 // SEE SELECTION.CHANGED
539 if (this.el.get_selection().count_selected_rows() < 1) {
540 //nothing? - clea it?
544 var model = this.get('/changedFilesStore');
546 var s = this.el.get_selection();
548 s.selected_foreach(function(model,p,iter) {
550 files.push( model.get_value(iter, 0).value.get_string());
553 this.get('/patchview').showDiff(files);
554 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
555 //print("OUT?" + value);// id..
556 // load the list in the right grid..
563 // user defined functions
565 public class Xcls_reposStore : Object
567 public Gtk.ListStore el;
568 private Clones _this;
574 public Xcls_reposStore(Clones _owner )
577 _this.reposStore = this;
578 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
579 typeof(string), // 1 current branch
580 typeof(string), // 2 all branch
581 typeof(string), // 3 updated
582 typeof(bool), // 4 auto commit
583 typeof(bool), // 5 auto push
584 typeof(string), // 6 repopath
585 typeof(string), // 7 color highlighting?
586 typeof(bool), // 8 auto branch,
587 typeof(string) // 9 active Ticket
592 // set gobject values
595 // user defined functions
598 //this.insert(citer,iter,0);
599 print("getting list");
600 var tr = GitRepo.list();
604 // fixme .. sort by last updated ...
607 for(var i =0 ; i < tr.length; i++) {
608 var repo = tr.index(i);
612 this.el.append(out iter);
615 //print(JSON.stringify(ret,null,4));
616 //tr[i].getBranches();
621 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
622 // print(JSON.stringify(hi,null,4));
623 // } catch(e) { print(e);}
625 this.el.set_value(iter, 0, repo.name );
626 this.el.set_value( iter, 1, repo.currentBranch.name );
627 this.el.set_value( iter, 2, repo.branchesToString() );
628 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
629 // function(e) { return e.name;
632 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
633 this.el.set_value(iter, 4, repo.is_autocommit() );
634 this.el.set_value(iter, 5, repo.is_autopush() );
635 this.el.set_value(iter, 6, repo.git_working_dir );
637 var cb = repo.currentBranch;
638 //print(JSON.stringify(cb,null,4));
641 if (cb.lastrev != cb.remoterev) {
644 if (tr[i].hasLocalChanges) {
647 if ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
651 this.el.set_value(iter, 7, col );
652 var ticket = repo.activeTicket;
654 this.el.set_value(iter, 8, repo.is_auto_branch() );
655 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
659 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
663 public class Xcls_tv_autocommit : Object
665 public Gtk.TreeViewColumn el;
666 private Clones _this;
672 public Xcls_tv_autocommit(Clones _owner )
675 _this.tv_autocommit = this;
676 this.el = new Gtk.TreeViewColumn();
680 // set gobject values
681 this.el.title = "Auto Commit";
682 this.el.min_width = 50;
683 var child_0 = new Xcls_cr_autocommit( _this );
685 this.el.pack_start ( child_0.el , false );
689 // this.items[0].el.set_activatable(true);
690 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
693 // user defined functions
695 public class Xcls_cr_autocommit : Object
697 public Gtk.CellRendererToggle el;
698 private Clones _this;
704 public Xcls_cr_autocommit(Clones _owner )
707 _this.cr_autocommit = this;
708 this.el = new Gtk.CellRendererToggle();
712 // set gobject values
713 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
716 this.el.toggled.connect( (self, path) => {
719 _this.reposStore.el.get_iter_from_string(out iter, path);
723 _this.reposStore.el.get_value(iter, 4, out val);
724 _this.reposStore.el.get_value(iter, 6, out rval);
726 var repopath = (string)rval;
727 var bval = (bool)val;
728 _this.reposStore.el.set_value(iter, 4, !bval);
729 GLib.debug("got repopath? %s", repopath);
731 var repo = GitRepo.get(repopath);
732 repo.set_autocommit(!bval);
740 // user defined functions
744 public class Xcls_tv_autopush : Object
746 public Gtk.TreeViewColumn el;
747 private Clones _this;
753 public Xcls_tv_autopush(Clones _owner )
756 _this.tv_autopush = this;
757 this.el = new Gtk.TreeViewColumn();
761 // set gobject values
762 this.el.title = "Auto Push";
763 this.el.min_width = 50;
764 var child_0 = new Xcls_cr_autopush( _this );
766 this.el.pack_start ( child_0.el , false );
770 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
771 // this.items[0].el.set_activatable(true);
774 // user defined functions
776 public class Xcls_cr_autopush : Object
778 public Gtk.CellRendererToggle el;
779 private Clones _this;
785 public Xcls_cr_autopush(Clones _owner )
788 _this.cr_autopush = this;
789 this.el = new Gtk.CellRendererToggle();
793 // set gobject values
794 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
797 this.el.toggled.connect( (self, path) => {
800 _this.reposStore.el.get_iter_from_string(out iter, path);
804 _this.reposStore.el.get_value(iter, 5, out val);
805 _this.reposStore.el.get_value(iter, 6, out rval);
807 var repopath = (string)rval;
808 var bval = (bool)val;
809 _this.reposStore.el.set_value(iter, 5, !bval);
810 var repo = GitRepo.get(repopath);
811 repo.set_autopush(!bval);
819 // user defined functions
823 public class Xcls_tv_autobranch : Object
825 public Gtk.TreeViewColumn el;
826 private Clones _this;
832 public Xcls_tv_autobranch(Clones _owner )
835 _this.tv_autobranch = this;
836 this.el = new Gtk.TreeViewColumn();
840 // set gobject values
841 this.el.title = "Auto Branch";
842 this.el.min_width = 50;
843 var child_0 = new Xcls_cr_autobranch( _this );
845 this.el.pack_start ( child_0.el , false );
849 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
850 // this.items[0].el.set_activatable(true);
853 // user defined functions
855 public class Xcls_cr_autobranch : Object
857 public Gtk.CellRendererToggle el;
858 private Clones _this;
864 public Xcls_cr_autobranch(Clones _owner )
867 _this.cr_autobranch = this;
868 this.el = new Gtk.CellRendererToggle();
872 // set gobject values
873 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
876 this.el.toggled.connect( (self, path) => {
879 _this.reposStore.el.get_iter_from_string(out iter, path);
883 _this.reposStore.el.get_value(iter, 8, out val);
884 _this.reposStore.el.get_value(iter, 6, out rval);
886 var repopath = (string)rval;
887 var bval = (bool)val;
888 _this.reposStore.el.set_value(iter, 8, !bval);
889 var repo = GitRepo.get(repopath);
890 repo.set_auto_branch(!bval);
898 // user defined functions
902 public class Xcls_tv_repo : Object
904 public Gtk.TreeViewColumn el;
905 private Clones _this;
911 public Xcls_tv_repo(Clones _owner )
914 _this.tv_repo = this;
915 this.el = new Gtk.TreeViewColumn();
919 // set gobject values
920 this.el.sort_column_id = 0;
921 this.el.title = "Repo";
922 this.el.min_width = 200;
923 this.el.sort_order = Gtk.SortType.ASCENDING;
924 this.el.resizable = true;
925 var child_0 = new Xcls_cr_repo( _this );
927 this.el.pack_start ( child_0.el , false );
931 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
934 // user defined functions
936 public class Xcls_cr_repo : Object
938 public Gtk.CellRendererText el;
939 private Clones _this;
945 public Xcls_cr_repo(Clones _owner )
948 _this.cr_repo = this;
949 this.el = new Gtk.CellRendererText();
953 // set gobject values
956 // user defined functions
960 public class Xcls_tv_active_ticket : Object
962 public Gtk.TreeViewColumn el;
963 private Clones _this;
969 public Xcls_tv_active_ticket(Clones _owner )
972 _this.tv_active_ticket = this;
973 this.el = new Gtk.TreeViewColumn();
977 // set gobject values
978 this.el.title = "Active Ticket";
979 this.el.min_width = 50;
980 var child_0 = new Xcls_cr_active_ticket( _this );
982 this.el.pack_start ( child_0.el , false );
986 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
989 // user defined functions
991 public class Xcls_cr_active_ticket : Object
993 public Gtk.CellRendererText el;
994 private Clones _this;
1000 public Xcls_cr_active_ticket(Clones _owner )
1003 _this.cr_active_ticket = this;
1004 this.el = new Gtk.CellRendererText();
1008 // set gobject values
1011 // user defined functions
1015 public class Xcls_tv_current_branch : Object
1017 public Gtk.TreeViewColumn el;
1018 private Clones _this;
1024 public Xcls_tv_current_branch(Clones _owner )
1027 _this.tv_current_branch = this;
1028 this.el = new Gtk.TreeViewColumn();
1032 // set gobject values
1033 this.el.title = "Current Branch";
1034 this.el.min_width = 50;
1035 var child_0 = new Xcls_cr_current_branch( _this );
1037 this.el.pack_start ( child_0.el , false );
1041 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
1042 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
1045 // user defined functions
1047 public class Xcls_cr_current_branch : Object
1049 public Gtk.CellRendererText el;
1050 private Clones _this;
1056 public Xcls_cr_current_branch(Clones _owner )
1059 _this.cr_current_branch = this;
1060 this.el = new Gtk.CellRendererText();
1064 // set gobject values
1067 // user defined functions
1071 public class Xcls_tv_last_updated : Object
1073 public Gtk.TreeViewColumn el;
1074 private Clones _this;
1080 public Xcls_tv_last_updated(Clones _owner )
1083 _this.tv_last_updated = this;
1084 this.el = new Gtk.TreeViewColumn();
1088 // set gobject values
1089 this.el.title = "Last updated";
1090 this.el.min_width = 50;
1091 var child_0 = new Xcls_cr_last_updated( _this );
1093 this.el.pack_start ( child_0.el , false );
1097 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
1100 // user defined functions
1102 public class Xcls_cr_last_updated : Object
1104 public Gtk.CellRendererText el;
1105 private Clones _this;
1111 public Xcls_cr_last_updated(Clones _owner )
1114 _this.cr_last_updated = this;
1115 this.el = new Gtk.CellRendererText();
1119 // set gobject values
1122 // user defined functions
1126 public class Xcls_tv_all_branches : Object
1128 public Gtk.TreeViewColumn el;
1129 private Clones _this;
1135 public Xcls_tv_all_branches(Clones _owner )
1138 _this.tv_all_branches = this;
1139 this.el = new Gtk.TreeViewColumn();
1143 // set gobject values
1144 this.el.title = "All Branches";
1145 this.el.min_width = 50;
1146 this.el.resizable = false;
1147 var child_0 = new Xcls_cr_all_branches( _this );
1149 this.el.pack_start ( child_0.el , false );
1153 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
1156 // user defined functions
1158 public class Xcls_cr_all_branches : Object
1160 public Gtk.CellRendererText el;
1161 private Clones _this;
1167 public Xcls_cr_all_branches(Clones _owner )
1170 _this.cr_all_branches = this;
1171 this.el = new Gtk.CellRendererText();
1175 // set gobject values
1178 // user defined functions
1185 public class Xcls_ok_button : Object
1187 public Gtk.Button el;
1188 private Clones _this;
1194 public Xcls_ok_button(Clones _owner )
1197 _this.ok_button = this;
1198 this.el = new Gtk.Button();
1202 // set gobject values
1203 this.el.expand = false;
1204 this.el.label = "Close";
1207 // user defined functions