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_reposView reposView;
17 public Xcls_reposStore reposStore;
18 public Xcls_tv_autocommit tv_autocommit;
19 public Xcls_cr_autocommit cr_autocommit;
20 public Xcls_tv_autopush tv_autopush;
21 public Xcls_cr_autopush cr_autopush;
22 public Xcls_tv_autobranch tv_autobranch;
23 public Xcls_cr_autobranch cr_autobranch;
24 public Xcls_tv_repo tv_repo;
25 public Xcls_cr_repo cr_repo;
26 public Xcls_tv_active_ticket tv_active_ticket;
27 public Xcls_cr_active_ticket cr_active_ticket;
28 public Xcls_tv_current_branch tv_current_branch;
29 public Xcls_cr_current_branch cr_current_branch;
30 public Xcls_tv_last_updated tv_last_updated;
31 public Xcls_cr_last_updated cr_last_updated;
32 public Xcls_tv_all_branches tv_all_branches;
33 public Xcls_cr_all_branches cr_all_branches;
41 this.el = new Gtk.Dialog();
46 this.el.title = "Manage Clones";
47 this.el.border_width = 3;
48 this.el.default_height = 500;
49 this.el.default_width = 1024;
50 this.el.deletable = true;
52 var child_0 = new Xcls_Box2( _this );
54 this.el.get_content_area().add ( child_0.el );
57 this.el.delete_event.connect( (self, event) => {
62 this.el.response.connect( (self, response_id) => {
69 // user defined functions
70 public void loadAndShow () {
71 _this.toolbar.el.hide();
72 _this.scrolled.el.hide();
73 _this.progress.el.show();
74 GitRepo.updateAll("show_clones");
81 GLib.debug("show clones?");
82 this.el.set_deletable(true);
83 this.el.set_gravity(Gdk.Gravity.NORTH);
84 this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
86 this.el.set_default_size(
87 int.min(1024,Gdk.Screen.width()),
88 int.max(500,Gdk.Screen.height() - 300)
92 _this.reposStore.load();
93 this.el.set_keep_above(true);
94 GLib.debug("show clones = run?");
97 // this.get('/reposStore').load();
99 //this.get('/ok_button').el.set_sensitive(false);
101 // block until we return.
102 // var run_ret = this.el.run();
103 // if (run_ret < 1 ) {
106 // print("RUN RETURN : " + run_ret);
108 //print(JSON.stringify(this.get('bug').getValue()));
109 // return this.get('bug').getValue();
110 //this.success = c.success;
112 public class Xcls_Box2 : Object
115 private Clones _this;
121 public Xcls_Box2(Clones _owner )
124 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
128 // set gobject values
129 var child_0 = new Xcls_toolbar( _this );
131 this.el.pack_start ( child_0.el , false,false,0 );
132 var child_1 = new Xcls_ScrolledWindow5( _this );
134 this.el.pack_end ( child_1.el , true,true,0 );
137 // user defined functions
139 public class Xcls_toolbar : Object
142 private Clones _this;
148 public Xcls_toolbar(Clones _owner )
151 _this.toolbar = this;
152 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
156 // set gobject values
157 this.el.homogeneous = true;
158 var child_0 = new Xcls_Button4( _this );
160 this.el.add ( child_0.el );
163 // user defined functions
165 public class Xcls_Button4 : Object
167 public Gtk.Button el;
168 private Clones _this;
174 public Xcls_Button4(Clones _owner )
177 this.el = new Gtk.Button();
181 // set gobject values
182 this.el.label = "Add Repository";
187 this.el.get_style_context().add_class("suggested-action");
191 this.el.clicked.connect( () => {
192 Clone.singleton().show(this.el);
199 // user defined functions
203 public class Xcls_ScrolledWindow5 : Object
205 public Gtk.ScrolledWindow el;
206 private Clones _this;
212 public Xcls_ScrolledWindow5(Clones _owner )
215 this.el = new Gtk.ScrolledWindow( null, null );
219 // set gobject values
220 this.el.expand = true;
221 this.el.hexpand = true;
222 this.el.shadow_type = Gtk.ShadowType.IN;
223 var child_0 = new Xcls_reposView( _this );
225 this.el.add ( child_0.el );
231 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
235 // user defined functions
237 public class Xcls_reposView : Object
239 public Gtk.TreeView el;
240 private Clones _this;
246 public Xcls_reposView(Clones _owner )
249 _this.reposView = this;
250 this.el = new Gtk.TreeView();
254 // set gobject values
255 this.el.search_column = 0;
256 this.el.activate_on_single_click = true;
257 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
258 var child_0 = new Xcls_reposStore( _this );
260 this.el.set_model ( child_0.el );
261 var child_1 = new Xcls_tv_autocommit( _this );
263 this.el.append_column ( child_1.el );
264 var child_2 = new Xcls_tv_autopush( _this );
266 this.el.append_column ( child_2.el );
267 var child_3 = new Xcls_tv_autobranch( _this );
269 this.el.append_column ( child_3.el );
270 var child_4 = new Xcls_tv_repo( _this );
272 this.el.append_column ( child_4.el );
273 var child_5 = new Xcls_tv_active_ticket( _this );
275 this.el.append_column ( child_5.el );
276 var child_6 = new Xcls_tv_current_branch( _this );
278 this.el.append_column ( child_6.el );
279 var child_7 = new Xcls_tv_last_updated( _this );
281 this.el.append_column ( child_7.el );
282 var child_8 = new Xcls_tv_all_branches( _this );
284 this.el.append_column ( child_8.el );
289 var selection = this.el.get_selection();
290 selection.set_mode( Gtk.SelectionMode.SINGLE);
293 var description = new Pango.FontDescription();
294 description.set_size(10000);
295 this.el.override_font(description);
300 this.el.row_activated.connect( (path, col) => {
302 if (col.title != "Current Branch") {
309 _this.reposStore.el.get_iter(out iter, path);
311 _this.reposStore.el.get_value(iter, 6, out val);
312 var git_working_dir = (string)val;
314 var repo = GitRepo.singleton().get(git_working_dir);
317 _this.reposView.el.get_cell_area(path, col, out rect);
318 RepoStatusPopover.singleton().show(this.el, rect, repo);
323 this.el.cursor_changed.connect( () => {
324 // SEE SELECTION.CHANGED
329 if (this.el.get_selection().count_selected_rows() < 1) {
330 //nothing? - clea it?
334 var model = this.get('/changedFilesStore');
336 var s = this.el.get_selection();
338 s.selected_foreach(function(model,p,iter) {
340 files.push( model.get_value(iter, 0).value.get_string());
343 this.get('/patchview').showDiff(files);
344 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
345 //print("OUT?" + value);// id..
346 // load the list in the right grid..
353 // user defined functions
355 public class Xcls_reposStore : Object
357 public Gtk.ListStore el;
358 private Clones _this;
364 public Xcls_reposStore(Clones _owner )
367 _this.reposStore = this;
368 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
369 typeof(string), // 1 current branch
370 typeof(string), // 2 all branch
371 typeof(string), // 3 updated
372 typeof(bool), // 4 auto commit
373 typeof(bool), // 5 auto push
374 typeof(string), // 6 repopath
375 typeof(string), // 7 color highlighting?
376 typeof(bool), // 8 auto branch,
377 typeof(string) // 9 active Ticket
382 // set gobject values
385 // user defined functions
388 //this.insert(citer,iter,0);
389 print("getting list");
390 var tr = GitRepo.list();
394 // fixme .. sort by last updated ...
397 for(var i =0 ; i < tr.length; i++) {
398 var repo = tr.index(i);
399 // this is done before we display stuff...
400 //repo.loadBranches();
404 this.el.append(out iter);
406 //print(JSON.stringify(ret,null,4));
407 //tr[i].getBranches();
412 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
413 // print(JSON.stringify(hi,null,4));
414 // } catch(e) { print(e);}
416 this.el.set_value(iter, 0, repo.name );
417 this.el.set_value( iter, 1, repo.currentBranch.name );
418 this.el.set_value( iter, 2, repo.branchesToString() );
419 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
420 // function(e) { return e.name;
423 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
424 this.el.set_value(iter, 4, repo.is_autocommit() );
425 this.el.set_value(iter, 5, repo.is_autopush() );
426 this.el.set_value(iter, 6, repo.git_working_dir );
428 var cb = repo.currentBranch;
429 //print(JSON.stringify(cb,null,4));
432 if (cb.lastrev != cb.remoterev) {
434 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
435 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
439 if (repo.has_local_changes) {
441 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
443 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
445 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
446 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote") +
447 "\nHas uncommitted changes" );
450 this.el.set_value(iter, 7, col );
451 var ticket = repo.activeTicket;
453 this.el.set_value(iter, 8, repo.is_auto_branch() );
454 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
458 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
462 public class Xcls_tv_autocommit : Object
464 public Gtk.TreeViewColumn el;
465 private Clones _this;
471 public Xcls_tv_autocommit(Clones _owner )
474 _this.tv_autocommit = this;
475 this.el = new Gtk.TreeViewColumn();
479 // set gobject values
480 this.el.title = "Auto Commit";
481 this.el.min_width = 50;
482 var child_0 = new Xcls_cr_autocommit( _this );
484 this.el.pack_start ( child_0.el , false );
488 // this.items[0].el.set_activatable(true);
489 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
492 // user defined functions
494 public class Xcls_cr_autocommit : Object
496 public Gtk.CellRendererToggle el;
497 private Clones _this;
503 public Xcls_cr_autocommit(Clones _owner )
506 _this.cr_autocommit = this;
507 this.el = new Gtk.CellRendererToggle();
511 // set gobject values
512 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
515 this.el.toggled.connect( (self, path) => {
518 _this.reposStore.el.get_iter_from_string(out iter, path);
522 _this.reposStore.el.get_value(iter, 4, out val);
523 _this.reposStore.el.get_value(iter, 6, out rval);
525 var repopath = (string)rval;
526 var bval = (bool)val;
527 _this.reposStore.el.set_value(iter, 4, !bval);
528 GLib.debug("got repopath? %s", repopath);
530 var repo = GitRepo.get(repopath);
531 repo.set_autocommit(!bval);
539 // user defined functions
543 public class Xcls_tv_autopush : Object
545 public Gtk.TreeViewColumn el;
546 private Clones _this;
552 public Xcls_tv_autopush(Clones _owner )
555 _this.tv_autopush = this;
556 this.el = new Gtk.TreeViewColumn();
560 // set gobject values
561 this.el.title = "Auto Push";
562 this.el.min_width = 50;
563 var child_0 = new Xcls_cr_autopush( _this );
565 this.el.pack_start ( child_0.el , false );
569 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
570 // this.items[0].el.set_activatable(true);
573 // user defined functions
575 public class Xcls_cr_autopush : Object
577 public Gtk.CellRendererToggle el;
578 private Clones _this;
584 public Xcls_cr_autopush(Clones _owner )
587 _this.cr_autopush = this;
588 this.el = new Gtk.CellRendererToggle();
592 // set gobject values
593 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
596 this.el.toggled.connect( (self, path) => {
599 _this.reposStore.el.get_iter_from_string(out iter, path);
603 _this.reposStore.el.get_value(iter, 5, out val);
604 _this.reposStore.el.get_value(iter, 6, out rval);
606 var repopath = (string)rval;
607 var bval = (bool)val;
608 _this.reposStore.el.set_value(iter, 5, !bval);
609 var repo = GitRepo.get(repopath);
610 repo.set_autopush(!bval);
618 // user defined functions
622 public class Xcls_tv_autobranch : Object
624 public Gtk.TreeViewColumn el;
625 private Clones _this;
631 public Xcls_tv_autobranch(Clones _owner )
634 _this.tv_autobranch = this;
635 this.el = new Gtk.TreeViewColumn();
639 // set gobject values
640 this.el.title = "Auto Branch";
641 this.el.min_width = 50;
642 var child_0 = new Xcls_cr_autobranch( _this );
644 this.el.pack_start ( child_0.el , false );
648 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
649 // this.items[0].el.set_activatable(true);
652 // user defined functions
654 public class Xcls_cr_autobranch : Object
656 public Gtk.CellRendererToggle el;
657 private Clones _this;
663 public Xcls_cr_autobranch(Clones _owner )
666 _this.cr_autobranch = this;
667 this.el = new Gtk.CellRendererToggle();
671 // set gobject values
672 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
675 this.el.toggled.connect( (self, path) => {
678 _this.reposStore.el.get_iter_from_string(out iter, path);
682 _this.reposStore.el.get_value(iter, 8, out val);
683 _this.reposStore.el.get_value(iter, 6, out rval);
685 var repopath = (string)rval;
686 var bval = (bool)val;
687 _this.reposStore.el.set_value(iter, 8, !bval);
688 var repo = GitRepo.get(repopath);
689 repo.set_auto_branch(!bval);
697 // user defined functions
701 public class Xcls_tv_repo : Object
703 public Gtk.TreeViewColumn el;
704 private Clones _this;
710 public Xcls_tv_repo(Clones _owner )
713 _this.tv_repo = this;
714 this.el = new Gtk.TreeViewColumn();
718 // set gobject values
719 this.el.sort_column_id = 0;
720 this.el.title = "Repo";
721 this.el.min_width = 200;
722 this.el.sort_order = Gtk.SortType.ASCENDING;
723 this.el.resizable = true;
724 var child_0 = new Xcls_cr_repo( _this );
726 this.el.pack_start ( child_0.el , false );
730 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
733 // user defined functions
735 public class Xcls_cr_repo : Object
737 public Gtk.CellRendererText el;
738 private Clones _this;
744 public Xcls_cr_repo(Clones _owner )
747 _this.cr_repo = this;
748 this.el = new Gtk.CellRendererText();
752 // set gobject values
755 // user defined functions
759 public class Xcls_tv_active_ticket : Object
761 public Gtk.TreeViewColumn el;
762 private Clones _this;
768 public Xcls_tv_active_ticket(Clones _owner )
771 _this.tv_active_ticket = this;
772 this.el = new Gtk.TreeViewColumn();
776 // set gobject values
777 this.el.title = "Active Ticket";
778 this.el.min_width = 50;
779 var child_0 = new Xcls_cr_active_ticket( _this );
781 this.el.pack_start ( child_0.el , false );
785 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
788 // user defined functions
790 public class Xcls_cr_active_ticket : Object
792 public Gtk.CellRendererText el;
793 private Clones _this;
799 public Xcls_cr_active_ticket(Clones _owner )
802 _this.cr_active_ticket = this;
803 this.el = new Gtk.CellRendererText();
807 // set gobject values
810 // user defined functions
814 public class Xcls_tv_current_branch : Object
816 public Gtk.TreeViewColumn el;
817 private Clones _this;
823 public Xcls_tv_current_branch(Clones _owner )
826 _this.tv_current_branch = this;
827 this.el = new Gtk.TreeViewColumn();
831 // set gobject values
832 this.el.title = "Current Branch";
833 this.el.min_width = 50;
834 var child_0 = new Xcls_cr_current_branch( _this );
836 this.el.pack_start ( child_0.el , false );
840 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
841 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
844 // user defined functions
846 public class Xcls_cr_current_branch : Object
848 public Gtk.CellRendererText el;
849 private Clones _this;
855 public Xcls_cr_current_branch(Clones _owner )
858 _this.cr_current_branch = this;
859 this.el = new Gtk.CellRendererText();
863 // set gobject values
866 // user defined functions
870 public class Xcls_tv_last_updated : Object
872 public Gtk.TreeViewColumn el;
873 private Clones _this;
879 public Xcls_tv_last_updated(Clones _owner )
882 _this.tv_last_updated = this;
883 this.el = new Gtk.TreeViewColumn();
887 // set gobject values
888 this.el.title = "Last updated";
889 this.el.min_width = 50;
890 var child_0 = new Xcls_cr_last_updated( _this );
892 this.el.pack_start ( child_0.el , false );
896 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
899 // user defined functions
901 public class Xcls_cr_last_updated : Object
903 public Gtk.CellRendererText el;
904 private Clones _this;
910 public Xcls_cr_last_updated(Clones _owner )
913 _this.cr_last_updated = this;
914 this.el = new Gtk.CellRendererText();
918 // set gobject values
921 // user defined functions
925 public class Xcls_tv_all_branches : Object
927 public Gtk.TreeViewColumn el;
928 private Clones _this;
934 public Xcls_tv_all_branches(Clones _owner )
937 _this.tv_all_branches = this;
938 this.el = new Gtk.TreeViewColumn();
942 // set gobject values
943 this.el.title = "All Branches";
944 this.el.min_width = 50;
945 this.el.resizable = false;
946 var child_0 = new Xcls_cr_all_branches( _this );
948 this.el.pack_start ( child_0.el , false );
952 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
955 // user defined functions
957 public class Xcls_cr_all_branches : Object
959 public Gtk.CellRendererText el;
960 private Clones _this;
966 public Xcls_cr_all_branches(Clones _owner )
969 _this.cr_all_branches = this;
970 this.el = new Gtk.CellRendererText();
974 // set gobject values
977 // user defined functions