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;
35 public void loadAndShow;
41 this.el = new Gtk.Dialog();
44 this.loadAndShow = () {
50 this.el.title = "Manage Clones";
51 this.el.border_width = 3;
52 this.el.default_height = 500;
53 this.el.default_width = 1024;
54 this.el.deletable = true;
56 var child_0 = new Xcls_Box2( _this );
58 this.el.get_content_area().add ( child_0.el );
61 this.el.delete_event.connect( (self, event) => {
66 this.el.response.connect( (self, response_id) => {
73 // user defined functions
76 GLib.debug("show clones?");
77 this.el.set_deletable(true);
78 this.el.set_gravity(Gdk.Gravity.NORTH);
79 this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
81 this.el.set_default_size(
82 int.min(1024,Gdk.Screen.width()),
83 int.max(500,Gdk.Screen.height() - 300)
87 _this.reposStore.load();
88 this.el.set_keep_above(true);
89 GLib.debug("show clones = run?");
92 // this.get('/reposStore').load();
94 //this.get('/ok_button').el.set_sensitive(false);
96 // block until we return.
97 // var run_ret = this.el.run();
98 // if (run_ret < 1 ) {
101 // print("RUN RETURN : " + run_ret);
103 //print(JSON.stringify(this.get('bug').getValue()));
104 // return this.get('bug').getValue();
105 //this.success = c.success;
107 public class Xcls_Box2 : Object
110 private Clones _this;
116 public Xcls_Box2(Clones _owner )
119 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
123 // set gobject values
124 var child_0 = new Xcls_Box3( _this );
126 this.el.pack_start ( child_0.el , false,false,0 );
127 var child_1 = new Xcls_ScrolledWindow5( _this );
129 this.el.pack_end ( child_1.el , true,true,0 );
132 // user defined functions
134 public class Xcls_Box3 : Object
137 private Clones _this;
143 public Xcls_Box3(Clones _owner )
146 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
150 // set gobject values
151 this.el.homogeneous = true;
152 var child_0 = new Xcls_Button4( _this );
154 this.el.add ( child_0.el );
157 // user defined functions
159 public class Xcls_Button4 : Object
161 public Gtk.Button el;
162 private Clones _this;
168 public Xcls_Button4(Clones _owner )
171 this.el = new Gtk.Button();
175 // set gobject values
176 this.el.label = "Add Repository";
181 this.el.get_style_context().add_class("suggested-action");
185 this.el.clicked.connect( () => {
186 Clone.singleton().show(this.el);
193 // user defined functions
197 public class Xcls_ScrolledWindow5 : Object
199 public Gtk.ScrolledWindow el;
200 private Clones _this;
206 public Xcls_ScrolledWindow5(Clones _owner )
209 this.el = new Gtk.ScrolledWindow( null, null );
213 // set gobject values
214 this.el.expand = true;
215 this.el.hexpand = true;
216 this.el.shadow_type = Gtk.ShadowType.IN;
217 var child_0 = new Xcls_reposView( _this );
219 this.el.add ( child_0.el );
225 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
229 // user defined functions
231 public class Xcls_reposView : Object
233 public Gtk.TreeView el;
234 private Clones _this;
240 public Xcls_reposView(Clones _owner )
243 _this.reposView = this;
244 this.el = new Gtk.TreeView();
248 // set gobject values
249 this.el.search_column = 0;
250 this.el.activate_on_single_click = true;
251 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
252 var child_0 = new Xcls_reposStore( _this );
254 this.el.set_model ( child_0.el );
255 var child_1 = new Xcls_tv_autocommit( _this );
257 this.el.append_column ( child_1.el );
258 var child_2 = new Xcls_tv_autopush( _this );
260 this.el.append_column ( child_2.el );
261 var child_3 = new Xcls_tv_autobranch( _this );
263 this.el.append_column ( child_3.el );
264 var child_4 = new Xcls_tv_repo( _this );
266 this.el.append_column ( child_4.el );
267 var child_5 = new Xcls_tv_active_ticket( _this );
269 this.el.append_column ( child_5.el );
270 var child_6 = new Xcls_tv_current_branch( _this );
272 this.el.append_column ( child_6.el );
273 var child_7 = new Xcls_tv_last_updated( _this );
275 this.el.append_column ( child_7.el );
276 var child_8 = new Xcls_tv_all_branches( _this );
278 this.el.append_column ( child_8.el );
283 var selection = this.el.get_selection();
284 selection.set_mode( Gtk.SelectionMode.SINGLE);
287 var description = new Pango.FontDescription();
288 description.set_size(10000);
289 this.el.override_font(description);
294 this.el.row_activated.connect( (path, col) => {
296 if (col.title != "Current Branch") {
303 _this.reposStore.el.get_iter(out iter, path);
305 _this.reposStore.el.get_value(iter, 6, out val);
306 var git_working_dir = (string)val;
308 var repo = GitRepo.singleton().get(git_working_dir);
311 _this.reposView.el.get_cell_area(path, col, out rect);
312 RepoStatusPopover.singleton().show(this.el, rect, repo);
317 this.el.cursor_changed.connect( () => {
318 // SEE SELECTION.CHANGED
323 if (this.el.get_selection().count_selected_rows() < 1) {
324 //nothing? - clea it?
328 var model = this.get('/changedFilesStore');
330 var s = this.el.get_selection();
332 s.selected_foreach(function(model,p,iter) {
334 files.push( model.get_value(iter, 0).value.get_string());
337 this.get('/patchview').showDiff(files);
338 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
339 //print("OUT?" + value);// id..
340 // load the list in the right grid..
347 // user defined functions
349 public class Xcls_reposStore : Object
351 public Gtk.ListStore el;
352 private Clones _this;
358 public Xcls_reposStore(Clones _owner )
361 _this.reposStore = this;
362 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
363 typeof(string), // 1 current branch
364 typeof(string), // 2 all branch
365 typeof(string), // 3 updated
366 typeof(bool), // 4 auto commit
367 typeof(bool), // 5 auto push
368 typeof(string), // 6 repopath
369 typeof(string), // 7 color highlighting?
370 typeof(bool), // 8 auto branch,
371 typeof(string) // 9 active Ticket
376 // set gobject values
379 // user defined functions
382 //this.insert(citer,iter,0);
383 print("getting list");
384 var tr = GitRepo.list();
388 // fixme .. sort by last updated ...
391 for(var i =0 ; i < tr.length; i++) {
392 var repo = tr.index(i);
393 // this is done before we display stuff...
394 //repo.loadBranches();
398 this.el.append(out iter);
400 //print(JSON.stringify(ret,null,4));
401 //tr[i].getBranches();
406 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
407 // print(JSON.stringify(hi,null,4));
408 // } catch(e) { print(e);}
410 this.el.set_value(iter, 0, repo.name );
411 this.el.set_value( iter, 1, repo.currentBranch.name );
412 this.el.set_value( iter, 2, repo.branchesToString() );
413 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
414 // function(e) { return e.name;
417 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
418 this.el.set_value(iter, 4, repo.is_autocommit() );
419 this.el.set_value(iter, 5, repo.is_autopush() );
420 this.el.set_value(iter, 6, repo.git_working_dir );
422 var cb = repo.currentBranch;
423 //print(JSON.stringify(cb,null,4));
426 if (cb.lastrev != cb.remoterev) {
428 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
429 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
433 if (repo.has_local_changes) {
435 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
437 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
439 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
440 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote") +
441 "\nHas uncommitted changes" );
444 this.el.set_value(iter, 7, col );
445 var ticket = repo.activeTicket;
447 this.el.set_value(iter, 8, repo.is_auto_branch() );
448 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
452 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
456 public class Xcls_tv_autocommit : Object
458 public Gtk.TreeViewColumn el;
459 private Clones _this;
465 public Xcls_tv_autocommit(Clones _owner )
468 _this.tv_autocommit = this;
469 this.el = new Gtk.TreeViewColumn();
473 // set gobject values
474 this.el.title = "Auto Commit";
475 this.el.min_width = 50;
476 var child_0 = new Xcls_cr_autocommit( _this );
478 this.el.pack_start ( child_0.el , false );
482 // this.items[0].el.set_activatable(true);
483 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
486 // user defined functions
488 public class Xcls_cr_autocommit : Object
490 public Gtk.CellRendererToggle el;
491 private Clones _this;
497 public Xcls_cr_autocommit(Clones _owner )
500 _this.cr_autocommit = this;
501 this.el = new Gtk.CellRendererToggle();
505 // set gobject values
506 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
509 this.el.toggled.connect( (self, path) => {
512 _this.reposStore.el.get_iter_from_string(out iter, path);
516 _this.reposStore.el.get_value(iter, 4, out val);
517 _this.reposStore.el.get_value(iter, 6, out rval);
519 var repopath = (string)rval;
520 var bval = (bool)val;
521 _this.reposStore.el.set_value(iter, 4, !bval);
522 GLib.debug("got repopath? %s", repopath);
524 var repo = GitRepo.get(repopath);
525 repo.set_autocommit(!bval);
533 // user defined functions
537 public class Xcls_tv_autopush : Object
539 public Gtk.TreeViewColumn el;
540 private Clones _this;
546 public Xcls_tv_autopush(Clones _owner )
549 _this.tv_autopush = this;
550 this.el = new Gtk.TreeViewColumn();
554 // set gobject values
555 this.el.title = "Auto Push";
556 this.el.min_width = 50;
557 var child_0 = new Xcls_cr_autopush( _this );
559 this.el.pack_start ( child_0.el , false );
563 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
564 // this.items[0].el.set_activatable(true);
567 // user defined functions
569 public class Xcls_cr_autopush : Object
571 public Gtk.CellRendererToggle el;
572 private Clones _this;
578 public Xcls_cr_autopush(Clones _owner )
581 _this.cr_autopush = this;
582 this.el = new Gtk.CellRendererToggle();
586 // set gobject values
587 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
590 this.el.toggled.connect( (self, path) => {
593 _this.reposStore.el.get_iter_from_string(out iter, path);
597 _this.reposStore.el.get_value(iter, 5, out val);
598 _this.reposStore.el.get_value(iter, 6, out rval);
600 var repopath = (string)rval;
601 var bval = (bool)val;
602 _this.reposStore.el.set_value(iter, 5, !bval);
603 var repo = GitRepo.get(repopath);
604 repo.set_autopush(!bval);
612 // user defined functions
616 public class Xcls_tv_autobranch : Object
618 public Gtk.TreeViewColumn el;
619 private Clones _this;
625 public Xcls_tv_autobranch(Clones _owner )
628 _this.tv_autobranch = this;
629 this.el = new Gtk.TreeViewColumn();
633 // set gobject values
634 this.el.title = "Auto Branch";
635 this.el.min_width = 50;
636 var child_0 = new Xcls_cr_autobranch( _this );
638 this.el.pack_start ( child_0.el , false );
642 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
643 // this.items[0].el.set_activatable(true);
646 // user defined functions
648 public class Xcls_cr_autobranch : Object
650 public Gtk.CellRendererToggle el;
651 private Clones _this;
657 public Xcls_cr_autobranch(Clones _owner )
660 _this.cr_autobranch = this;
661 this.el = new Gtk.CellRendererToggle();
665 // set gobject values
666 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
669 this.el.toggled.connect( (self, path) => {
672 _this.reposStore.el.get_iter_from_string(out iter, path);
676 _this.reposStore.el.get_value(iter, 8, out val);
677 _this.reposStore.el.get_value(iter, 6, out rval);
679 var repopath = (string)rval;
680 var bval = (bool)val;
681 _this.reposStore.el.set_value(iter, 8, !bval);
682 var repo = GitRepo.get(repopath);
683 repo.set_auto_branch(!bval);
691 // user defined functions
695 public class Xcls_tv_repo : Object
697 public Gtk.TreeViewColumn el;
698 private Clones _this;
704 public Xcls_tv_repo(Clones _owner )
707 _this.tv_repo = this;
708 this.el = new Gtk.TreeViewColumn();
712 // set gobject values
713 this.el.sort_column_id = 0;
714 this.el.title = "Repo";
715 this.el.min_width = 200;
716 this.el.sort_order = Gtk.SortType.ASCENDING;
717 this.el.resizable = true;
718 var child_0 = new Xcls_cr_repo( _this );
720 this.el.pack_start ( child_0.el , false );
724 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
727 // user defined functions
729 public class Xcls_cr_repo : Object
731 public Gtk.CellRendererText el;
732 private Clones _this;
738 public Xcls_cr_repo(Clones _owner )
741 _this.cr_repo = this;
742 this.el = new Gtk.CellRendererText();
746 // set gobject values
749 // user defined functions
753 public class Xcls_tv_active_ticket : Object
755 public Gtk.TreeViewColumn el;
756 private Clones _this;
762 public Xcls_tv_active_ticket(Clones _owner )
765 _this.tv_active_ticket = this;
766 this.el = new Gtk.TreeViewColumn();
770 // set gobject values
771 this.el.title = "Active Ticket";
772 this.el.min_width = 50;
773 var child_0 = new Xcls_cr_active_ticket( _this );
775 this.el.pack_start ( child_0.el , false );
779 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
782 // user defined functions
784 public class Xcls_cr_active_ticket : Object
786 public Gtk.CellRendererText el;
787 private Clones _this;
793 public Xcls_cr_active_ticket(Clones _owner )
796 _this.cr_active_ticket = this;
797 this.el = new Gtk.CellRendererText();
801 // set gobject values
804 // user defined functions
808 public class Xcls_tv_current_branch : Object
810 public Gtk.TreeViewColumn el;
811 private Clones _this;
817 public Xcls_tv_current_branch(Clones _owner )
820 _this.tv_current_branch = this;
821 this.el = new Gtk.TreeViewColumn();
825 // set gobject values
826 this.el.title = "Current Branch";
827 this.el.min_width = 50;
828 var child_0 = new Xcls_cr_current_branch( _this );
830 this.el.pack_start ( child_0.el , false );
834 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
835 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
838 // user defined functions
840 public class Xcls_cr_current_branch : Object
842 public Gtk.CellRendererText el;
843 private Clones _this;
849 public Xcls_cr_current_branch(Clones _owner )
852 _this.cr_current_branch = this;
853 this.el = new Gtk.CellRendererText();
857 // set gobject values
860 // user defined functions
864 public class Xcls_tv_last_updated : Object
866 public Gtk.TreeViewColumn el;
867 private Clones _this;
873 public Xcls_tv_last_updated(Clones _owner )
876 _this.tv_last_updated = this;
877 this.el = new Gtk.TreeViewColumn();
881 // set gobject values
882 this.el.title = "Last updated";
883 this.el.min_width = 50;
884 var child_0 = new Xcls_cr_last_updated( _this );
886 this.el.pack_start ( child_0.el , false );
890 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
893 // user defined functions
895 public class Xcls_cr_last_updated : Object
897 public Gtk.CellRendererText el;
898 private Clones _this;
904 public Xcls_cr_last_updated(Clones _owner )
907 _this.cr_last_updated = this;
908 this.el = new Gtk.CellRendererText();
912 // set gobject values
915 // user defined functions
919 public class Xcls_tv_all_branches : Object
921 public Gtk.TreeViewColumn el;
922 private Clones _this;
928 public Xcls_tv_all_branches(Clones _owner )
931 _this.tv_all_branches = this;
932 this.el = new Gtk.TreeViewColumn();
936 // set gobject values
937 this.el.title = "All Branches";
938 this.el.min_width = 50;
939 this.el.resizable = false;
940 var child_0 = new Xcls_cr_all_branches( _this );
942 this.el.pack_start ( child_0.el , false );
946 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
949 // user defined functions
951 public class Xcls_cr_all_branches : Object
953 public Gtk.CellRendererText el;
954 private Clones _this;
960 public Xcls_cr_all_branches(Clones _owner )
963 _this.cr_all_branches = this;
964 this.el = new Gtk.CellRendererText();
968 // set gobject values
971 // user defined functions