3 public class Clones : Object
8 public static Clones singleton()
10 if (_Clones == null) {
11 _Clones= new Clones();
15 public Xcls_spinner spinner;
16 public Xcls_toolbar toolbar;
17 public Xcls_scrolled scrolled;
18 public Xcls_reposView reposView;
19 public Xcls_reposStore reposStore;
20 public Xcls_tv_autocommit tv_autocommit;
21 public Xcls_cr_autocommit cr_autocommit;
22 public Xcls_tv_autopush tv_autopush;
23 public Xcls_cr_autopush cr_autopush;
24 public Xcls_tv_autobranch tv_autobranch;
25 public Xcls_cr_autobranch cr_autobranch;
26 public Xcls_tv_repo tv_repo;
27 public Xcls_cr_repo cr_repo;
28 public Xcls_tv_active_ticket tv_active_ticket;
29 public Xcls_cr_active_ticket cr_active_ticket;
30 public Xcls_tv_current_branch tv_current_branch;
31 public Xcls_cr_current_branch cr_current_branch;
32 public Xcls_tv_last_updated tv_last_updated;
33 public Xcls_cr_last_updated cr_last_updated;
34 public Xcls_tv_all_branches tv_all_branches;
35 public Xcls_cr_all_branches cr_all_branches;
43 this.el = new Gtk.Dialog();
48 this.el.title = "Manage Clones";
49 this.el.border_width = 3;
50 this.el.default_height = 500;
51 this.el.default_width = 1024;
52 this.el.deletable = true;
54 var child_0 = new Xcls_Box2( _this );
56 this.el.get_content_area().add ( child_0.el );
59 this.el.delete_event.connect( (self, event) => {
64 this.el.response.connect( (self, response_id) => {
71 // user defined functions
72 public void loadAndShow () {
73 _this.toolbar.el.hide();
74 _this.scrolled.el.hide();
75 _this.progress.el.show();
76 GitRepo.updateAll("show_clones");
83 GLib.debug("show clones?");
84 this.el.set_deletable(true);
85 this.el.set_gravity(Gdk.Gravity.NORTH);
86 this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
88 this.el.set_default_size(
89 int.min(1024,Gdk.Screen.width()),
90 int.max(500,Gdk.Screen.height() - 300)
94 _this.reposStore.load();
95 this.el.set_keep_above(true);
96 GLib.debug("show clones = run?");
99 // this.get('/reposStore').load();
101 //this.get('/ok_button').el.set_sensitive(false);
103 // block until we return.
104 // var run_ret = this.el.run();
105 // if (run_ret < 1 ) {
108 // print("RUN RETURN : " + run_ret);
110 //print(JSON.stringify(this.get('bug').getValue()));
111 // return this.get('bug').getValue();
112 //this.success = c.success;
114 public class Xcls_Box2 : Object
117 private Clones _this;
123 public Xcls_Box2(Clones _owner )
126 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
130 // set gobject values
131 var child_0 = new Xcls_spinner( _this );
133 this.el.pack_start ( child_0.el , false,false,0 );
134 var child_1 = new Xcls_toolbar( _this );
136 this.el.pack_start ( child_1.el , false,false,0 );
137 var child_2 = new Xcls_scrolled( _this );
139 this.el.pack_end ( child_2.el , true,true,0 );
142 // user defined functions
144 public class Xcls_spinner : Object
146 public Gtk.Spinner el;
147 private Clones _this;
153 public Xcls_spinner(Clones _owner )
156 _this.spinner = this;
157 this.el = new Gtk.Spinner();
161 // set gobject values
164 // user defined functions
167 public class Xcls_toolbar : Object
170 private Clones _this;
176 public Xcls_toolbar(Clones _owner )
179 _this.toolbar = this;
180 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
184 // set gobject values
185 this.el.homogeneous = true;
186 var child_0 = new Xcls_Button5( _this );
188 this.el.add ( child_0.el );
191 // user defined functions
193 public class Xcls_Button5 : Object
195 public Gtk.Button el;
196 private Clones _this;
202 public Xcls_Button5(Clones _owner )
205 this.el = new Gtk.Button();
209 // set gobject values
210 this.el.label = "Add Repository";
215 this.el.get_style_context().add_class("suggested-action");
219 this.el.clicked.connect( () => {
220 Clone.singleton().show(this.el);
227 // user defined functions
231 public class Xcls_scrolled : Object
233 public Gtk.ScrolledWindow el;
234 private Clones _this;
240 public Xcls_scrolled(Clones _owner )
243 _this.scrolled = this;
244 this.el = new Gtk.ScrolledWindow( null, null );
248 // set gobject values
249 this.el.expand = true;
250 this.el.hexpand = true;
251 this.el.shadow_type = Gtk.ShadowType.IN;
252 var child_0 = new Xcls_reposView( _this );
254 this.el.add ( child_0.el );
260 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
264 // user defined functions
266 public class Xcls_reposView : Object
268 public Gtk.TreeView el;
269 private Clones _this;
275 public Xcls_reposView(Clones _owner )
278 _this.reposView = this;
279 this.el = new Gtk.TreeView();
283 // set gobject values
284 this.el.search_column = 0;
285 this.el.activate_on_single_click = true;
286 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
287 var child_0 = new Xcls_reposStore( _this );
289 this.el.set_model ( child_0.el );
290 var child_1 = new Xcls_tv_autocommit( _this );
292 this.el.append_column ( child_1.el );
293 var child_2 = new Xcls_tv_autopush( _this );
295 this.el.append_column ( child_2.el );
296 var child_3 = new Xcls_tv_autobranch( _this );
298 this.el.append_column ( child_3.el );
299 var child_4 = new Xcls_tv_repo( _this );
301 this.el.append_column ( child_4.el );
302 var child_5 = new Xcls_tv_active_ticket( _this );
304 this.el.append_column ( child_5.el );
305 var child_6 = new Xcls_tv_current_branch( _this );
307 this.el.append_column ( child_6.el );
308 var child_7 = new Xcls_tv_last_updated( _this );
310 this.el.append_column ( child_7.el );
311 var child_8 = new Xcls_tv_all_branches( _this );
313 this.el.append_column ( child_8.el );
318 var selection = this.el.get_selection();
319 selection.set_mode( Gtk.SelectionMode.SINGLE);
322 var description = new Pango.FontDescription();
323 description.set_size(10000);
324 this.el.override_font(description);
329 this.el.row_activated.connect( (path, col) => {
331 if (col.title != "Current Branch") {
338 _this.reposStore.el.get_iter(out iter, path);
340 _this.reposStore.el.get_value(iter, 6, out val);
341 var git_working_dir = (string)val;
343 var repo = GitRepo.singleton().get(git_working_dir);
346 _this.reposView.el.get_cell_area(path, col, out rect);
347 RepoStatusPopover.singleton().show(this.el, rect, repo);
352 this.el.cursor_changed.connect( () => {
353 // SEE SELECTION.CHANGED
358 if (this.el.get_selection().count_selected_rows() < 1) {
359 //nothing? - clea it?
363 var model = this.get('/changedFilesStore');
365 var s = this.el.get_selection();
367 s.selected_foreach(function(model,p,iter) {
369 files.push( model.get_value(iter, 0).value.get_string());
372 this.get('/patchview').showDiff(files);
373 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
374 //print("OUT?" + value);// id..
375 // load the list in the right grid..
382 // user defined functions
384 public class Xcls_reposStore : Object
386 public Gtk.ListStore el;
387 private Clones _this;
393 public Xcls_reposStore(Clones _owner )
396 _this.reposStore = this;
397 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
398 typeof(string), // 1 current branch
399 typeof(string), // 2 all branch
400 typeof(string), // 3 updated
401 typeof(bool), // 4 auto commit
402 typeof(bool), // 5 auto push
403 typeof(string), // 6 repopath
404 typeof(string), // 7 color highlighting?
405 typeof(bool), // 8 auto branch,
406 typeof(string) // 9 active Ticket
411 // set gobject values
414 // user defined functions
417 //this.insert(citer,iter,0);
418 print("getting list");
419 var tr = GitRepo.list();
423 // fixme .. sort by last updated ...
426 for(var i =0 ; i < tr.length; i++) {
427 var repo = tr.index(i);
428 // this is done before we display stuff...
429 //repo.loadBranches();
433 this.el.append(out iter);
435 //print(JSON.stringify(ret,null,4));
436 //tr[i].getBranches();
441 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
442 // print(JSON.stringify(hi,null,4));
443 // } catch(e) { print(e);}
445 this.el.set_value(iter, 0, repo.name );
446 this.el.set_value( iter, 1, repo.currentBranch.name );
447 this.el.set_value( iter, 2, repo.branchesToString() );
448 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
449 // function(e) { return e.name;
452 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
453 this.el.set_value(iter, 4, repo.is_autocommit() );
454 this.el.set_value(iter, 5, repo.is_autopush() );
455 this.el.set_value(iter, 6, repo.git_working_dir );
457 var cb = repo.currentBranch;
458 //print(JSON.stringify(cb,null,4));
461 if (cb.lastrev != cb.remoterev) {
463 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
464 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
468 if (repo.has_local_changes) {
470 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
472 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
474 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
475 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote") +
476 "\nHas uncommitted changes" );
479 this.el.set_value(iter, 7, col );
480 var ticket = repo.activeTicket;
482 this.el.set_value(iter, 8, repo.is_auto_branch() );
483 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
487 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
491 public class Xcls_tv_autocommit : Object
493 public Gtk.TreeViewColumn el;
494 private Clones _this;
500 public Xcls_tv_autocommit(Clones _owner )
503 _this.tv_autocommit = this;
504 this.el = new Gtk.TreeViewColumn();
508 // set gobject values
509 this.el.title = "Auto Commit";
510 this.el.min_width = 50;
511 var child_0 = new Xcls_cr_autocommit( _this );
513 this.el.pack_start ( child_0.el , false );
517 // this.items[0].el.set_activatable(true);
518 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
521 // user defined functions
523 public class Xcls_cr_autocommit : Object
525 public Gtk.CellRendererToggle el;
526 private Clones _this;
532 public Xcls_cr_autocommit(Clones _owner )
535 _this.cr_autocommit = this;
536 this.el = new Gtk.CellRendererToggle();
540 // set gobject values
541 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
544 this.el.toggled.connect( (self, path) => {
547 _this.reposStore.el.get_iter_from_string(out iter, path);
551 _this.reposStore.el.get_value(iter, 4, out val);
552 _this.reposStore.el.get_value(iter, 6, out rval);
554 var repopath = (string)rval;
555 var bval = (bool)val;
556 _this.reposStore.el.set_value(iter, 4, !bval);
557 GLib.debug("got repopath? %s", repopath);
559 var repo = GitRepo.get(repopath);
560 repo.set_autocommit(!bval);
568 // user defined functions
572 public class Xcls_tv_autopush : Object
574 public Gtk.TreeViewColumn el;
575 private Clones _this;
581 public Xcls_tv_autopush(Clones _owner )
584 _this.tv_autopush = this;
585 this.el = new Gtk.TreeViewColumn();
589 // set gobject values
590 this.el.title = "Auto Push";
591 this.el.min_width = 50;
592 var child_0 = new Xcls_cr_autopush( _this );
594 this.el.pack_start ( child_0.el , false );
598 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
599 // this.items[0].el.set_activatable(true);
602 // user defined functions
604 public class Xcls_cr_autopush : Object
606 public Gtk.CellRendererToggle el;
607 private Clones _this;
613 public Xcls_cr_autopush(Clones _owner )
616 _this.cr_autopush = this;
617 this.el = new Gtk.CellRendererToggle();
621 // set gobject values
622 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
625 this.el.toggled.connect( (self, path) => {
628 _this.reposStore.el.get_iter_from_string(out iter, path);
632 _this.reposStore.el.get_value(iter, 5, out val);
633 _this.reposStore.el.get_value(iter, 6, out rval);
635 var repopath = (string)rval;
636 var bval = (bool)val;
637 _this.reposStore.el.set_value(iter, 5, !bval);
638 var repo = GitRepo.get(repopath);
639 repo.set_autopush(!bval);
647 // user defined functions
651 public class Xcls_tv_autobranch : Object
653 public Gtk.TreeViewColumn el;
654 private Clones _this;
660 public Xcls_tv_autobranch(Clones _owner )
663 _this.tv_autobranch = this;
664 this.el = new Gtk.TreeViewColumn();
668 // set gobject values
669 this.el.title = "Auto Branch";
670 this.el.min_width = 50;
671 var child_0 = new Xcls_cr_autobranch( _this );
673 this.el.pack_start ( child_0.el , false );
677 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
678 // this.items[0].el.set_activatable(true);
681 // user defined functions
683 public class Xcls_cr_autobranch : Object
685 public Gtk.CellRendererToggle el;
686 private Clones _this;
692 public Xcls_cr_autobranch(Clones _owner )
695 _this.cr_autobranch = this;
696 this.el = new Gtk.CellRendererToggle();
700 // set gobject values
701 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
704 this.el.toggled.connect( (self, path) => {
707 _this.reposStore.el.get_iter_from_string(out iter, path);
711 _this.reposStore.el.get_value(iter, 8, out val);
712 _this.reposStore.el.get_value(iter, 6, out rval);
714 var repopath = (string)rval;
715 var bval = (bool)val;
716 _this.reposStore.el.set_value(iter, 8, !bval);
717 var repo = GitRepo.get(repopath);
718 repo.set_auto_branch(!bval);
726 // user defined functions
730 public class Xcls_tv_repo : Object
732 public Gtk.TreeViewColumn el;
733 private Clones _this;
739 public Xcls_tv_repo(Clones _owner )
742 _this.tv_repo = this;
743 this.el = new Gtk.TreeViewColumn();
747 // set gobject values
748 this.el.sort_column_id = 0;
749 this.el.title = "Repo";
750 this.el.min_width = 200;
751 this.el.sort_order = Gtk.SortType.ASCENDING;
752 this.el.resizable = true;
753 var child_0 = new Xcls_cr_repo( _this );
755 this.el.pack_start ( child_0.el , false );
759 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
762 // user defined functions
764 public class Xcls_cr_repo : Object
766 public Gtk.CellRendererText el;
767 private Clones _this;
773 public Xcls_cr_repo(Clones _owner )
776 _this.cr_repo = this;
777 this.el = new Gtk.CellRendererText();
781 // set gobject values
784 // user defined functions
788 public class Xcls_tv_active_ticket : Object
790 public Gtk.TreeViewColumn el;
791 private Clones _this;
797 public Xcls_tv_active_ticket(Clones _owner )
800 _this.tv_active_ticket = this;
801 this.el = new Gtk.TreeViewColumn();
805 // set gobject values
806 this.el.title = "Active Ticket";
807 this.el.min_width = 50;
808 var child_0 = new Xcls_cr_active_ticket( _this );
810 this.el.pack_start ( child_0.el , false );
814 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
817 // user defined functions
819 public class Xcls_cr_active_ticket : Object
821 public Gtk.CellRendererText el;
822 private Clones _this;
828 public Xcls_cr_active_ticket(Clones _owner )
831 _this.cr_active_ticket = this;
832 this.el = new Gtk.CellRendererText();
836 // set gobject values
839 // user defined functions
843 public class Xcls_tv_current_branch : Object
845 public Gtk.TreeViewColumn el;
846 private Clones _this;
852 public Xcls_tv_current_branch(Clones _owner )
855 _this.tv_current_branch = this;
856 this.el = new Gtk.TreeViewColumn();
860 // set gobject values
861 this.el.title = "Current Branch";
862 this.el.min_width = 50;
863 var child_0 = new Xcls_cr_current_branch( _this );
865 this.el.pack_start ( child_0.el , false );
869 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
870 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
873 // user defined functions
875 public class Xcls_cr_current_branch : Object
877 public Gtk.CellRendererText el;
878 private Clones _this;
884 public Xcls_cr_current_branch(Clones _owner )
887 _this.cr_current_branch = this;
888 this.el = new Gtk.CellRendererText();
892 // set gobject values
895 // user defined functions
899 public class Xcls_tv_last_updated : Object
901 public Gtk.TreeViewColumn el;
902 private Clones _this;
908 public Xcls_tv_last_updated(Clones _owner )
911 _this.tv_last_updated = this;
912 this.el = new Gtk.TreeViewColumn();
916 // set gobject values
917 this.el.title = "Last updated";
918 this.el.min_width = 50;
919 var child_0 = new Xcls_cr_last_updated( _this );
921 this.el.pack_start ( child_0.el , false );
925 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
928 // user defined functions
930 public class Xcls_cr_last_updated : Object
932 public Gtk.CellRendererText el;
933 private Clones _this;
939 public Xcls_cr_last_updated(Clones _owner )
942 _this.cr_last_updated = this;
943 this.el = new Gtk.CellRendererText();
947 // set gobject values
950 // user defined functions
954 public class Xcls_tv_all_branches : Object
956 public Gtk.TreeViewColumn el;
957 private Clones _this;
963 public Xcls_tv_all_branches(Clones _owner )
966 _this.tv_all_branches = this;
967 this.el = new Gtk.TreeViewColumn();
971 // set gobject values
972 this.el.title = "All Branches";
973 this.el.min_width = 50;
974 this.el.resizable = false;
975 var child_0 = new Xcls_cr_all_branches( _this );
977 this.el.pack_start ( child_0.el , false );
981 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
984 // user defined functions
986 public class Xcls_cr_all_branches : Object
988 public Gtk.CellRendererText el;
989 private Clones _this;
995 public Xcls_cr_all_branches(Clones _owner )
998 _this.cr_all_branches = this;
999 this.el = new Gtk.CellRendererText();
1003 // set gobject values
1006 // user defined functions