3 public class Clones : Object
8 public static Clones singleton()
10 if (_Clones == null) {
11 _Clones= new Clones();
15 public Xcls_toolbar toolbar;
16 public Xcls_scrolled scrolled;
17 public Xcls_reposView reposView;
18 public Xcls_reposStore reposStore;
19 public Xcls_tv_autocommit tv_autocommit;
20 public Xcls_cr_autocommit cr_autocommit;
21 public Xcls_tv_autopush tv_autopush;
22 public Xcls_cr_autopush cr_autopush;
23 public Xcls_tv_autobranch tv_autobranch;
24 public Xcls_cr_autobranch cr_autobranch;
25 public Xcls_tv_repo tv_repo;
26 public Xcls_cr_repo cr_repo;
27 public Xcls_tv_active_ticket tv_active_ticket;
28 public Xcls_cr_active_ticket cr_active_ticket;
29 public Xcls_tv_current_branch tv_current_branch;
30 public Xcls_cr_current_branch cr_current_branch;
31 public Xcls_tv_last_updated tv_last_updated;
32 public Xcls_cr_last_updated cr_last_updated;
33 public Xcls_tv_all_branches tv_all_branches;
34 public Xcls_cr_all_branches cr_all_branches;
42 this.el = new Gtk.Dialog();
47 this.el.title = "Manage Clones";
48 this.el.border_width = 3;
49 this.el.default_height = 500;
50 this.el.default_width = 1024;
51 this.el.deletable = true;
53 var child_0 = new Xcls_Box2( _this );
55 this.el.get_content_area().add ( child_0.el );
58 this.el.delete_event.connect( (self, event) => {
63 this.el.response.connect( (self, response_id) => {
70 // user defined functions
71 public void loadAndShow () {
72 _this.toolbar.el.hide();
73 _this.scrolled.el.hide();
74 _this.progress.el.show();
75 GitRepo.updateAll("show_clones");
82 GLib.debug("show clones?");
83 this.el.set_deletable(true);
84 this.el.set_gravity(Gdk.Gravity.NORTH);
85 this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
87 this.el.set_default_size(
88 int.min(1024,Gdk.Screen.width()),
89 int.max(500,Gdk.Screen.height() - 300)
93 _this.reposStore.load();
94 this.el.set_keep_above(true);
95 GLib.debug("show clones = run?");
98 // this.get('/reposStore').load();
100 //this.get('/ok_button').el.set_sensitive(false);
102 // block until we return.
103 // var run_ret = this.el.run();
104 // if (run_ret < 1 ) {
107 // print("RUN RETURN : " + run_ret);
109 //print(JSON.stringify(this.get('bug').getValue()));
110 // return this.get('bug').getValue();
111 //this.success = c.success;
113 public class Xcls_Box2 : Object
116 private Clones _this;
122 public Xcls_Box2(Clones _owner )
125 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
129 // set gobject values
130 var child_0 = new Xcls_Spinner3( _this );
132 this.el.pack_start ( child_0.el , ?bool?,?bool?,?uint? );
133 var child_1 = new Xcls_toolbar( _this );
135 this.el.pack_start ( child_1.el , false,false,0 );
136 var child_2 = new Xcls_scrolled( _this );
138 this.el.pack_end ( child_2.el , true,true,0 );
141 // user defined functions
143 public class Xcls_Spinner3 : Object
145 public Gtk.Spinner el;
146 private Clones _this;
152 public Xcls_Spinner3(Clones _owner )
155 this.el = new Gtk.Spinner();
159 // set gobject values
162 // user defined functions
165 public class Xcls_toolbar : Object
168 private Clones _this;
174 public Xcls_toolbar(Clones _owner )
177 _this.toolbar = this;
178 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
182 // set gobject values
183 this.el.homogeneous = true;
184 var child_0 = new Xcls_Button5( _this );
186 this.el.add ( child_0.el );
189 // user defined functions
191 public class Xcls_Button5 : Object
193 public Gtk.Button el;
194 private Clones _this;
200 public Xcls_Button5(Clones _owner )
203 this.el = new Gtk.Button();
207 // set gobject values
208 this.el.label = "Add Repository";
213 this.el.get_style_context().add_class("suggested-action");
217 this.el.clicked.connect( () => {
218 Clone.singleton().show(this.el);
225 // user defined functions
229 public class Xcls_scrolled : Object
231 public Gtk.ScrolledWindow el;
232 private Clones _this;
238 public Xcls_scrolled(Clones _owner )
241 _this.scrolled = this;
242 this.el = new Gtk.ScrolledWindow( null, null );
246 // set gobject values
247 this.el.expand = true;
248 this.el.hexpand = true;
249 this.el.shadow_type = Gtk.ShadowType.IN;
250 var child_0 = new Xcls_reposView( _this );
252 this.el.add ( child_0.el );
258 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
262 // user defined functions
264 public class Xcls_reposView : Object
266 public Gtk.TreeView el;
267 private Clones _this;
273 public Xcls_reposView(Clones _owner )
276 _this.reposView = this;
277 this.el = new Gtk.TreeView();
281 // set gobject values
282 this.el.search_column = 0;
283 this.el.activate_on_single_click = true;
284 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
285 var child_0 = new Xcls_reposStore( _this );
287 this.el.set_model ( child_0.el );
288 var child_1 = new Xcls_tv_autocommit( _this );
290 this.el.append_column ( child_1.el );
291 var child_2 = new Xcls_tv_autopush( _this );
293 this.el.append_column ( child_2.el );
294 var child_3 = new Xcls_tv_autobranch( _this );
296 this.el.append_column ( child_3.el );
297 var child_4 = new Xcls_tv_repo( _this );
299 this.el.append_column ( child_4.el );
300 var child_5 = new Xcls_tv_active_ticket( _this );
302 this.el.append_column ( child_5.el );
303 var child_6 = new Xcls_tv_current_branch( _this );
305 this.el.append_column ( child_6.el );
306 var child_7 = new Xcls_tv_last_updated( _this );
308 this.el.append_column ( child_7.el );
309 var child_8 = new Xcls_tv_all_branches( _this );
311 this.el.append_column ( child_8.el );
316 var selection = this.el.get_selection();
317 selection.set_mode( Gtk.SelectionMode.SINGLE);
320 var description = new Pango.FontDescription();
321 description.set_size(10000);
322 this.el.override_font(description);
327 this.el.row_activated.connect( (path, col) => {
329 if (col.title != "Current Branch") {
336 _this.reposStore.el.get_iter(out iter, path);
338 _this.reposStore.el.get_value(iter, 6, out val);
339 var git_working_dir = (string)val;
341 var repo = GitRepo.singleton().get(git_working_dir);
344 _this.reposView.el.get_cell_area(path, col, out rect);
345 RepoStatusPopover.singleton().show(this.el, rect, repo);
350 this.el.cursor_changed.connect( () => {
351 // SEE SELECTION.CHANGED
356 if (this.el.get_selection().count_selected_rows() < 1) {
357 //nothing? - clea it?
361 var model = this.get('/changedFilesStore');
363 var s = this.el.get_selection();
365 s.selected_foreach(function(model,p,iter) {
367 files.push( model.get_value(iter, 0).value.get_string());
370 this.get('/patchview').showDiff(files);
371 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
372 //print("OUT?" + value);// id..
373 // load the list in the right grid..
380 // user defined functions
382 public class Xcls_reposStore : Object
384 public Gtk.ListStore el;
385 private Clones _this;
391 public Xcls_reposStore(Clones _owner )
394 _this.reposStore = this;
395 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
396 typeof(string), // 1 current branch
397 typeof(string), // 2 all branch
398 typeof(string), // 3 updated
399 typeof(bool), // 4 auto commit
400 typeof(bool), // 5 auto push
401 typeof(string), // 6 repopath
402 typeof(string), // 7 color highlighting?
403 typeof(bool), // 8 auto branch,
404 typeof(string) // 9 active Ticket
409 // set gobject values
412 // user defined functions
415 //this.insert(citer,iter,0);
416 print("getting list");
417 var tr = GitRepo.list();
421 // fixme .. sort by last updated ...
424 for(var i =0 ; i < tr.length; i++) {
425 var repo = tr.index(i);
426 // this is done before we display stuff...
427 //repo.loadBranches();
431 this.el.append(out iter);
433 //print(JSON.stringify(ret,null,4));
434 //tr[i].getBranches();
439 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
440 // print(JSON.stringify(hi,null,4));
441 // } catch(e) { print(e);}
443 this.el.set_value(iter, 0, repo.name );
444 this.el.set_value( iter, 1, repo.currentBranch.name );
445 this.el.set_value( iter, 2, repo.branchesToString() );
446 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
447 // function(e) { return e.name;
450 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
451 this.el.set_value(iter, 4, repo.is_autocommit() );
452 this.el.set_value(iter, 5, repo.is_autopush() );
453 this.el.set_value(iter, 6, repo.git_working_dir );
455 var cb = repo.currentBranch;
456 //print(JSON.stringify(cb,null,4));
459 if (cb.lastrev != cb.remoterev) {
461 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
462 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
466 if (repo.has_local_changes) {
468 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
470 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
472 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
473 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote") +
474 "\nHas uncommitted changes" );
477 this.el.set_value(iter, 7, col );
478 var ticket = repo.activeTicket;
480 this.el.set_value(iter, 8, repo.is_auto_branch() );
481 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
485 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
489 public class Xcls_tv_autocommit : Object
491 public Gtk.TreeViewColumn el;
492 private Clones _this;
498 public Xcls_tv_autocommit(Clones _owner )
501 _this.tv_autocommit = this;
502 this.el = new Gtk.TreeViewColumn();
506 // set gobject values
507 this.el.title = "Auto Commit";
508 this.el.min_width = 50;
509 var child_0 = new Xcls_cr_autocommit( _this );
511 this.el.pack_start ( child_0.el , false );
515 // this.items[0].el.set_activatable(true);
516 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
519 // user defined functions
521 public class Xcls_cr_autocommit : Object
523 public Gtk.CellRendererToggle el;
524 private Clones _this;
530 public Xcls_cr_autocommit(Clones _owner )
533 _this.cr_autocommit = this;
534 this.el = new Gtk.CellRendererToggle();
538 // set gobject values
539 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
542 this.el.toggled.connect( (self, path) => {
545 _this.reposStore.el.get_iter_from_string(out iter, path);
549 _this.reposStore.el.get_value(iter, 4, out val);
550 _this.reposStore.el.get_value(iter, 6, out rval);
552 var repopath = (string)rval;
553 var bval = (bool)val;
554 _this.reposStore.el.set_value(iter, 4, !bval);
555 GLib.debug("got repopath? %s", repopath);
557 var repo = GitRepo.get(repopath);
558 repo.set_autocommit(!bval);
566 // user defined functions
570 public class Xcls_tv_autopush : Object
572 public Gtk.TreeViewColumn el;
573 private Clones _this;
579 public Xcls_tv_autopush(Clones _owner )
582 _this.tv_autopush = this;
583 this.el = new Gtk.TreeViewColumn();
587 // set gobject values
588 this.el.title = "Auto Push";
589 this.el.min_width = 50;
590 var child_0 = new Xcls_cr_autopush( _this );
592 this.el.pack_start ( child_0.el , false );
596 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
597 // this.items[0].el.set_activatable(true);
600 // user defined functions
602 public class Xcls_cr_autopush : Object
604 public Gtk.CellRendererToggle el;
605 private Clones _this;
611 public Xcls_cr_autopush(Clones _owner )
614 _this.cr_autopush = this;
615 this.el = new Gtk.CellRendererToggle();
619 // set gobject values
620 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
623 this.el.toggled.connect( (self, path) => {
626 _this.reposStore.el.get_iter_from_string(out iter, path);
630 _this.reposStore.el.get_value(iter, 5, out val);
631 _this.reposStore.el.get_value(iter, 6, out rval);
633 var repopath = (string)rval;
634 var bval = (bool)val;
635 _this.reposStore.el.set_value(iter, 5, !bval);
636 var repo = GitRepo.get(repopath);
637 repo.set_autopush(!bval);
645 // user defined functions
649 public class Xcls_tv_autobranch : Object
651 public Gtk.TreeViewColumn el;
652 private Clones _this;
658 public Xcls_tv_autobranch(Clones _owner )
661 _this.tv_autobranch = this;
662 this.el = new Gtk.TreeViewColumn();
666 // set gobject values
667 this.el.title = "Auto Branch";
668 this.el.min_width = 50;
669 var child_0 = new Xcls_cr_autobranch( _this );
671 this.el.pack_start ( child_0.el , false );
675 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
676 // this.items[0].el.set_activatable(true);
679 // user defined functions
681 public class Xcls_cr_autobranch : Object
683 public Gtk.CellRendererToggle el;
684 private Clones _this;
690 public Xcls_cr_autobranch(Clones _owner )
693 _this.cr_autobranch = this;
694 this.el = new Gtk.CellRendererToggle();
698 // set gobject values
699 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
702 this.el.toggled.connect( (self, path) => {
705 _this.reposStore.el.get_iter_from_string(out iter, path);
709 _this.reposStore.el.get_value(iter, 8, out val);
710 _this.reposStore.el.get_value(iter, 6, out rval);
712 var repopath = (string)rval;
713 var bval = (bool)val;
714 _this.reposStore.el.set_value(iter, 8, !bval);
715 var repo = GitRepo.get(repopath);
716 repo.set_auto_branch(!bval);
724 // user defined functions
728 public class Xcls_tv_repo : Object
730 public Gtk.TreeViewColumn el;
731 private Clones _this;
737 public Xcls_tv_repo(Clones _owner )
740 _this.tv_repo = this;
741 this.el = new Gtk.TreeViewColumn();
745 // set gobject values
746 this.el.sort_column_id = 0;
747 this.el.title = "Repo";
748 this.el.min_width = 200;
749 this.el.sort_order = Gtk.SortType.ASCENDING;
750 this.el.resizable = true;
751 var child_0 = new Xcls_cr_repo( _this );
753 this.el.pack_start ( child_0.el , false );
757 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
760 // user defined functions
762 public class Xcls_cr_repo : Object
764 public Gtk.CellRendererText el;
765 private Clones _this;
771 public Xcls_cr_repo(Clones _owner )
774 _this.cr_repo = this;
775 this.el = new Gtk.CellRendererText();
779 // set gobject values
782 // user defined functions
786 public class Xcls_tv_active_ticket : Object
788 public Gtk.TreeViewColumn el;
789 private Clones _this;
795 public Xcls_tv_active_ticket(Clones _owner )
798 _this.tv_active_ticket = this;
799 this.el = new Gtk.TreeViewColumn();
803 // set gobject values
804 this.el.title = "Active Ticket";
805 this.el.min_width = 50;
806 var child_0 = new Xcls_cr_active_ticket( _this );
808 this.el.pack_start ( child_0.el , false );
812 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
815 // user defined functions
817 public class Xcls_cr_active_ticket : Object
819 public Gtk.CellRendererText el;
820 private Clones _this;
826 public Xcls_cr_active_ticket(Clones _owner )
829 _this.cr_active_ticket = this;
830 this.el = new Gtk.CellRendererText();
834 // set gobject values
837 // user defined functions
841 public class Xcls_tv_current_branch : Object
843 public Gtk.TreeViewColumn el;
844 private Clones _this;
850 public Xcls_tv_current_branch(Clones _owner )
853 _this.tv_current_branch = this;
854 this.el = new Gtk.TreeViewColumn();
858 // set gobject values
859 this.el.title = "Current Branch";
860 this.el.min_width = 50;
861 var child_0 = new Xcls_cr_current_branch( _this );
863 this.el.pack_start ( child_0.el , false );
867 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
868 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
871 // user defined functions
873 public class Xcls_cr_current_branch : Object
875 public Gtk.CellRendererText el;
876 private Clones _this;
882 public Xcls_cr_current_branch(Clones _owner )
885 _this.cr_current_branch = this;
886 this.el = new Gtk.CellRendererText();
890 // set gobject values
893 // user defined functions
897 public class Xcls_tv_last_updated : Object
899 public Gtk.TreeViewColumn el;
900 private Clones _this;
906 public Xcls_tv_last_updated(Clones _owner )
909 _this.tv_last_updated = this;
910 this.el = new Gtk.TreeViewColumn();
914 // set gobject values
915 this.el.title = "Last updated";
916 this.el.min_width = 50;
917 var child_0 = new Xcls_cr_last_updated( _this );
919 this.el.pack_start ( child_0.el , false );
923 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
926 // user defined functions
928 public class Xcls_cr_last_updated : Object
930 public Gtk.CellRendererText el;
931 private Clones _this;
937 public Xcls_cr_last_updated(Clones _owner )
940 _this.cr_last_updated = this;
941 this.el = new Gtk.CellRendererText();
945 // set gobject values
948 // user defined functions
952 public class Xcls_tv_all_branches : Object
954 public Gtk.TreeViewColumn el;
955 private Clones _this;
961 public Xcls_tv_all_branches(Clones _owner )
964 _this.tv_all_branches = this;
965 this.el = new Gtk.TreeViewColumn();
969 // set gobject values
970 this.el.title = "All Branches";
971 this.el.min_width = 50;
972 this.el.resizable = false;
973 var child_0 = new Xcls_cr_all_branches( _this );
975 this.el.pack_start ( child_0.el , false );
979 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
982 // user defined functions
984 public class Xcls_cr_all_branches : Object
986 public Gtk.CellRendererText el;
987 private Clones _this;
993 public Xcls_cr_all_branches(Clones _owner )
996 _this.cr_all_branches = this;
997 this.el = new Gtk.CellRendererText();
1001 // set gobject values
1004 // user defined functions