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;
40 this.el = new Gtk.Dialog();
45 this.el.title = "Manage Clones";
46 this.el.border_width = 3;
47 this.el.default_height = 500;
48 this.el.default_width = 1024;
49 this.el.deletable = true;
51 var child_0 = new Xcls_Box2( _this );
53 this.el.get_content_area().add ( child_0.el );
56 this.el.delete_event.connect( (self, event) => {
61 this.el.response.connect( (self, response_id) => {
68 // user defined functions
69 public void loadAndShow () {
71 GitRepo.updateAll("show_clones");
75 GLib.debug("show clones?");
76 this.el.set_deletable(true);
77 this.el.set_gravity(Gdk.Gravity.NORTH);
78 this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
80 this.el.set_default_size(
81 int.min(1024,Gdk.Screen.width()),
82 int.max(500,Gdk.Screen.height() - 300)
86 _this.reposStore.load();
87 this.el.set_keep_above(true);
88 GLib.debug("show clones = run?");
91 // this.get('/reposStore').load();
93 //this.get('/ok_button').el.set_sensitive(false);
95 // block until we return.
96 // var run_ret = this.el.run();
97 // if (run_ret < 1 ) {
100 // print("RUN RETURN : " + run_ret);
102 //print(JSON.stringify(this.get('bug').getValue()));
103 // return this.get('bug').getValue();
104 //this.success = c.success;
106 public class Xcls_Box2 : Object
109 private Clones _this;
115 public Xcls_Box2(Clones _owner )
118 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
122 // set gobject values
123 var child_0 = new Xcls_Box3( _this );
125 this.el.pack_start ( child_0.el , false,false,0 );
126 var child_1 = new Xcls_ScrolledWindow5( _this );
128 this.el.pack_end ( child_1.el , true,true,0 );
131 // user defined functions
133 public class Xcls_Box3 : Object
136 private Clones _this;
142 public Xcls_Box3(Clones _owner )
145 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
149 // set gobject values
150 this.el.homogeneous = true;
151 var child_0 = new Xcls_Button4( _this );
153 this.el.add ( child_0.el );
156 // user defined functions
158 public class Xcls_Button4 : Object
160 public Gtk.Button el;
161 private Clones _this;
167 public Xcls_Button4(Clones _owner )
170 this.el = new Gtk.Button();
174 // set gobject values
175 this.el.label = "Add Repository";
180 this.el.get_style_context().add_class("suggested-action");
184 this.el.clicked.connect( () => {
185 Clone.singleton().show(this.el);
192 // user defined functions
196 public class Xcls_ScrolledWindow5 : Object
198 public Gtk.ScrolledWindow el;
199 private Clones _this;
205 public Xcls_ScrolledWindow5(Clones _owner )
208 this.el = new Gtk.ScrolledWindow( null, null );
212 // set gobject values
213 this.el.expand = true;
214 this.el.hexpand = true;
215 this.el.shadow_type = Gtk.ShadowType.IN;
216 var child_0 = new Xcls_reposView( _this );
218 this.el.add ( child_0.el );
224 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
228 // user defined functions
230 public class Xcls_reposView : Object
232 public Gtk.TreeView el;
233 private Clones _this;
239 public Xcls_reposView(Clones _owner )
242 _this.reposView = this;
243 this.el = new Gtk.TreeView();
247 // set gobject values
248 this.el.search_column = 0;
249 this.el.activate_on_single_click = true;
250 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
251 var child_0 = new Xcls_reposStore( _this );
253 this.el.set_model ( child_0.el );
254 var child_1 = new Xcls_tv_autocommit( _this );
256 this.el.append_column ( child_1.el );
257 var child_2 = new Xcls_tv_autopush( _this );
259 this.el.append_column ( child_2.el );
260 var child_3 = new Xcls_tv_autobranch( _this );
262 this.el.append_column ( child_3.el );
263 var child_4 = new Xcls_tv_repo( _this );
265 this.el.append_column ( child_4.el );
266 var child_5 = new Xcls_tv_active_ticket( _this );
268 this.el.append_column ( child_5.el );
269 var child_6 = new Xcls_tv_current_branch( _this );
271 this.el.append_column ( child_6.el );
272 var child_7 = new Xcls_tv_last_updated( _this );
274 this.el.append_column ( child_7.el );
275 var child_8 = new Xcls_tv_all_branches( _this );
277 this.el.append_column ( child_8.el );
282 var selection = this.el.get_selection();
283 selection.set_mode( Gtk.SelectionMode.SINGLE);
286 var description = new Pango.FontDescription();
287 description.set_size(10000);
288 this.el.override_font(description);
293 this.el.row_activated.connect( (path, col) => {
295 if (col.title != "Current Branch") {
302 _this.reposStore.el.get_iter(out iter, path);
304 _this.reposStore.el.get_value(iter, 6, out val);
305 var git_working_dir = (string)val;
307 var repo = GitRepo.singleton().get(git_working_dir);
310 _this.reposView.el.get_cell_area(path, col, out rect);
311 RepoStatusPopover.singleton().show(this.el, rect, repo);
316 this.el.cursor_changed.connect( () => {
317 // SEE SELECTION.CHANGED
322 if (this.el.get_selection().count_selected_rows() < 1) {
323 //nothing? - clea it?
327 var model = this.get('/changedFilesStore');
329 var s = this.el.get_selection();
331 s.selected_foreach(function(model,p,iter) {
333 files.push( model.get_value(iter, 0).value.get_string());
336 this.get('/patchview').showDiff(files);
337 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
338 //print("OUT?" + value);// id..
339 // load the list in the right grid..
346 // user defined functions
348 public class Xcls_reposStore : Object
350 public Gtk.ListStore el;
351 private Clones _this;
357 public Xcls_reposStore(Clones _owner )
360 _this.reposStore = this;
361 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
362 typeof(string), // 1 current branch
363 typeof(string), // 2 all branch
364 typeof(string), // 3 updated
365 typeof(bool), // 4 auto commit
366 typeof(bool), // 5 auto push
367 typeof(string), // 6 repopath
368 typeof(string), // 7 color highlighting?
369 typeof(bool), // 8 auto branch,
370 typeof(string) // 9 active Ticket
375 // set gobject values
378 // user defined functions
381 //this.insert(citer,iter,0);
382 print("getting list");
383 var tr = GitRepo.list();
387 // fixme .. sort by last updated ...
390 for(var i =0 ; i < tr.length; i++) {
391 var repo = tr.index(i);
392 // this is done before we display stuff...
393 //repo.loadBranches();
397 this.el.append(out iter);
399 //print(JSON.stringify(ret,null,4));
400 //tr[i].getBranches();
405 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
406 // print(JSON.stringify(hi,null,4));
407 // } catch(e) { print(e);}
409 this.el.set_value(iter, 0, repo.name );
410 this.el.set_value( iter, 1, repo.currentBranch.name );
411 this.el.set_value( iter, 2, repo.branchesToString() );
412 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
413 // function(e) { return e.name;
416 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
417 this.el.set_value(iter, 4, repo.is_autocommit() );
418 this.el.set_value(iter, 5, repo.is_autopush() );
419 this.el.set_value(iter, 6, repo.git_working_dir );
421 var cb = repo.currentBranch;
422 //print(JSON.stringify(cb,null,4));
425 if (cb.lastrev != cb.remoterev) {
427 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
428 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
432 if (repo.has_local_changes) {
434 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
436 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
438 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
439 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote") +
440 "\nHas uncommitted changes" );
443 this.el.set_value(iter, 7, col );
444 var ticket = repo.activeTicket;
446 this.el.set_value(iter, 8, repo.is_auto_branch() );
447 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
451 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
455 public class Xcls_tv_autocommit : Object
457 public Gtk.TreeViewColumn el;
458 private Clones _this;
464 public Xcls_tv_autocommit(Clones _owner )
467 _this.tv_autocommit = this;
468 this.el = new Gtk.TreeViewColumn();
472 // set gobject values
473 this.el.title = "Auto Commit";
474 this.el.min_width = 50;
475 var child_0 = new Xcls_cr_autocommit( _this );
477 this.el.pack_start ( child_0.el , false );
481 // this.items[0].el.set_activatable(true);
482 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
485 // user defined functions
487 public class Xcls_cr_autocommit : Object
489 public Gtk.CellRendererToggle el;
490 private Clones _this;
496 public Xcls_cr_autocommit(Clones _owner )
499 _this.cr_autocommit = this;
500 this.el = new Gtk.CellRendererToggle();
504 // set gobject values
505 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
508 this.el.toggled.connect( (self, path) => {
511 _this.reposStore.el.get_iter_from_string(out iter, path);
515 _this.reposStore.el.get_value(iter, 4, out val);
516 _this.reposStore.el.get_value(iter, 6, out rval);
518 var repopath = (string)rval;
519 var bval = (bool)val;
520 _this.reposStore.el.set_value(iter, 4, !bval);
521 GLib.debug("got repopath? %s", repopath);
523 var repo = GitRepo.get(repopath);
524 repo.set_autocommit(!bval);
532 // user defined functions
536 public class Xcls_tv_autopush : Object
538 public Gtk.TreeViewColumn el;
539 private Clones _this;
545 public Xcls_tv_autopush(Clones _owner )
548 _this.tv_autopush = this;
549 this.el = new Gtk.TreeViewColumn();
553 // set gobject values
554 this.el.title = "Auto Push";
555 this.el.min_width = 50;
556 var child_0 = new Xcls_cr_autopush( _this );
558 this.el.pack_start ( child_0.el , false );
562 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
563 // this.items[0].el.set_activatable(true);
566 // user defined functions
568 public class Xcls_cr_autopush : Object
570 public Gtk.CellRendererToggle el;
571 private Clones _this;
577 public Xcls_cr_autopush(Clones _owner )
580 _this.cr_autopush = this;
581 this.el = new Gtk.CellRendererToggle();
585 // set gobject values
586 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
589 this.el.toggled.connect( (self, path) => {
592 _this.reposStore.el.get_iter_from_string(out iter, path);
596 _this.reposStore.el.get_value(iter, 5, out val);
597 _this.reposStore.el.get_value(iter, 6, out rval);
599 var repopath = (string)rval;
600 var bval = (bool)val;
601 _this.reposStore.el.set_value(iter, 5, !bval);
602 var repo = GitRepo.get(repopath);
603 repo.set_autopush(!bval);
611 // user defined functions
615 public class Xcls_tv_autobranch : Object
617 public Gtk.TreeViewColumn el;
618 private Clones _this;
624 public Xcls_tv_autobranch(Clones _owner )
627 _this.tv_autobranch = this;
628 this.el = new Gtk.TreeViewColumn();
632 // set gobject values
633 this.el.title = "Auto Branch";
634 this.el.min_width = 50;
635 var child_0 = new Xcls_cr_autobranch( _this );
637 this.el.pack_start ( child_0.el , false );
641 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
642 // this.items[0].el.set_activatable(true);
645 // user defined functions
647 public class Xcls_cr_autobranch : Object
649 public Gtk.CellRendererToggle el;
650 private Clones _this;
656 public Xcls_cr_autobranch(Clones _owner )
659 _this.cr_autobranch = this;
660 this.el = new Gtk.CellRendererToggle();
664 // set gobject values
665 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
668 this.el.toggled.connect( (self, path) => {
671 _this.reposStore.el.get_iter_from_string(out iter, path);
675 _this.reposStore.el.get_value(iter, 8, out val);
676 _this.reposStore.el.get_value(iter, 6, out rval);
678 var repopath = (string)rval;
679 var bval = (bool)val;
680 _this.reposStore.el.set_value(iter, 8, !bval);
681 var repo = GitRepo.get(repopath);
682 repo.set_auto_branch(!bval);
690 // user defined functions
694 public class Xcls_tv_repo : Object
696 public Gtk.TreeViewColumn el;
697 private Clones _this;
703 public Xcls_tv_repo(Clones _owner )
706 _this.tv_repo = this;
707 this.el = new Gtk.TreeViewColumn();
711 // set gobject values
712 this.el.sort_column_id = 0;
713 this.el.title = "Repo";
714 this.el.min_width = 200;
715 this.el.sort_order = Gtk.SortType.ASCENDING;
716 this.el.resizable = true;
717 var child_0 = new Xcls_cr_repo( _this );
719 this.el.pack_start ( child_0.el , false );
723 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
726 // user defined functions
728 public class Xcls_cr_repo : Object
730 public Gtk.CellRendererText el;
731 private Clones _this;
737 public Xcls_cr_repo(Clones _owner )
740 _this.cr_repo = this;
741 this.el = new Gtk.CellRendererText();
745 // set gobject values
748 // user defined functions
752 public class Xcls_tv_active_ticket : Object
754 public Gtk.TreeViewColumn el;
755 private Clones _this;
761 public Xcls_tv_active_ticket(Clones _owner )
764 _this.tv_active_ticket = this;
765 this.el = new Gtk.TreeViewColumn();
769 // set gobject values
770 this.el.title = "Active Ticket";
771 this.el.min_width = 50;
772 var child_0 = new Xcls_cr_active_ticket( _this );
774 this.el.pack_start ( child_0.el , false );
778 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
781 // user defined functions
783 public class Xcls_cr_active_ticket : Object
785 public Gtk.CellRendererText el;
786 private Clones _this;
792 public Xcls_cr_active_ticket(Clones _owner )
795 _this.cr_active_ticket = this;
796 this.el = new Gtk.CellRendererText();
800 // set gobject values
803 // user defined functions
807 public class Xcls_tv_current_branch : Object
809 public Gtk.TreeViewColumn el;
810 private Clones _this;
816 public Xcls_tv_current_branch(Clones _owner )
819 _this.tv_current_branch = this;
820 this.el = new Gtk.TreeViewColumn();
824 // set gobject values
825 this.el.title = "Current Branch";
826 this.el.min_width = 50;
827 var child_0 = new Xcls_cr_current_branch( _this );
829 this.el.pack_start ( child_0.el , false );
833 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
834 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
837 // user defined functions
839 public class Xcls_cr_current_branch : Object
841 public Gtk.CellRendererText el;
842 private Clones _this;
848 public Xcls_cr_current_branch(Clones _owner )
851 _this.cr_current_branch = this;
852 this.el = new Gtk.CellRendererText();
856 // set gobject values
859 // user defined functions
863 public class Xcls_tv_last_updated : Object
865 public Gtk.TreeViewColumn el;
866 private Clones _this;
872 public Xcls_tv_last_updated(Clones _owner )
875 _this.tv_last_updated = this;
876 this.el = new Gtk.TreeViewColumn();
880 // set gobject values
881 this.el.title = "Last updated";
882 this.el.min_width = 50;
883 var child_0 = new Xcls_cr_last_updated( _this );
885 this.el.pack_start ( child_0.el , false );
889 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
892 // user defined functions
894 public class Xcls_cr_last_updated : Object
896 public Gtk.CellRendererText el;
897 private Clones _this;
903 public Xcls_cr_last_updated(Clones _owner )
906 _this.cr_last_updated = this;
907 this.el = new Gtk.CellRendererText();
911 // set gobject values
914 // user defined functions
918 public class Xcls_tv_all_branches : Object
920 public Gtk.TreeViewColumn el;
921 private Clones _this;
927 public Xcls_tv_all_branches(Clones _owner )
930 _this.tv_all_branches = this;
931 this.el = new Gtk.TreeViewColumn();
935 // set gobject values
936 this.el.title = "All Branches";
937 this.el.min_width = 50;
938 this.el.resizable = false;
939 var child_0 = new Xcls_cr_all_branches( _this );
941 this.el.pack_start ( child_0.el , false );
945 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
948 // user defined functions
950 public class Xcls_cr_all_branches : Object
952 public Gtk.CellRendererText el;
953 private Clones _this;
959 public Xcls_cr_all_branches(Clones _owner )
962 _this.cr_all_branches = this;
963 this.el = new Gtk.CellRendererText();
967 // set gobject values
970 // user defined functions