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_repo tv_repo;
22 public Xcls_cr_repo cr_repo;
23 public Xcls_tv_current_branch tv_current_branch;
24 public Xcls_cr_current_branch cr_current_branch;
25 public Xcls_tv_last_updated tv_last_updated;
26 public Xcls_cr_last_updated cr_last_updated;
27 public Xcls_tv_all_branches tv_all_branches;
28 public Xcls_cr_all_branches cr_all_branches;
29 public Xcls_ok_button ok_button;
37 this.el = new Gtk.Dialog();
42 this.el.title = "Manage Clones";
43 this.el.border_width = 3;
44 this.el.default_height = 500;
45 this.el.default_width = 800;
46 this.el.deletable = true;
48 var child_0 = new Xcls_Box2( _this );
50 this.el.get_content_area().add ( child_0.el );
51 var child_1 = new Xcls_ok_button( _this );
53 this.el.add_action_widget ( child_1.el , 1 );
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.reposStore.load();
78 // this.get('/reposStore').load();
80 //this.get('/ok_button').el.set_sensitive(false);
82 // block until we return.
83 // var run_ret = this.el.run();
84 // if (run_ret < 1 ) {
87 // print("RUN RETURN : " + run_ret);
89 //print(JSON.stringify(this.get('bug').getValue()));
90 // return this.get('bug').getValue();
91 //this.success = c.success;
93 public class Xcls_Box2 : Object
102 public Xcls_Box2(Clones _owner )
105 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
109 // set gobject values
110 var child_0 = new Xcls_Box3( _this );
112 this.el.pack_start ( child_0.el , false,false,0 );
113 var child_1 = new Xcls_ScrolledWindow9( _this );
115 this.el.pack_end ( child_1.el , true,true,0 );
118 // user defined functions
120 public class Xcls_Box3 : Object
123 private Clones _this;
129 public Xcls_Box3(Clones _owner )
132 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
136 // set gobject values
137 var child_0 = new Xcls_Button4( _this );
139 this.el.add ( child_0.el );
140 var child_1 = new Xcls_Button5( _this );
142 this.el.add ( child_1.el );
143 var child_2 = new Xcls_Button6( _this );
145 this.el.add ( child_2.el );
146 var child_3 = new Xcls_Button7( _this );
148 this.el.add ( child_3.el );
149 var child_4 = new Xcls_Button8( _this );
151 this.el.add ( child_4.el );
154 // user defined functions
156 public class Xcls_Button4 : Object
158 public Gtk.Button el;
159 private Clones _this;
165 public Xcls_Button4(Clones _owner )
168 this.el = new Gtk.Button();
172 // set gobject values
173 this.el.label = "Remotes / Clones";
176 this.el.clicked.connect( () => {
178 /* var rv = this.get('/reposView');
179 var rs = this.get('/reposStore');
180 if (rv.el.get_selection().count_selected_rows() != 1) {
185 var Remotes = imports.Remotes.Remotes;
189 var s = rv.el.get_selection();
191 s.selected_foreach(function(model,p,iter) {
193 path = model.get_value(iter, 6).value.get_string();
198 rs.repos.forEach(function(r) {
199 if (r.repopath == path) {
206 Remotes.el.set_transient_for(Clones.el);
207 Clones.el.set_title("Manage Clones - " + repo.repopath);
209 Clones.el.set_title("Manage Clones");
221 // user defined functions
224 public class Xcls_Button5 : Object
226 public Gtk.Button el;
227 private Clones _this;
233 public Xcls_Button5(Clones _owner )
236 this.el = new Gtk.Button();
240 // set gobject values
241 this.el.label = "Branches";
244 this.el.clicked.connect( () => {
247 NewBranch.singleton().show();
250 var rv = this.get('/reposView');
251 var rs = this.get('/reposStore');
252 if (rv.el.get_selection().count_selected_rows() != 1) {
257 var Branches = imports.Branches.Branches;
261 var s = rv.el.get_selection();
263 s.selected_foreach(function(model,p,iter) {
265 path = model.get_value(iter, 6).value.get_string();
270 rs.repos.forEach(function(r) {
271 if (r.repopath == path) {
277 Branches.repo = repo;
278 Branches.el.set_transient_for(Clones.el);
279 Clones.el.set_title("Manage Clones - " + repo.repopath);
281 Clones.el.set_title("Manage Clones");
294 // user defined functions
297 public class Xcls_Button6 : Object
299 public Gtk.Button el;
300 private Clones _this;
306 public Xcls_Button6(Clones _owner )
309 this.el = new Gtk.Button();
313 // set gobject values
314 this.el.label = "Merge";
317 this.el.clicked.connect( () => {
319 var rv = this.get('/reposView');
320 var rs = this.get('/reposStore');
321 if (rv.el.get_selection().count_selected_rows() != 1) {
326 var Merger = imports.Merger.Merger;
330 var s = rv.el.get_selection();
332 s.selected_foreach(function(model,p,iter) {
334 path = model.get_value(iter, 6).value.get_string();
339 rs.repos.forEach(function(r) {
340 if (r.repopath == path) {
347 Merger.el.set_transient_for(Clones.el);
348 Clones.el.set_title("Manage Clones - " + repo.repopath);
350 Clones.el.set_title("Manage Clones");
364 // user defined functions
367 public class Xcls_Button7 : Object
369 public Gtk.Button el;
370 private Clones _this;
376 public Xcls_Button7(Clones _owner )
379 this.el = new Gtk.Button();
383 // set gobject values
384 this.el.label = "Switch Branch";
387 this.el.clicked.connect( () => {
397 // user defined functions
400 public class Xcls_Button8 : Object
402 public Gtk.Button el;
403 private Clones _this;
409 public Xcls_Button8(Clones _owner )
412 this.el = new Gtk.Button();
416 // set gobject values
417 this.el.label = "Pull";
420 this.el.clicked.connect( () => {
430 // user defined functions
434 public class Xcls_ScrolledWindow9 : Object
436 public Gtk.ScrolledWindow el;
437 private Clones _this;
443 public Xcls_ScrolledWindow9(Clones _owner )
446 this.el = new Gtk.ScrolledWindow( null, null );
450 // set gobject values
451 this.el.expand = true;
452 this.el.hexpand = true;
453 this.el.shadow_type = Gtk.ShadowType.IN;
454 var child_0 = new Xcls_reposView( _this );
456 this.el.add ( child_0.el );
462 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
466 // user defined functions
468 public class Xcls_reposView : Object
470 public Gtk.TreeView el;
471 private Clones _this;
477 public Xcls_reposView(Clones _owner )
480 _this.reposView = this;
481 this.el = new Gtk.TreeView();
485 // set gobject values
486 var child_0 = new Xcls_reposStore( _this );
488 this.el.set_model ( child_0.el );
489 var child_1 = new Xcls_tv_autocommit( _this );
491 this.el.append_column ( child_1.el );
492 var child_2 = new Xcls_tv_autopush( _this );
494 this.el.append_column ( child_2.el );
495 var child_3 = new Xcls_tv_repo( _this );
497 this.el.append_column ( child_3.el );
498 var child_4 = new Xcls_tv_current_branch( _this );
500 this.el.append_column ( child_4.el );
501 var child_5 = new Xcls_tv_last_updated( _this );
503 this.el.append_column ( child_5.el );
504 var child_6 = new Xcls_tv_all_branches( _this );
506 this.el.append_column ( child_6.el );
511 var selection = this.el.get_selection();
512 selection.set_mode( Gtk.SelectionMode.SINGLE);
515 var description = new Pango.FontDescription();
516 description.set_size(10000);
517 this.el.override_font(description);
522 this.el.cursor_changed.connect( () => {
523 // SEE SELECTION.CHANGED
528 if (this.el.get_selection().count_selected_rows() < 1) {
529 //nothing? - clea it?
533 var model = this.get('/changedFilesStore');
535 var s = this.el.get_selection();
537 s.selected_foreach(function(model,p,iter) {
539 files.push( model.get_value(iter, 0).value.get_string());
542 this.get('/patchview').showDiff(files);
543 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
544 //print("OUT?" + value);// id..
545 // load the list in the right grid..
552 // user defined functions
554 public class Xcls_reposStore : Object
556 public Gtk.ListStore el;
557 private Clones _this;
563 public Xcls_reposStore(Clones _owner )
566 _this.reposStore = this;
567 this.el = new Gtk.ListStore( 8, typeof(string), // 0 repo
568 typeof(string), // 1 current branch
569 typeof(string), // 2 all branch
570 typeof(string), // 3 updated
571 typeof(bool), // 4 auto commit
572 typeof(bool), // 5 auto push
573 typeof(string), // 7 repopath
574 typeof(string) // 8 color highlighting?
579 // set gobject values
582 // user defined functions
585 //this.insert(citer,iter,0);
586 print("getting list");
587 var tr = GitRepo.list();
591 // fixme .. sort by last updated ...
594 for(var i =0 ; i < tr.length; i++) {
595 var repo = tr.index(i);
599 this.el.append(out iter);
602 //print(JSON.stringify(ret,null,4));
603 //tr[i].getBranches();
608 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
609 // print(JSON.stringify(hi,null,4));
610 // } catch(e) { print(e);}
612 this.el.set_value(iter, 0, repo.name );
613 this.el.set_value( iter, 1, repo.currentBranch.name );
614 this.el.set_value( iter, 2, repo.branchesToString() );
615 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
616 // function(e) { return e.name;
619 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
620 this.el.set_value(iter, 4, repo.is_autocommit() );
621 this.el.set_value(iter, 5, repo.is_autopush() );
622 this.el.set_value(iter, 6, repo.gitdir );
624 var cb = repo.currentBranch;
625 //print(JSON.stringify(cb,null,4));
628 if (cb.lastrev != cb.remoterev) {
631 if (tr[i].hasLocalChanges) {
634 if ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
638 this.el.set_value(iter, 7, col );
641 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
645 public class Xcls_tv_autocommit : Object
647 public Gtk.TreeViewColumn el;
648 private Clones _this;
654 public Xcls_tv_autocommit(Clones _owner )
657 _this.tv_autocommit = this;
658 this.el = new Gtk.TreeViewColumn();
662 // set gobject values
663 this.el.title = "Auto Commit";
664 this.el.min_width = 50;
665 var child_0 = new Xcls_cr_autocommit( _this );
667 this.el.pack_start ( child_0.el , false );
671 // this.items[0].el.set_activatable(true);
672 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
675 // user defined functions
677 public class Xcls_cr_autocommit : Object
679 public Gtk.CellRendererToggle el;
680 private Clones _this;
686 public Xcls_cr_autocommit(Clones _owner )
689 _this.cr_autocommit = this;
690 this.el = new Gtk.CellRendererToggle();
694 // set gobject values
695 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
698 this.el.toggled.connect( (self, path) => {
700 var store = this.get('/reposStore');
701 store.el.get_iter_from_string(ret, path);
703 var value = store.el.get_value(ret.iter,4).value.get_boolean();
705 //print(JSON.stringify(value));
706 store.el.set_value(ret.iter,4, !value);
708 var path = store.el.get_value(ret.iter, 6).value.get_string();
709 var repo = imports.Scm.Repo.Repo.get(path);
710 repo.autocommit(!value);
717 // user defined functions
721 public class Xcls_tv_autopush : Object
723 public Gtk.TreeViewColumn el;
724 private Clones _this;
730 public Xcls_tv_autopush(Clones _owner )
733 _this.tv_autopush = this;
734 this.el = new Gtk.TreeViewColumn();
738 // set gobject values
739 this.el.title = "Auto Push";
740 this.el.min_width = 50;
741 var child_0 = new Xcls_cr_autopush( _this );
743 this.el.pack_start ( child_0.el , false );
747 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
748 // this.items[0].el.set_activatable(true);
751 // user defined functions
753 public class Xcls_cr_autopush : Object
755 public Gtk.CellRendererToggle el;
756 private Clones _this;
762 public Xcls_cr_autopush(Clones _owner )
765 _this.cr_autopush = this;
766 this.el = new Gtk.CellRendererToggle();
770 // set gobject values
771 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
774 this.el.toggled.connect( (self, path) => {
776 var store = this.get('/reposStore');
777 store.el.get_iter_from_string(ret, path);
779 var value = store.el.get_value(ret.iter,5).value.get_boolean();
781 //print(JSON.stringify(value));
782 store.el.set_value(ret.iter,5, !value);
783 var path = store.el.get_value(ret.iter, 6).value.get_string();
784 var repo = imports.Scm.Repo.Repo.get(path);
785 repo.autopush(!value);
790 // user defined functions
794 public class Xcls_tv_repo : Object
796 public Gtk.TreeViewColumn el;
797 private Clones _this;
803 public Xcls_tv_repo(Clones _owner )
806 _this.tv_repo = this;
807 this.el = new Gtk.TreeViewColumn();
811 // set gobject values
812 this.el.sort_column_id = 0;
813 this.el.title = "Repo";
814 this.el.min_width = 200;
815 this.el.sort_order = Gtk.SortType.ASCENDING;
816 this.el.resizable = true;
817 var child_0 = new Xcls_cr_repo( _this );
819 this.el.pack_start ( child_0.el , false );
823 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
826 // user defined functions
828 public class Xcls_cr_repo : Object
830 public Gtk.CellRendererText el;
831 private Clones _this;
837 public Xcls_cr_repo(Clones _owner )
840 _this.cr_repo = this;
841 this.el = new Gtk.CellRendererText();
845 // set gobject values
848 // user defined functions
852 public class Xcls_tv_current_branch : Object
854 public Gtk.TreeViewColumn el;
855 private Clones _this;
861 public Xcls_tv_current_branch(Clones _owner )
864 _this.tv_current_branch = this;
865 this.el = new Gtk.TreeViewColumn();
869 // set gobject values
870 this.el.title = "Current Branch";
871 this.el.min_width = 50;
872 var child_0 = new Xcls_cr_current_branch( _this );
874 this.el.pack_start ( child_0.el , false );
878 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
879 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
882 // user defined functions
884 public class Xcls_cr_current_branch : Object
886 public Gtk.CellRendererText el;
887 private Clones _this;
893 public Xcls_cr_current_branch(Clones _owner )
896 _this.cr_current_branch = this;
897 this.el = new Gtk.CellRendererText();
901 // set gobject values
904 // user defined functions
908 public class Xcls_tv_last_updated : Object
910 public Gtk.TreeViewColumn el;
911 private Clones _this;
917 public Xcls_tv_last_updated(Clones _owner )
920 _this.tv_last_updated = this;
921 this.el = new Gtk.TreeViewColumn();
925 // set gobject values
926 this.el.title = "Last updated";
927 this.el.min_width = 50;
928 var child_0 = new Xcls_cr_last_updated( _this );
930 this.el.pack_start ( child_0.el , false );
934 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
937 // user defined functions
939 public class Xcls_cr_last_updated : Object
941 public Gtk.CellRendererText el;
942 private Clones _this;
948 public Xcls_cr_last_updated(Clones _owner )
951 _this.cr_last_updated = this;
952 this.el = new Gtk.CellRendererText();
956 // set gobject values
959 // user defined functions
963 public class Xcls_tv_all_branches : Object
965 public Gtk.TreeViewColumn el;
966 private Clones _this;
972 public Xcls_tv_all_branches(Clones _owner )
975 _this.tv_all_branches = this;
976 this.el = new Gtk.TreeViewColumn();
980 // set gobject values
981 this.el.title = "All Branches";
982 this.el.min_width = 50;
983 this.el.resizable = false;
984 var child_0 = new Xcls_cr_all_branches( _this );
986 this.el.pack_start ( child_0.el , false );
990 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
993 // user defined functions
995 public class Xcls_cr_all_branches : Object
997 public Gtk.CellRendererText el;
998 private Clones _this;
1004 public Xcls_cr_all_branches(Clones _owner )
1007 _this.cr_all_branches = this;
1008 this.el = new Gtk.CellRendererText();
1012 // set gobject values
1015 // user defined functions
1022 public class Xcls_ok_button : Object
1024 public Gtk.Button el;
1025 private Clones _this;
1031 public Xcls_ok_button(Clones _owner )
1034 _this.ok_button = this;
1035 this.el = new Gtk.Button();
1039 // set gobject values
1040 this.el.expand = false;
1041 this.el.label = "Close";
1044 // user defined functions