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) {
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.search_column = 0;
491 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
492 var child_0 = new Xcls_reposStore( _this );
494 this.el.set_model ( child_0.el );
495 var child_1 = new Xcls_tv_autocommit( _this );
497 this.el.append_column ( child_1.el );
498 var child_2 = new Xcls_tv_autopush( _this );
500 this.el.append_column ( child_2.el );
501 var child_3 = new Xcls_tv_autobranch( _this );
503 this.el.append_column ( child_3.el );
504 var child_4 = new Xcls_tv_repo( _this );
506 this.el.append_column ( child_4.el );
507 var child_5 = new Xcls_tv_active_ticket( _this );
509 this.el.append_column ( child_5.el );
510 var child_6 = new Xcls_tv_current_branch( _this );
512 this.el.append_column ( child_6.el );
513 var child_7 = new Xcls_tv_last_updated( _this );
515 this.el.append_column ( child_7.el );
516 var child_8 = new Xcls_tv_all_branches( _this );
518 this.el.append_column ( child_8.el );
523 var selection = this.el.get_selection();
524 selection.set_mode( Gtk.SelectionMode.SINGLE);
527 var description = new Pango.FontDescription();
528 description.set_size(10000);
529 this.el.override_font(description);
534 this.el.cursor_changed.connect( () => {
535 // SEE SELECTION.CHANGED
540 if (this.el.get_selection().count_selected_rows() < 1) {
541 //nothing? - clea it?
545 var model = this.get('/changedFilesStore');
547 var s = this.el.get_selection();
549 s.selected_foreach(function(model,p,iter) {
551 files.push( model.get_value(iter, 0).value.get_string());
554 this.get('/patchview').showDiff(files);
555 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
556 //print("OUT?" + value);// id..
557 // load the list in the right grid..
564 // user defined functions
566 public class Xcls_reposStore : Object
568 public Gtk.ListStore el;
569 private Clones _this;
575 public Xcls_reposStore(Clones _owner )
578 _this.reposStore = this;
579 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
580 typeof(string), // 1 current branch
581 typeof(string), // 2 all branch
582 typeof(string), // 3 updated
583 typeof(bool), // 4 auto commit
584 typeof(bool), // 5 auto push
585 typeof(string), // 6 repopath
586 typeof(string), // 7 color highlighting?
587 typeof(bool), // 8 auto branch,
588 typeof(string) // 9 active Ticket
593 // set gobject values
596 // user defined functions
599 //this.insert(citer,iter,0);
600 print("getting list");
601 var tr = GitRepo.list();
605 // fixme .. sort by last updated ...
608 for(var i =0 ; i < tr.length; i++) {
609 var repo = tr.index(i);
613 this.el.append(out iter);
616 //print(JSON.stringify(ret,null,4));
617 //tr[i].getBranches();
622 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
623 // print(JSON.stringify(hi,null,4));
624 // } catch(e) { print(e);}
626 this.el.set_value(iter, 0, repo.name );
627 this.el.set_value( iter, 1, repo.currentBranch.name );
628 this.el.set_value( iter, 2, repo.branchesToString() );
629 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
630 // function(e) { return e.name;
633 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
634 this.el.set_value(iter, 4, repo.is_autocommit() );
635 this.el.set_value(iter, 5, repo.is_autopush() );
636 this.el.set_value(iter, 6, repo.git_working_dir );
638 var cb = repo.currentBranch;
639 //print(JSON.stringify(cb,null,4));
642 if (cb.lastrev != cb.remoterev) {
645 if (tr[i].hasLocalChanges) {
648 if ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
652 this.el.set_value(iter, 7, col );
653 var ticket = repo.activeTicket;
655 this.el.set_value(iter, 8, repo.is_auto_branch() );
656 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
660 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
664 public class Xcls_tv_autocommit : Object
666 public Gtk.TreeViewColumn el;
667 private Clones _this;
673 public Xcls_tv_autocommit(Clones _owner )
676 _this.tv_autocommit = this;
677 this.el = new Gtk.TreeViewColumn();
681 // set gobject values
682 this.el.title = "Auto Commit";
683 this.el.min_width = 50;
684 var child_0 = new Xcls_cr_autocommit( _this );
686 this.el.pack_start ( child_0.el , false );
690 // this.items[0].el.set_activatable(true);
691 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
694 // user defined functions
696 public class Xcls_cr_autocommit : Object
698 public Gtk.CellRendererToggle el;
699 private Clones _this;
705 public Xcls_cr_autocommit(Clones _owner )
708 _this.cr_autocommit = this;
709 this.el = new Gtk.CellRendererToggle();
713 // set gobject values
714 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
717 this.el.toggled.connect( (self, path) => {
720 _this.reposStore.el.get_iter_from_string(out iter, path);
724 _this.reposStore.el.get_value(iter, 4, out val);
725 _this.reposStore.el.get_value(iter, 6, out rval);
727 var repopath = (string)rval;
728 var bval = (bool)val;
729 _this.reposStore.el.set_value(iter, 4, !bval);
730 GLib.debug("got repopath? %s", repopath);
732 var repo = GitRepo.get(repopath);
733 repo.set_autocommit(!bval);
741 // user defined functions
745 public class Xcls_tv_autopush : Object
747 public Gtk.TreeViewColumn el;
748 private Clones _this;
754 public Xcls_tv_autopush(Clones _owner )
757 _this.tv_autopush = this;
758 this.el = new Gtk.TreeViewColumn();
762 // set gobject values
763 this.el.title = "Auto Push";
764 this.el.min_width = 50;
765 var child_0 = new Xcls_cr_autopush( _this );
767 this.el.pack_start ( child_0.el , false );
771 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
772 // this.items[0].el.set_activatable(true);
775 // user defined functions
777 public class Xcls_cr_autopush : Object
779 public Gtk.CellRendererToggle el;
780 private Clones _this;
786 public Xcls_cr_autopush(Clones _owner )
789 _this.cr_autopush = this;
790 this.el = new Gtk.CellRendererToggle();
794 // set gobject values
795 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
798 this.el.toggled.connect( (self, path) => {
801 _this.reposStore.el.get_iter_from_string(out iter, path);
805 _this.reposStore.el.get_value(iter, 5, out val);
806 _this.reposStore.el.get_value(iter, 6, out rval);
808 var repopath = (string)rval;
809 var bval = (bool)val;
810 _this.reposStore.el.set_value(iter, 5, !bval);
811 var repo = GitRepo.get(repopath);
812 repo.set_autopush(!bval);
820 // user defined functions
824 public class Xcls_tv_autobranch : Object
826 public Gtk.TreeViewColumn el;
827 private Clones _this;
833 public Xcls_tv_autobranch(Clones _owner )
836 _this.tv_autobranch = this;
837 this.el = new Gtk.TreeViewColumn();
841 // set gobject values
842 this.el.title = "Auto Branch";
843 this.el.min_width = 50;
844 var child_0 = new Xcls_cr_autobranch( _this );
846 this.el.pack_start ( child_0.el , false );
850 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
851 // this.items[0].el.set_activatable(true);
854 // user defined functions
856 public class Xcls_cr_autobranch : Object
858 public Gtk.CellRendererToggle el;
859 private Clones _this;
865 public Xcls_cr_autobranch(Clones _owner )
868 _this.cr_autobranch = this;
869 this.el = new Gtk.CellRendererToggle();
873 // set gobject values
874 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
877 this.el.toggled.connect( (self, path) => {
880 _this.reposStore.el.get_iter_from_string(out iter, path);
884 _this.reposStore.el.get_value(iter, 8, out val);
885 _this.reposStore.el.get_value(iter, 6, out rval);
887 var repopath = (string)rval;
888 var bval = (bool)val;
889 _this.reposStore.el.set_value(iter, 8, !bval);
890 var repo = GitRepo.get(repopath);
891 repo.set_auto_branch(!bval);
899 // user defined functions
903 public class Xcls_tv_repo : Object
905 public Gtk.TreeViewColumn el;
906 private Clones _this;
912 public Xcls_tv_repo(Clones _owner )
915 _this.tv_repo = this;
916 this.el = new Gtk.TreeViewColumn();
920 // set gobject values
921 this.el.sort_column_id = 0;
922 this.el.title = "Repo";
923 this.el.min_width = 200;
924 this.el.sort_order = Gtk.SortType.ASCENDING;
925 this.el.resizable = true;
926 var child_0 = new Xcls_cr_repo( _this );
928 this.el.pack_start ( child_0.el , false );
932 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
935 // user defined functions
937 public class Xcls_cr_repo : Object
939 public Gtk.CellRendererText el;
940 private Clones _this;
946 public Xcls_cr_repo(Clones _owner )
949 _this.cr_repo = this;
950 this.el = new Gtk.CellRendererText();
954 // set gobject values
957 // user defined functions
961 public class Xcls_tv_active_ticket : Object
963 public Gtk.TreeViewColumn el;
964 private Clones _this;
970 public Xcls_tv_active_ticket(Clones _owner )
973 _this.tv_active_ticket = this;
974 this.el = new Gtk.TreeViewColumn();
978 // set gobject values
979 this.el.title = "Active Ticket";
980 this.el.min_width = 50;
981 var child_0 = new Xcls_cr_active_ticket( _this );
983 this.el.pack_start ( child_0.el , false );
987 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
990 // user defined functions
992 public class Xcls_cr_active_ticket : Object
994 public Gtk.CellRendererText el;
995 private Clones _this;
1001 public Xcls_cr_active_ticket(Clones _owner )
1004 _this.cr_active_ticket = this;
1005 this.el = new Gtk.CellRendererText();
1009 // set gobject values
1012 // user defined functions
1016 public class Xcls_tv_current_branch : Object
1018 public Gtk.TreeViewColumn el;
1019 private Clones _this;
1025 public Xcls_tv_current_branch(Clones _owner )
1028 _this.tv_current_branch = this;
1029 this.el = new Gtk.TreeViewColumn();
1033 // set gobject values
1034 this.el.title = "Current Branch";
1035 this.el.min_width = 50;
1036 var child_0 = new Xcls_cr_current_branch( _this );
1038 this.el.pack_start ( child_0.el , false );
1042 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
1043 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
1046 // user defined functions
1048 public class Xcls_cr_current_branch : Object
1050 public Gtk.CellRendererText el;
1051 private Clones _this;
1057 public Xcls_cr_current_branch(Clones _owner )
1060 _this.cr_current_branch = this;
1061 this.el = new Gtk.CellRendererText();
1065 // set gobject values
1068 // user defined functions
1072 public class Xcls_tv_last_updated : Object
1074 public Gtk.TreeViewColumn el;
1075 private Clones _this;
1081 public Xcls_tv_last_updated(Clones _owner )
1084 _this.tv_last_updated = this;
1085 this.el = new Gtk.TreeViewColumn();
1089 // set gobject values
1090 this.el.title = "Last updated";
1091 this.el.min_width = 50;
1092 var child_0 = new Xcls_cr_last_updated( _this );
1094 this.el.pack_start ( child_0.el , false );
1098 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
1101 // user defined functions
1103 public class Xcls_cr_last_updated : Object
1105 public Gtk.CellRendererText el;
1106 private Clones _this;
1112 public Xcls_cr_last_updated(Clones _owner )
1115 _this.cr_last_updated = this;
1116 this.el = new Gtk.CellRendererText();
1120 // set gobject values
1123 // user defined functions
1127 public class Xcls_tv_all_branches : Object
1129 public Gtk.TreeViewColumn el;
1130 private Clones _this;
1136 public Xcls_tv_all_branches(Clones _owner )
1139 _this.tv_all_branches = this;
1140 this.el = new Gtk.TreeViewColumn();
1144 // set gobject values
1145 this.el.title = "All Branches";
1146 this.el.min_width = 50;
1147 this.el.resizable = false;
1148 var child_0 = new Xcls_cr_all_branches( _this );
1150 this.el.pack_start ( child_0.el , false );
1154 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
1157 // user defined functions
1159 public class Xcls_cr_all_branches : Object
1161 public Gtk.CellRendererText el;
1162 private Clones _this;
1168 public Xcls_cr_all_branches(Clones _owner )
1171 _this.cr_all_branches = this;
1172 this.el = new Gtk.CellRendererText();
1176 // set gobject values
1179 // user defined functions
1186 public class Xcls_ok_button : Object
1188 public Gtk.Button el;
1189 private Clones _this;
1195 public Xcls_ok_button(Clones _owner )
1198 _this.ok_button = this;
1199 this.el = new Gtk.Button();
1203 // set gobject values
1204 this.el.expand = false;
1205 this.el.label = "Close";
1208 // user defined functions