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.reposView;
324 var rs = _this.reposStore;
325 var s =rv.el.get_selection();
326 if (s.count_selected_rows() != 1) {
331 s.get_selected(out tm, out iter);
333 tm.get_value(iter, 6, out val);
334 var git_working_dir = (string)val;
336 var repo = GitRepo.singleton.get(git_working_dir);
338 // if you hit merge.... in master..
340 if (repo.currentBranch.name == "master") {
343 MergeBranch.singleton().show(repo.ticket);
350 var s = rv.el.get_selection();
352 s.selected_foreach(function(model,p,iter) {
354 path = model.get_value(iter, 6).value.get_string();
359 rs.repos.forEach(function(r) {
360 if (r.repopath == path) {
367 Merger.el.set_transient_for(Clones.el);
368 Clones.el.set_title("Manage Clones - " + repo.repopath);
370 Clones.el.set_title("Manage Clones");
384 // user defined functions
387 public class Xcls_Button7 : Object
389 public Gtk.Button el;
390 private Clones _this;
396 public Xcls_Button7(Clones _owner )
399 this.el = new Gtk.Button();
403 // set gobject values
404 this.el.label = "Switch Branch";
407 this.el.clicked.connect( () => {
417 // user defined functions
420 public class Xcls_Button8 : Object
422 public Gtk.Button el;
423 private Clones _this;
429 public Xcls_Button8(Clones _owner )
432 this.el = new Gtk.Button();
436 // set gobject values
437 this.el.label = "Pull";
440 this.el.clicked.connect( () => {
450 // user defined functions
454 public class Xcls_ScrolledWindow9 : Object
456 public Gtk.ScrolledWindow el;
457 private Clones _this;
463 public Xcls_ScrolledWindow9(Clones _owner )
466 this.el = new Gtk.ScrolledWindow( null, null );
470 // set gobject values
471 this.el.expand = true;
472 this.el.hexpand = true;
473 this.el.shadow_type = Gtk.ShadowType.IN;
474 var child_0 = new Xcls_reposView( _this );
476 this.el.add ( child_0.el );
482 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
486 // user defined functions
488 public class Xcls_reposView : Object
490 public Gtk.TreeView el;
491 private Clones _this;
497 public Xcls_reposView(Clones _owner )
500 _this.reposView = this;
501 this.el = new Gtk.TreeView();
505 // set gobject values
506 this.el.search_column = 0;
507 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
508 var child_0 = new Xcls_reposStore( _this );
510 this.el.set_model ( child_0.el );
511 var child_1 = new Xcls_tv_autocommit( _this );
513 this.el.append_column ( child_1.el );
514 var child_2 = new Xcls_tv_autopush( _this );
516 this.el.append_column ( child_2.el );
517 var child_3 = new Xcls_tv_autobranch( _this );
519 this.el.append_column ( child_3.el );
520 var child_4 = new Xcls_tv_repo( _this );
522 this.el.append_column ( child_4.el );
523 var child_5 = new Xcls_tv_active_ticket( _this );
525 this.el.append_column ( child_5.el );
526 var child_6 = new Xcls_tv_current_branch( _this );
528 this.el.append_column ( child_6.el );
529 var child_7 = new Xcls_tv_last_updated( _this );
531 this.el.append_column ( child_7.el );
532 var child_8 = new Xcls_tv_all_branches( _this );
534 this.el.append_column ( child_8.el );
539 var selection = this.el.get_selection();
540 selection.set_mode( Gtk.SelectionMode.SINGLE);
543 var description = new Pango.FontDescription();
544 description.set_size(10000);
545 this.el.override_font(description);
550 this.el.cursor_changed.connect( () => {
551 // SEE SELECTION.CHANGED
556 if (this.el.get_selection().count_selected_rows() < 1) {
557 //nothing? - clea it?
561 var model = this.get('/changedFilesStore');
563 var s = this.el.get_selection();
565 s.selected_foreach(function(model,p,iter) {
567 files.push( model.get_value(iter, 0).value.get_string());
570 this.get('/patchview').showDiff(files);
571 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
572 //print("OUT?" + value);// id..
573 // load the list in the right grid..
580 // user defined functions
582 public class Xcls_reposStore : Object
584 public Gtk.ListStore el;
585 private Clones _this;
591 public Xcls_reposStore(Clones _owner )
594 _this.reposStore = this;
595 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
596 typeof(string), // 1 current branch
597 typeof(string), // 2 all branch
598 typeof(string), // 3 updated
599 typeof(bool), // 4 auto commit
600 typeof(bool), // 5 auto push
601 typeof(string), // 6 repopath
602 typeof(string), // 7 color highlighting?
603 typeof(bool), // 8 auto branch,
604 typeof(string) // 9 active Ticket
609 // set gobject values
612 // user defined functions
615 //this.insert(citer,iter,0);
616 print("getting list");
617 var tr = GitRepo.list();
621 // fixme .. sort by last updated ...
624 for(var i =0 ; i < tr.length; i++) {
625 var repo = tr.index(i);
629 this.el.append(out iter);
632 //print(JSON.stringify(ret,null,4));
633 //tr[i].getBranches();
638 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
639 // print(JSON.stringify(hi,null,4));
640 // } catch(e) { print(e);}
642 this.el.set_value(iter, 0, repo.name );
643 this.el.set_value( iter, 1, repo.currentBranch.name );
644 this.el.set_value( iter, 2, repo.branchesToString() );
645 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
646 // function(e) { return e.name;
649 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
650 this.el.set_value(iter, 4, repo.is_autocommit() );
651 this.el.set_value(iter, 5, repo.is_autopush() );
652 this.el.set_value(iter, 6, repo.git_working_dir );
654 var cb = repo.currentBranch;
655 //print(JSON.stringify(cb,null,4));
658 if (cb.lastrev != cb.remoterev) {
661 if (tr[i].hasLocalChanges) {
664 if ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
668 this.el.set_value(iter, 7, col );
669 var ticket = repo.activeTicket;
671 this.el.set_value(iter, 8, repo.is_auto_branch() );
672 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
676 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
680 public class Xcls_tv_autocommit : Object
682 public Gtk.TreeViewColumn el;
683 private Clones _this;
689 public Xcls_tv_autocommit(Clones _owner )
692 _this.tv_autocommit = this;
693 this.el = new Gtk.TreeViewColumn();
697 // set gobject values
698 this.el.title = "Auto Commit";
699 this.el.min_width = 50;
700 var child_0 = new Xcls_cr_autocommit( _this );
702 this.el.pack_start ( child_0.el , false );
706 // this.items[0].el.set_activatable(true);
707 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
710 // user defined functions
712 public class Xcls_cr_autocommit : Object
714 public Gtk.CellRendererToggle el;
715 private Clones _this;
721 public Xcls_cr_autocommit(Clones _owner )
724 _this.cr_autocommit = this;
725 this.el = new Gtk.CellRendererToggle();
729 // set gobject values
730 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
733 this.el.toggled.connect( (self, path) => {
736 _this.reposStore.el.get_iter_from_string(out iter, path);
740 _this.reposStore.el.get_value(iter, 4, out val);
741 _this.reposStore.el.get_value(iter, 6, out rval);
743 var repopath = (string)rval;
744 var bval = (bool)val;
745 _this.reposStore.el.set_value(iter, 4, !bval);
746 GLib.debug("got repopath? %s", repopath);
748 var repo = GitRepo.get(repopath);
749 repo.set_autocommit(!bval);
757 // user defined functions
761 public class Xcls_tv_autopush : Object
763 public Gtk.TreeViewColumn el;
764 private Clones _this;
770 public Xcls_tv_autopush(Clones _owner )
773 _this.tv_autopush = this;
774 this.el = new Gtk.TreeViewColumn();
778 // set gobject values
779 this.el.title = "Auto Push";
780 this.el.min_width = 50;
781 var child_0 = new Xcls_cr_autopush( _this );
783 this.el.pack_start ( child_0.el , false );
787 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
788 // this.items[0].el.set_activatable(true);
791 // user defined functions
793 public class Xcls_cr_autopush : Object
795 public Gtk.CellRendererToggle el;
796 private Clones _this;
802 public Xcls_cr_autopush(Clones _owner )
805 _this.cr_autopush = this;
806 this.el = new Gtk.CellRendererToggle();
810 // set gobject values
811 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
814 this.el.toggled.connect( (self, path) => {
817 _this.reposStore.el.get_iter_from_string(out iter, path);
821 _this.reposStore.el.get_value(iter, 5, out val);
822 _this.reposStore.el.get_value(iter, 6, out rval);
824 var repopath = (string)rval;
825 var bval = (bool)val;
826 _this.reposStore.el.set_value(iter, 5, !bval);
827 var repo = GitRepo.get(repopath);
828 repo.set_autopush(!bval);
836 // user defined functions
840 public class Xcls_tv_autobranch : Object
842 public Gtk.TreeViewColumn el;
843 private Clones _this;
849 public Xcls_tv_autobranch(Clones _owner )
852 _this.tv_autobranch = this;
853 this.el = new Gtk.TreeViewColumn();
857 // set gobject values
858 this.el.title = "Auto Branch";
859 this.el.min_width = 50;
860 var child_0 = new Xcls_cr_autobranch( _this );
862 this.el.pack_start ( child_0.el , false );
866 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
867 // this.items[0].el.set_activatable(true);
870 // user defined functions
872 public class Xcls_cr_autobranch : Object
874 public Gtk.CellRendererToggle el;
875 private Clones _this;
881 public Xcls_cr_autobranch(Clones _owner )
884 _this.cr_autobranch = this;
885 this.el = new Gtk.CellRendererToggle();
889 // set gobject values
890 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
893 this.el.toggled.connect( (self, path) => {
896 _this.reposStore.el.get_iter_from_string(out iter, path);
900 _this.reposStore.el.get_value(iter, 8, out val);
901 _this.reposStore.el.get_value(iter, 6, out rval);
903 var repopath = (string)rval;
904 var bval = (bool)val;
905 _this.reposStore.el.set_value(iter, 8, !bval);
906 var repo = GitRepo.get(repopath);
907 repo.set_auto_branch(!bval);
915 // user defined functions
919 public class Xcls_tv_repo : Object
921 public Gtk.TreeViewColumn el;
922 private Clones _this;
928 public Xcls_tv_repo(Clones _owner )
931 _this.tv_repo = this;
932 this.el = new Gtk.TreeViewColumn();
936 // set gobject values
937 this.el.sort_column_id = 0;
938 this.el.title = "Repo";
939 this.el.min_width = 200;
940 this.el.sort_order = Gtk.SortType.ASCENDING;
941 this.el.resizable = true;
942 var child_0 = new Xcls_cr_repo( _this );
944 this.el.pack_start ( child_0.el , false );
948 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
951 // user defined functions
953 public class Xcls_cr_repo : Object
955 public Gtk.CellRendererText el;
956 private Clones _this;
962 public Xcls_cr_repo(Clones _owner )
965 _this.cr_repo = this;
966 this.el = new Gtk.CellRendererText();
970 // set gobject values
973 // user defined functions
977 public class Xcls_tv_active_ticket : Object
979 public Gtk.TreeViewColumn el;
980 private Clones _this;
986 public Xcls_tv_active_ticket(Clones _owner )
989 _this.tv_active_ticket = this;
990 this.el = new Gtk.TreeViewColumn();
994 // set gobject values
995 this.el.title = "Active Ticket";
996 this.el.min_width = 50;
997 var child_0 = new Xcls_cr_active_ticket( _this );
999 this.el.pack_start ( child_0.el , false );
1003 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
1006 // user defined functions
1008 public class Xcls_cr_active_ticket : Object
1010 public Gtk.CellRendererText el;
1011 private Clones _this;
1017 public Xcls_cr_active_ticket(Clones _owner )
1020 _this.cr_active_ticket = this;
1021 this.el = new Gtk.CellRendererText();
1025 // set gobject values
1028 // user defined functions
1032 public class Xcls_tv_current_branch : Object
1034 public Gtk.TreeViewColumn el;
1035 private Clones _this;
1041 public Xcls_tv_current_branch(Clones _owner )
1044 _this.tv_current_branch = this;
1045 this.el = new Gtk.TreeViewColumn();
1049 // set gobject values
1050 this.el.title = "Current Branch";
1051 this.el.min_width = 50;
1052 var child_0 = new Xcls_cr_current_branch( _this );
1054 this.el.pack_start ( child_0.el , false );
1058 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
1059 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
1062 // user defined functions
1064 public class Xcls_cr_current_branch : Object
1066 public Gtk.CellRendererText el;
1067 private Clones _this;
1073 public Xcls_cr_current_branch(Clones _owner )
1076 _this.cr_current_branch = this;
1077 this.el = new Gtk.CellRendererText();
1081 // set gobject values
1084 // user defined functions
1088 public class Xcls_tv_last_updated : Object
1090 public Gtk.TreeViewColumn el;
1091 private Clones _this;
1097 public Xcls_tv_last_updated(Clones _owner )
1100 _this.tv_last_updated = this;
1101 this.el = new Gtk.TreeViewColumn();
1105 // set gobject values
1106 this.el.title = "Last updated";
1107 this.el.min_width = 50;
1108 var child_0 = new Xcls_cr_last_updated( _this );
1110 this.el.pack_start ( child_0.el , false );
1114 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
1117 // user defined functions
1119 public class Xcls_cr_last_updated : Object
1121 public Gtk.CellRendererText el;
1122 private Clones _this;
1128 public Xcls_cr_last_updated(Clones _owner )
1131 _this.cr_last_updated = this;
1132 this.el = new Gtk.CellRendererText();
1136 // set gobject values
1139 // user defined functions
1143 public class Xcls_tv_all_branches : Object
1145 public Gtk.TreeViewColumn el;
1146 private Clones _this;
1152 public Xcls_tv_all_branches(Clones _owner )
1155 _this.tv_all_branches = this;
1156 this.el = new Gtk.TreeViewColumn();
1160 // set gobject values
1161 this.el.title = "All Branches";
1162 this.el.min_width = 50;
1163 this.el.resizable = false;
1164 var child_0 = new Xcls_cr_all_branches( _this );
1166 this.el.pack_start ( child_0.el , false );
1170 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
1173 // user defined functions
1175 public class Xcls_cr_all_branches : Object
1177 public Gtk.CellRendererText el;
1178 private Clones _this;
1184 public Xcls_cr_all_branches(Clones _owner )
1187 _this.cr_all_branches = this;
1188 this.el = new Gtk.CellRendererText();
1192 // set gobject values
1195 // user defined functions
1202 public class Xcls_ok_button : Object
1204 public Gtk.Button el;
1205 private Clones _this;
1211 public Xcls_ok_button(Clones _owner )
1214 _this.ok_button = this;
1215 this.el = new Gtk.Button();
1219 // set gobject values
1220 this.el.expand = false;
1221 this.el.label = "Close";
1224 // user defined functions