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 ,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( () => {
246 var rv = this.get('/reposView');
247 var rs = this.get('/reposStore');
248 if (rv.el.get_selection().count_selected_rows() != 1) {
253 var Branches = imports.Branches.Branches;
257 var s = rv.el.get_selection();
259 s.selected_foreach(function(model,p,iter) {
261 path = model.get_value(iter, 6).value.get_string();
266 rs.repos.forEach(function(r) {
267 if (r.repopath == path) {
273 Branches.repo = repo;
274 Branches.el.set_transient_for(Clones.el);
275 Clones.el.set_title("Manage Clones - " + repo.repopath);
277 Clones.el.set_title("Manage Clones");
290 // user defined functions
293 public class Xcls_Button6 : Object
295 public Gtk.Button el;
296 private Clones _this;
302 public Xcls_Button6(Clones _owner )
305 this.el = new Gtk.Button();
309 // set gobject values
310 this.el.label = "Merge";
313 this.el.clicked.connect( () => {
315 var rv = this.get('/reposView');
316 var rs = this.get('/reposStore');
317 if (rv.el.get_selection().count_selected_rows() != 1) {
322 var Merger = imports.Merger.Merger;
326 var s = rv.el.get_selection();
328 s.selected_foreach(function(model,p,iter) {
330 path = model.get_value(iter, 6).value.get_string();
335 rs.repos.forEach(function(r) {
336 if (r.repopath == path) {
343 Merger.el.set_transient_for(Clones.el);
344 Clones.el.set_title("Manage Clones - " + repo.repopath);
346 Clones.el.set_title("Manage Clones");
360 // user defined functions
363 public class Xcls_Button7 : Object
365 public Gtk.Button el;
366 private Clones _this;
372 public Xcls_Button7(Clones _owner )
375 this.el = new Gtk.Button();
379 // set gobject values
380 this.el.label = "Switch Branch";
383 this.el.clicked.connect( () => {
393 // user defined functions
396 public class Xcls_Button8 : Object
398 public Gtk.Button el;
399 private Clones _this;
405 public Xcls_Button8(Clones _owner )
408 this.el = new Gtk.Button();
412 // set gobject values
413 this.el.label = "Pull";
416 this.el.clicked.connect( () => {
426 // user defined functions
430 public class Xcls_ScrolledWindow9 : Object
432 public Gtk.ScrolledWindow el;
433 private Clones _this;
439 public Xcls_ScrolledWindow9(Clones _owner )
442 this.el = new Gtk.ScrolledWindow( null, null );
446 // set gobject values
447 this.el.expand = true;
448 this.el.hexpand = true;
449 this.el.shadow_type = Gtk.ShadowType.IN;
450 var child_0 = new Xcls_reposView( _this );
452 this.el.add ( child_0.el );
458 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
462 // user defined functions
464 public class Xcls_reposView : Object
466 public Gtk.TreeView el;
467 private Clones _this;
473 public Xcls_reposView(Clones _owner )
476 _this.reposView = this;
477 this.el = new Gtk.TreeView();
481 // set gobject values
482 var child_0 = new Xcls_reposStore( _this );
484 this.el.set_model ( child_0.el );
485 var child_1 = new Xcls_tv_autocommit( _this );
487 this.el.append_column ( child_1.el );
488 var child_2 = new Xcls_tv_autopush( _this );
490 this.el.append_column ( child_2.el );
491 var child_3 = new Xcls_tv_repo( _this );
493 this.el.append_column ( child_3.el );
494 var child_4 = new Xcls_tv_current_branch( _this );
496 this.el.append_column ( child_4.el );
497 var child_5 = new Xcls_tv_last_updated( _this );
499 this.el.append_column ( child_5.el );
500 var child_6 = new Xcls_tv_all_branches( _this );
502 this.el.append_column ( child_6.el );
507 var selection = this.el.get_selection();
508 selection.set_mode( Gtk.SelectionMode.SINGLE);
511 var description = new Pango.FontDescription();
512 description.set_size(10000);
513 this.el.override_font(description);
518 this.el.cursor_changed.connect( () => {
519 // SEE SELECTION.CHANGED
524 if (this.el.get_selection().count_selected_rows() < 1) {
525 //nothing? - clea it?
529 var model = this.get('/changedFilesStore');
531 var s = this.el.get_selection();
533 s.selected_foreach(function(model,p,iter) {
535 files.push( model.get_value(iter, 0).value.get_string());
538 this.get('/patchview').showDiff(files);
539 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
540 //print("OUT?" + value);// id..
541 // load the list in the right grid..
548 // user defined functions
550 public class Xcls_reposStore : Object
552 public Gtk.ListStore el;
553 private Clones _this;
559 public Xcls_reposStore(Clones _owner )
562 _this.reposStore = this;
563 this.el = new Gtk.ListStore( 8, typeof(string), // 0 repo
564 typeof(string), // 1 current branch
565 typeof(string), // 2 all branch
566 typeof(string), // 3 updated
567 typeof(bool), // 4 auto commit
568 typeof(bool), // 5 auto push
569 typeof(string), // 7 repopath
570 typeof(string) // 8 color highlighting?
575 // set gobject values
578 // user defined functions
581 //this.insert(citer,iter,0);
582 print("getting list");
583 var tr = GitRepo.list();
587 // fixme .. sort by last updated ...
590 for(var i =0 ; i < tr.length; i++) {
591 var repo = tr.index(i);
595 this.el.append(out iter);
598 //print(JSON.stringify(ret,null,4));
599 //tr[i].getBranches();
604 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
605 // print(JSON.stringify(hi,null,4));
606 // } catch(e) { print(e);}
608 this.el.set_value(iter, 0, repo.name );
609 this.el.set_value( iter, 1, repo.currentBranch.name );
610 this.el.set_value( iter, 2, repo.branchesToString() );
611 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
612 // function(e) { return e.name;
615 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
616 this.el.set_value(iter, 4, repo.is_autocommit() );
617 this.el.set_value(iter, 5, repo.is_autopush() );
618 this.el.set_value(iter, 6, repo.gitdir );
620 var cb = repo.currentBranch;
621 //print(JSON.stringify(cb,null,4));
624 if (cb.lastrev != cb.remoterev) {
627 if (tr[i].hasLocalChanges) {
630 if ((cb.lastrev != cb.remoterev) && (tr[i].hasLocalChanges)) {
634 this.el.set_value(iter, 7, col );
637 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
641 public class Xcls_tv_autocommit : Object
643 public Gtk.TreeViewColumn el;
644 private Clones _this;
650 public Xcls_tv_autocommit(Clones _owner )
653 _this.tv_autocommit = this;
654 this.el = new Gtk.TreeViewColumn();
658 // set gobject values
659 this.el.title = "Auto Commit";
660 this.el.min_width = 50;
661 var child_0 = new Xcls_cr_autocommit( _this );
663 this.el.pack_start ( child_0.el , false );
667 // this.items[0].el.set_activatable(true);
668 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
671 // user defined functions
673 public class Xcls_cr_autocommit : Object
675 public Gtk.CellRendererToggle el;
676 private Clones _this;
682 public Xcls_cr_autocommit(Clones _owner )
685 _this.cr_autocommit = this;
686 this.el = new Gtk.CellRendererToggle();
690 // set gobject values
691 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
694 this.el.toggled.connect( (self, path) => {
696 var store = this.get('/reposStore');
697 store.el.get_iter_from_string(ret, path);
699 var value = store.el.get_value(ret.iter,4).value.get_boolean();
701 //print(JSON.stringify(value));
702 store.el.set_value(ret.iter,4, !value);
704 var path = store.el.get_value(ret.iter, 6).value.get_string();
705 var repo = imports.Scm.Repo.Repo.get(path);
706 repo.autocommit(!value);
713 // user defined functions
717 public class Xcls_tv_autopush : Object
719 public Gtk.TreeViewColumn el;
720 private Clones _this;
726 public Xcls_tv_autopush(Clones _owner )
729 _this.tv_autopush = this;
730 this.el = new Gtk.TreeViewColumn();
734 // set gobject values
735 this.el.title = "Auto Push";
736 this.el.min_width = 50;
737 var child_0 = new Xcls_cr_autopush( _this );
739 this.el.pack_start ( child_0.el , false );
743 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
744 // this.items[0].el.set_activatable(true);
747 // user defined functions
749 public class Xcls_cr_autopush : Object
751 public Gtk.CellRendererToggle el;
752 private Clones _this;
758 public Xcls_cr_autopush(Clones _owner )
761 _this.cr_autopush = this;
762 this.el = new Gtk.CellRendererToggle();
766 // set gobject values
767 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
770 this.el.toggled.connect( (self, path) => {
772 var store = this.get('/reposStore');
773 store.el.get_iter_from_string(ret, path);
775 var value = store.el.get_value(ret.iter,5).value.get_boolean();
777 //print(JSON.stringify(value));
778 store.el.set_value(ret.iter,5, !value);
779 var path = store.el.get_value(ret.iter, 6).value.get_string();
780 var repo = imports.Scm.Repo.Repo.get(path);
781 repo.autopush(!value);
786 // user defined functions
790 public class Xcls_tv_repo : Object
792 public Gtk.TreeViewColumn el;
793 private Clones _this;
799 public Xcls_tv_repo(Clones _owner )
802 _this.tv_repo = this;
803 this.el = new Gtk.TreeViewColumn();
807 // set gobject values
808 this.el.sort_column_id = 0;
809 this.el.title = "Repo";
810 this.el.min_width = 200;
811 this.el.sort_order = Gtk.SortType.ASCENDING;
812 this.el.resizable = true;
813 var child_0 = new Xcls_cr_repo( _this );
815 this.el.pack_start ( child_0.el , false );
819 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
822 // user defined functions
824 public class Xcls_cr_repo : Object
826 public Gtk.CellRendererText el;
827 private Clones _this;
833 public Xcls_cr_repo(Clones _owner )
836 _this.cr_repo = this;
837 this.el = new Gtk.CellRendererText();
841 // set gobject values
844 // user defined functions
848 public class Xcls_tv_current_branch : Object
850 public Gtk.TreeViewColumn el;
851 private Clones _this;
857 public Xcls_tv_current_branch(Clones _owner )
860 _this.tv_current_branch = this;
861 this.el = new Gtk.TreeViewColumn();
865 // set gobject values
866 this.el.title = "Current Branch";
867 this.el.min_width = 50;
868 var child_0 = new Xcls_cr_current_branch( _this );
870 this.el.pack_start ( child_0.el , false );
874 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
875 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
878 // user defined functions
880 public class Xcls_cr_current_branch : Object
882 public Gtk.CellRendererText el;
883 private Clones _this;
889 public Xcls_cr_current_branch(Clones _owner )
892 _this.cr_current_branch = this;
893 this.el = new Gtk.CellRendererText();
897 // set gobject values
900 // user defined functions
904 public class Xcls_tv_last_updated : Object
906 public Gtk.TreeViewColumn el;
907 private Clones _this;
913 public Xcls_tv_last_updated(Clones _owner )
916 _this.tv_last_updated = this;
917 this.el = new Gtk.TreeViewColumn();
921 // set gobject values
922 this.el.title = "Last updated";
923 this.el.min_width = 50;
924 var child_0 = new Xcls_cr_last_updated( _this );
926 this.el.pack_start ( child_0.el , false );
930 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
933 // user defined functions
935 public class Xcls_cr_last_updated : Object
937 public Gtk.CellRendererText el;
938 private Clones _this;
944 public Xcls_cr_last_updated(Clones _owner )
947 _this.cr_last_updated = this;
948 this.el = new Gtk.CellRendererText();
952 // set gobject values
955 // user defined functions
959 public class Xcls_tv_all_branches : Object
961 public Gtk.TreeViewColumn el;
962 private Clones _this;
968 public Xcls_tv_all_branches(Clones _owner )
971 _this.tv_all_branches = this;
972 this.el = new Gtk.TreeViewColumn();
976 // set gobject values
977 this.el.title = "All Branches";
978 this.el.min_width = 50;
979 this.el.resizable = false;
980 var child_0 = new Xcls_cr_all_branches( _this );
982 this.el.pack_start ( child_0.el , false );
986 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
989 // user defined functions
991 public class Xcls_cr_all_branches : Object
993 public Gtk.CellRendererText el;
994 private Clones _this;
1000 public Xcls_cr_all_branches(Clones _owner )
1003 _this.cr_all_branches = this;
1004 this.el = new Gtk.CellRendererText();
1008 // set gobject values
1011 // user defined functions
1018 public class Xcls_ok_button : Object
1020 public Gtk.Button el;
1021 private Clones _this;
1027 public Xcls_ok_button(Clones _owner )
1030 _this.ok_button = this;
1031 this.el = new Gtk.Button();
1035 // set gobject values
1036 this.el.expand = false;
1037 this.el.label = "Close";
1040 // user defined functions