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(false);
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_ScrolledWindow10( _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 var child_0 = new Xcls_Button4( _this );
147 this.el.add ( child_0.el );
148 var child_1 = new Xcls_Button5( _this );
150 this.el.add ( child_1.el );
151 var child_2 = new Xcls_Button6( _this );
153 this.el.add ( child_2.el );
154 var child_3 = new Xcls_Button7( _this );
156 this.el.add ( child_3.el );
157 var child_4 = new Xcls_Button8( _this );
159 this.el.add ( child_4.el );
160 var child_5 = new Xcls_Button9( _this );
162 this.el.add ( child_5.el );
165 // user defined functions
167 public class Xcls_Button4 : Object
169 public Gtk.Button el;
170 private Clones _this;
176 public Xcls_Button4(Clones _owner )
179 this.el = new Gtk.Button();
183 // set gobject values
184 this.el.label = "Remotes / Clones";
187 this.el.clicked.connect( () => {
189 /* var rv = this.get('/reposView');
190 var rs = this.get('/reposStore');
191 if (rv.el.get_selection().count_selected_rows() != 1) {
196 var Remotes = imports.Remotes.Remotes;
200 var s = rv.el.get_selection();
202 s.selected_foreach(function(model,p,iter) {
204 path = model.get_value(iter, 6).value.get_string();
209 rs.repos.forEach(function(r) {
210 if (r.repopath == path) {
217 Remotes.el.set_transient_for(Clones.el);
218 Clones.el.set_title("Manage Clones - " + repo.repopath);
220 Clones.el.set_title("Manage Clones");
232 // user defined functions
235 public class Xcls_Button5 : Object
237 public Gtk.Button el;
238 private Clones _this;
244 public Xcls_Button5(Clones _owner )
247 this.el = new Gtk.Button();
251 // set gobject values
252 this.el.label = "Branches";
255 this.el.clicked.connect( () => {
258 //NewBranch.singleton().show();
261 var rv = this.get('/reposView');
262 var rs = this.get('/reposStore');
263 if (rv.el.get_selection().count_selected_rows() != 1) {
268 var Branches = imports.Branches.Branches;
272 var s = rv.el.get_selection();
274 s.selected_foreach(function(model,p,iter) {
276 path = model.get_value(iter, 6).value.get_string();
281 rs.repos.forEach(function(r) {
282 if (r.repopath == path) {
288 Branches.repo = repo;
289 Branches.el.set_transient_for(Clones.el);
290 Clones.el.set_title("Manage Clones - " + repo.repopath);
292 Clones.el.set_title("Manage Clones");
305 // user defined functions
308 public class Xcls_Button6 : Object
310 public Gtk.Button el;
311 private Clones _this;
317 public Xcls_Button6(Clones _owner )
320 this.el = new Gtk.Button();
324 // set gobject values
325 this.el.label = "Merge";
328 this.el.clicked.connect( () => {
330 var rv = _this.reposView;
331 var rs = _this.reposStore;
332 var s =rv.el.get_selection();
333 if (s.count_selected_rows() != 1) {
338 s.get_selected(out tm, out iter);
340 tm.get_value(iter, 6, out val);
341 var git_working_dir = (string)val;
343 var repo = GitRepo.singleton().get(git_working_dir);
345 // if you hit merge.... in master..
347 if (repo.currentBranch.name == "master") {
350 MergeBranch.singleton().show(repo.activeTicket, repo);
351 _this.reposStore.load();
358 // user defined functions
361 public class Xcls_Button7 : Object
363 public Gtk.Button el;
364 private Clones _this;
370 public Xcls_Button7(Clones _owner )
373 this.el = new Gtk.Button();
377 // set gobject values
378 this.el.label = "Switch Branch";
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
427 public class Xcls_Button9 : Object
429 public Gtk.Button el;
430 private Clones _this;
436 public Xcls_Button9(Clones _owner )
439 this.el = new Gtk.Button();
443 // set gobject values
444 this.el.expand = false;
445 this.el.label = "Close";
448 // user defined functions
452 public class Xcls_ScrolledWindow10 : Object
454 public Gtk.ScrolledWindow el;
455 private Clones _this;
461 public Xcls_ScrolledWindow10(Clones _owner )
464 this.el = new Gtk.ScrolledWindow( null, null );
468 // set gobject values
469 this.el.expand = true;
470 this.el.hexpand = true;
471 this.el.shadow_type = Gtk.ShadowType.IN;
472 var child_0 = new Xcls_reposView( _this );
474 this.el.add ( child_0.el );
480 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
484 // user defined functions
486 public class Xcls_reposView : Object
488 public Gtk.TreeView el;
489 private Clones _this;
495 public Xcls_reposView(Clones _owner )
498 _this.reposView = this;
499 this.el = new Gtk.TreeView();
503 // set gobject values
504 this.el.search_column = 0;
505 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
506 var child_0 = new Xcls_reposStore( _this );
508 this.el.set_model ( child_0.el );
509 var child_1 = new Xcls_tv_autocommit( _this );
511 this.el.append_column ( child_1.el );
512 var child_2 = new Xcls_tv_autopush( _this );
514 this.el.append_column ( child_2.el );
515 var child_3 = new Xcls_tv_autobranch( _this );
517 this.el.append_column ( child_3.el );
518 var child_4 = new Xcls_tv_repo( _this );
520 this.el.append_column ( child_4.el );
521 var child_5 = new Xcls_tv_active_ticket( _this );
523 this.el.append_column ( child_5.el );
524 var child_6 = new Xcls_tv_current_branch( _this );
526 this.el.append_column ( child_6.el );
527 var child_7 = new Xcls_tv_last_updated( _this );
529 this.el.append_column ( child_7.el );
530 var child_8 = new Xcls_tv_all_branches( _this );
532 this.el.append_column ( child_8.el );
537 var selection = this.el.get_selection();
538 selection.set_mode( Gtk.SelectionMode.SINGLE);
541 var description = new Pango.FontDescription();
542 description.set_size(10000);
543 this.el.override_font(description);
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);
627 this.el.append(out iter);
630 //print(JSON.stringify(ret,null,4));
631 //tr[i].getBranches();
636 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
637 // print(JSON.stringify(hi,null,4));
638 // } catch(e) { print(e);}
640 this.el.set_value(iter, 0, repo.name );
641 this.el.set_value( iter, 1, repo.currentBranch.name );
642 this.el.set_value( iter, 2, repo.branchesToString() );
643 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
644 // function(e) { return e.name;
647 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
648 this.el.set_value(iter, 4, repo.is_autocommit() );
649 this.el.set_value(iter, 5, repo.is_autopush() );
650 this.el.set_value(iter, 6, repo.git_working_dir );
652 var cb = repo.currentBranch;
653 //print(JSON.stringify(cb,null,4));
656 if (cb.lastrev != cb.remoterev) {
659 if (tr[i].hasLocalChanges) {
662 if ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
666 this.el.set_value(iter, 7, col );
667 var ticket = repo.activeTicket;
669 this.el.set_value(iter, 8, repo.is_auto_branch() );
670 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
674 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
678 public class Xcls_tv_autocommit : Object
680 public Gtk.TreeViewColumn el;
681 private Clones _this;
687 public Xcls_tv_autocommit(Clones _owner )
690 _this.tv_autocommit = this;
691 this.el = new Gtk.TreeViewColumn();
695 // set gobject values
696 this.el.title = "Auto Commit";
697 this.el.min_width = 50;
698 var child_0 = new Xcls_cr_autocommit( _this );
700 this.el.pack_start ( child_0.el , false );
704 // this.items[0].el.set_activatable(true);
705 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
708 // user defined functions
710 public class Xcls_cr_autocommit : Object
712 public Gtk.CellRendererToggle el;
713 private Clones _this;
719 public Xcls_cr_autocommit(Clones _owner )
722 _this.cr_autocommit = this;
723 this.el = new Gtk.CellRendererToggle();
727 // set gobject values
728 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
731 this.el.toggled.connect( (self, path) => {
734 _this.reposStore.el.get_iter_from_string(out iter, path);
738 _this.reposStore.el.get_value(iter, 4, out val);
739 _this.reposStore.el.get_value(iter, 6, out rval);
741 var repopath = (string)rval;
742 var bval = (bool)val;
743 _this.reposStore.el.set_value(iter, 4, !bval);
744 GLib.debug("got repopath? %s", repopath);
746 var repo = GitRepo.get(repopath);
747 repo.set_autocommit(!bval);
755 // user defined functions
759 public class Xcls_tv_autopush : Object
761 public Gtk.TreeViewColumn el;
762 private Clones _this;
768 public Xcls_tv_autopush(Clones _owner )
771 _this.tv_autopush = this;
772 this.el = new Gtk.TreeViewColumn();
776 // set gobject values
777 this.el.title = "Auto Push";
778 this.el.min_width = 50;
779 var child_0 = new Xcls_cr_autopush( _this );
781 this.el.pack_start ( child_0.el , false );
785 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
786 // this.items[0].el.set_activatable(true);
789 // user defined functions
791 public class Xcls_cr_autopush : Object
793 public Gtk.CellRendererToggle el;
794 private Clones _this;
800 public Xcls_cr_autopush(Clones _owner )
803 _this.cr_autopush = this;
804 this.el = new Gtk.CellRendererToggle();
808 // set gobject values
809 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
812 this.el.toggled.connect( (self, path) => {
815 _this.reposStore.el.get_iter_from_string(out iter, path);
819 _this.reposStore.el.get_value(iter, 5, out val);
820 _this.reposStore.el.get_value(iter, 6, out rval);
822 var repopath = (string)rval;
823 var bval = (bool)val;
824 _this.reposStore.el.set_value(iter, 5, !bval);
825 var repo = GitRepo.get(repopath);
826 repo.set_autopush(!bval);
834 // user defined functions
838 public class Xcls_tv_autobranch : Object
840 public Gtk.TreeViewColumn el;
841 private Clones _this;
847 public Xcls_tv_autobranch(Clones _owner )
850 _this.tv_autobranch = this;
851 this.el = new Gtk.TreeViewColumn();
855 // set gobject values
856 this.el.title = "Auto Branch";
857 this.el.min_width = 50;
858 var child_0 = new Xcls_cr_autobranch( _this );
860 this.el.pack_start ( child_0.el , false );
864 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
865 // this.items[0].el.set_activatable(true);
868 // user defined functions
870 public class Xcls_cr_autobranch : Object
872 public Gtk.CellRendererToggle el;
873 private Clones _this;
879 public Xcls_cr_autobranch(Clones _owner )
882 _this.cr_autobranch = this;
883 this.el = new Gtk.CellRendererToggle();
887 // set gobject values
888 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
891 this.el.toggled.connect( (self, path) => {
894 _this.reposStore.el.get_iter_from_string(out iter, path);
898 _this.reposStore.el.get_value(iter, 8, out val);
899 _this.reposStore.el.get_value(iter, 6, out rval);
901 var repopath = (string)rval;
902 var bval = (bool)val;
903 _this.reposStore.el.set_value(iter, 8, !bval);
904 var repo = GitRepo.get(repopath);
905 repo.set_auto_branch(!bval);
913 // user defined functions
917 public class Xcls_tv_repo : Object
919 public Gtk.TreeViewColumn el;
920 private Clones _this;
926 public Xcls_tv_repo(Clones _owner )
929 _this.tv_repo = this;
930 this.el = new Gtk.TreeViewColumn();
934 // set gobject values
935 this.el.sort_column_id = 0;
936 this.el.title = "Repo";
937 this.el.min_width = 200;
938 this.el.sort_order = Gtk.SortType.ASCENDING;
939 this.el.resizable = true;
940 var child_0 = new Xcls_cr_repo( _this );
942 this.el.pack_start ( child_0.el , false );
946 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
949 // user defined functions
951 public class Xcls_cr_repo : Object
953 public Gtk.CellRendererText el;
954 private Clones _this;
960 public Xcls_cr_repo(Clones _owner )
963 _this.cr_repo = this;
964 this.el = new Gtk.CellRendererText();
968 // set gobject values
971 // user defined functions
975 public class Xcls_tv_active_ticket : Object
977 public Gtk.TreeViewColumn el;
978 private Clones _this;
984 public Xcls_tv_active_ticket(Clones _owner )
987 _this.tv_active_ticket = this;
988 this.el = new Gtk.TreeViewColumn();
992 // set gobject values
993 this.el.title = "Active Ticket";
994 this.el.min_width = 50;
995 var child_0 = new Xcls_cr_active_ticket( _this );
997 this.el.pack_start ( child_0.el , false );
1001 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
1004 // user defined functions
1006 public class Xcls_cr_active_ticket : Object
1008 public Gtk.CellRendererText el;
1009 private Clones _this;
1015 public Xcls_cr_active_ticket(Clones _owner )
1018 _this.cr_active_ticket = this;
1019 this.el = new Gtk.CellRendererText();
1023 // set gobject values
1026 // user defined functions
1030 public class Xcls_tv_current_branch : Object
1032 public Gtk.TreeViewColumn el;
1033 private Clones _this;
1039 public Xcls_tv_current_branch(Clones _owner )
1042 _this.tv_current_branch = this;
1043 this.el = new Gtk.TreeViewColumn();
1047 // set gobject values
1048 this.el.title = "Current Branch";
1049 this.el.min_width = 50;
1050 var child_0 = new Xcls_cr_current_branch( _this );
1052 this.el.pack_start ( child_0.el , false );
1056 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
1057 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
1060 // user defined functions
1062 public class Xcls_cr_current_branch : Object
1064 public Gtk.CellRendererText el;
1065 private Clones _this;
1071 public Xcls_cr_current_branch(Clones _owner )
1074 _this.cr_current_branch = this;
1075 this.el = new Gtk.CellRendererText();
1079 // set gobject values
1082 // user defined functions
1086 public class Xcls_tv_last_updated : Object
1088 public Gtk.TreeViewColumn el;
1089 private Clones _this;
1095 public Xcls_tv_last_updated(Clones _owner )
1098 _this.tv_last_updated = this;
1099 this.el = new Gtk.TreeViewColumn();
1103 // set gobject values
1104 this.el.title = "Last updated";
1105 this.el.min_width = 50;
1106 var child_0 = new Xcls_cr_last_updated( _this );
1108 this.el.pack_start ( child_0.el , false );
1112 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
1115 // user defined functions
1117 public class Xcls_cr_last_updated : Object
1119 public Gtk.CellRendererText el;
1120 private Clones _this;
1126 public Xcls_cr_last_updated(Clones _owner )
1129 _this.cr_last_updated = this;
1130 this.el = new Gtk.CellRendererText();
1134 // set gobject values
1137 // user defined functions
1141 public class Xcls_tv_all_branches : Object
1143 public Gtk.TreeViewColumn el;
1144 private Clones _this;
1150 public Xcls_tv_all_branches(Clones _owner )
1153 _this.tv_all_branches = this;
1154 this.el = new Gtk.TreeViewColumn();
1158 // set gobject values
1159 this.el.title = "All Branches";
1160 this.el.min_width = 50;
1161 this.el.resizable = false;
1162 var child_0 = new Xcls_cr_all_branches( _this );
1164 this.el.pack_start ( child_0.el , false );
1168 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
1171 // user defined functions
1173 public class Xcls_cr_all_branches : Object
1175 public Gtk.CellRendererText el;
1176 private Clones _this;
1182 public Xcls_cr_all_branches(Clones _owner )
1185 _this.cr_all_branches = this;
1186 this.el = new Gtk.CellRendererText();
1190 // set gobject values
1193 // user defined functions