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
71 GLib.debug("show clones?");
72 this.el.set_deletable(true);
73 this.el.set_gravity(Gdk.Gravity.NORTH);
74 this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
76 this.el.set_default_size(
77 int.min(1024,Gdk.Screen.width()),
78 int.max(500,Gdk.Screen.height() - 300)
82 _this.reposStore.load();
83 this.el.set_keep_above(true);
84 GLib.debug("show clones = run?");
87 // this.get('/reposStore').load();
89 //this.get('/ok_button').el.set_sensitive(false);
91 // block until we return.
92 // var run_ret = this.el.run();
93 // if (run_ret < 1 ) {
96 // print("RUN RETURN : " + run_ret);
98 //print(JSON.stringify(this.get('bug').getValue()));
99 // return this.get('bug').getValue();
100 //this.success = c.success;
102 public class Xcls_Box2 : Object
105 private Clones _this;
111 public Xcls_Box2(Clones _owner )
114 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
118 // set gobject values
119 var child_0 = new Xcls_Box3( _this );
121 this.el.pack_start ( child_0.el , false,false,0 );
122 var child_1 = new Xcls_ScrolledWindow5( _this );
124 this.el.pack_end ( child_1.el , true,true,0 );
127 // user defined functions
129 public class Xcls_Box3 : Object
132 private Clones _this;
138 public Xcls_Box3(Clones _owner )
141 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
145 // set gobject values
146 this.el.homogeneous = true;
147 var child_0 = new Xcls_Button4( _this );
149 this.el.add ( child_0.el );
152 // user defined functions
154 public class Xcls_Button4 : Object
156 public Gtk.Button el;
157 private Clones _this;
163 public Xcls_Button4(Clones _owner )
166 this.el = new Gtk.Button();
170 // set gobject values
171 this.el.label = "Add Repository";
176 this.el.get_style_context().add_class("suggested-action");
180 this.el.clicked.connect( () => {
181 Clone.singleton().show(this.el);
188 // user defined functions
192 public class Xcls_ScrolledWindow5 : Object
194 public Gtk.ScrolledWindow el;
195 private Clones _this;
201 public Xcls_ScrolledWindow5(Clones _owner )
204 this.el = new Gtk.ScrolledWindow( null, null );
208 // set gobject values
209 this.el.expand = true;
210 this.el.hexpand = true;
211 this.el.shadow_type = Gtk.ShadowType.IN;
212 var child_0 = new Xcls_reposView( _this );
214 this.el.add ( child_0.el );
220 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
224 // user defined functions
226 public class Xcls_reposView : Object
228 public Gtk.TreeView el;
229 private Clones _this;
235 public Xcls_reposView(Clones _owner )
238 _this.reposView = this;
239 this.el = new Gtk.TreeView();
243 // set gobject values
244 this.el.search_column = 0;
245 this.el.activate_on_single_click = true;
246 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
247 var child_0 = new Xcls_reposStore( _this );
249 this.el.set_model ( child_0.el );
250 var child_1 = new Xcls_tv_autocommit( _this );
252 this.el.append_column ( child_1.el );
253 var child_2 = new Xcls_tv_autopush( _this );
255 this.el.append_column ( child_2.el );
256 var child_3 = new Xcls_tv_autobranch( _this );
258 this.el.append_column ( child_3.el );
259 var child_4 = new Xcls_tv_repo( _this );
261 this.el.append_column ( child_4.el );
262 var child_5 = new Xcls_tv_active_ticket( _this );
264 this.el.append_column ( child_5.el );
265 var child_6 = new Xcls_tv_current_branch( _this );
267 this.el.append_column ( child_6.el );
268 var child_7 = new Xcls_tv_last_updated( _this );
270 this.el.append_column ( child_7.el );
271 var child_8 = new Xcls_tv_all_branches( _this );
273 this.el.append_column ( child_8.el );
278 var selection = this.el.get_selection();
279 selection.set_mode( Gtk.SelectionMode.SINGLE);
282 var description = new Pango.FontDescription();
283 description.set_size(10000);
284 this.el.override_font(description);
289 this.el.row_activated.connect( (path, col) => {
291 if (col.title != "Current Branch") {
298 _this.reposStore.el.get_iter(out iter, path);
300 _this.reposStore.el.get_value(iter, 6, out val);
301 var git_working_dir = (string)val;
303 var repo = GitRepo.singleton().get(git_working_dir);
306 _this.reposView.el.get_cell_area(path, col, out rect);
307 RepoStatusPopover.singleton().show(this.el, rect, repo);
312 this.el.cursor_changed.connect( () => {
313 // SEE SELECTION.CHANGED
318 if (this.el.get_selection().count_selected_rows() < 1) {
319 //nothing? - clea it?
323 var model = this.get('/changedFilesStore');
325 var s = this.el.get_selection();
327 s.selected_foreach(function(model,p,iter) {
329 files.push( model.get_value(iter, 0).value.get_string());
332 this.get('/patchview').showDiff(files);
333 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
334 //print("OUT?" + value);// id..
335 // load the list in the right grid..
342 // user defined functions
344 public class Xcls_reposStore : Object
346 public Gtk.ListStore el;
347 private Clones _this;
353 public Xcls_reposStore(Clones _owner )
356 _this.reposStore = this;
357 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
358 typeof(string), // 1 current branch
359 typeof(string), // 2 all branch
360 typeof(string), // 3 updated
361 typeof(bool), // 4 auto commit
362 typeof(bool), // 5 auto push
363 typeof(string), // 6 repopath
364 typeof(string), // 7 color highlighting?
365 typeof(bool), // 8 auto branch,
366 typeof(string) // 9 active Ticket
371 // set gobject values
374 // user defined functions
377 //this.insert(citer,iter,0);
378 print("getting list");
379 var tr = GitRepo.list();
383 // fixme .. sort by last updated ...
386 for(var i =0 ; i < tr.length; i++) {
387 var repo = tr.index(i);
388 // this is done before we display stuff...
389 //repo.loadBranches();
393 this.el.append(out iter);
395 //print(JSON.stringify(ret,null,4));
396 //tr[i].getBranches();
401 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
402 // print(JSON.stringify(hi,null,4));
403 // } catch(e) { print(e);}
405 this.el.set_value(iter, 0, repo.name );
406 this.el.set_value( iter, 1, repo.currentBranch.name );
407 this.el.set_value( iter, 2, repo.branchesToString() );
408 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
409 // function(e) { return e.name;
412 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
413 this.el.set_value(iter, 4, repo.is_autocommit() );
414 this.el.set_value(iter, 5, repo.is_autopush() );
415 this.el.set_value(iter, 6, repo.git_working_dir );
417 var cb = repo.currentBranch;
418 //print(JSON.stringify(cb,null,4));
421 if (cb.lastrev != cb.remoterev) {
423 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
424 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
428 if (repo.has_local_changes) {
430 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
432 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
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") +
436 "\nHas uncommitted changes" );
439 this.el.set_value(iter, 7, col );
440 var ticket = repo.activeTicket;
442 this.el.set_value(iter, 8, repo.is_auto_branch() );
443 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
447 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
451 public class Xcls_tv_autocommit : Object
453 public Gtk.TreeViewColumn el;
454 private Clones _this;
460 public Xcls_tv_autocommit(Clones _owner )
463 _this.tv_autocommit = this;
464 this.el = new Gtk.TreeViewColumn();
468 // set gobject values
469 this.el.title = "Auto Commit";
470 this.el.min_width = 50;
471 var child_0 = new Xcls_cr_autocommit( _this );
473 this.el.pack_start ( child_0.el , false );
477 // this.items[0].el.set_activatable(true);
478 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
481 // user defined functions
483 public class Xcls_cr_autocommit : Object
485 public Gtk.CellRendererToggle el;
486 private Clones _this;
492 public Xcls_cr_autocommit(Clones _owner )
495 _this.cr_autocommit = this;
496 this.el = new Gtk.CellRendererToggle();
500 // set gobject values
501 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
504 this.el.toggled.connect( (self, path) => {
507 _this.reposStore.el.get_iter_from_string(out iter, path);
511 _this.reposStore.el.get_value(iter, 4, out val);
512 _this.reposStore.el.get_value(iter, 6, out rval);
514 var repopath = (string)rval;
515 var bval = (bool)val;
516 _this.reposStore.el.set_value(iter, 4, !bval);
517 GLib.debug("got repopath? %s", repopath);
519 var repo = GitRepo.get(repopath);
520 repo.set_autocommit(!bval);
528 // user defined functions
532 public class Xcls_tv_autopush : Object
534 public Gtk.TreeViewColumn el;
535 private Clones _this;
541 public Xcls_tv_autopush(Clones _owner )
544 _this.tv_autopush = this;
545 this.el = new Gtk.TreeViewColumn();
549 // set gobject values
550 this.el.title = "Auto Push";
551 this.el.min_width = 50;
552 var child_0 = new Xcls_cr_autopush( _this );
554 this.el.pack_start ( child_0.el , false );
558 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
559 // this.items[0].el.set_activatable(true);
562 // user defined functions
564 public class Xcls_cr_autopush : Object
566 public Gtk.CellRendererToggle el;
567 private Clones _this;
573 public Xcls_cr_autopush(Clones _owner )
576 _this.cr_autopush = this;
577 this.el = new Gtk.CellRendererToggle();
581 // set gobject values
582 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
585 this.el.toggled.connect( (self, path) => {
588 _this.reposStore.el.get_iter_from_string(out iter, path);
592 _this.reposStore.el.get_value(iter, 5, out val);
593 _this.reposStore.el.get_value(iter, 6, out rval);
595 var repopath = (string)rval;
596 var bval = (bool)val;
597 _this.reposStore.el.set_value(iter, 5, !bval);
598 var repo = GitRepo.get(repopath);
599 repo.set_autopush(!bval);
607 // user defined functions
611 public class Xcls_tv_autobranch : Object
613 public Gtk.TreeViewColumn el;
614 private Clones _this;
620 public Xcls_tv_autobranch(Clones _owner )
623 _this.tv_autobranch = this;
624 this.el = new Gtk.TreeViewColumn();
628 // set gobject values
629 this.el.title = "Auto Branch";
630 this.el.min_width = 50;
631 var child_0 = new Xcls_cr_autobranch( _this );
633 this.el.pack_start ( child_0.el , false );
637 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
638 // this.items[0].el.set_activatable(true);
641 // user defined functions
643 public class Xcls_cr_autobranch : Object
645 public Gtk.CellRendererToggle el;
646 private Clones _this;
652 public Xcls_cr_autobranch(Clones _owner )
655 _this.cr_autobranch = this;
656 this.el = new Gtk.CellRendererToggle();
660 // set gobject values
661 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
664 this.el.toggled.connect( (self, path) => {
667 _this.reposStore.el.get_iter_from_string(out iter, path);
671 _this.reposStore.el.get_value(iter, 8, out val);
672 _this.reposStore.el.get_value(iter, 6, out rval);
674 var repopath = (string)rval;
675 var bval = (bool)val;
676 _this.reposStore.el.set_value(iter, 8, !bval);
677 var repo = GitRepo.get(repopath);
678 repo.set_auto_branch(!bval);
686 // user defined functions
690 public class Xcls_tv_repo : Object
692 public Gtk.TreeViewColumn el;
693 private Clones _this;
699 public Xcls_tv_repo(Clones _owner )
702 _this.tv_repo = this;
703 this.el = new Gtk.TreeViewColumn();
707 // set gobject values
708 this.el.sort_column_id = 0;
709 this.el.title = "Repo";
710 this.el.min_width = 200;
711 this.el.sort_order = Gtk.SortType.ASCENDING;
712 this.el.resizable = true;
713 var child_0 = new Xcls_cr_repo( _this );
715 this.el.pack_start ( child_0.el , false );
719 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
722 // user defined functions
724 public class Xcls_cr_repo : Object
726 public Gtk.CellRendererText el;
727 private Clones _this;
733 public Xcls_cr_repo(Clones _owner )
736 _this.cr_repo = this;
737 this.el = new Gtk.CellRendererText();
741 // set gobject values
744 // user defined functions
748 public class Xcls_tv_active_ticket : Object
750 public Gtk.TreeViewColumn el;
751 private Clones _this;
757 public Xcls_tv_active_ticket(Clones _owner )
760 _this.tv_active_ticket = this;
761 this.el = new Gtk.TreeViewColumn();
765 // set gobject values
766 this.el.title = "Active Ticket";
767 this.el.min_width = 50;
768 var child_0 = new Xcls_cr_active_ticket( _this );
770 this.el.pack_start ( child_0.el , false );
774 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
777 // user defined functions
779 public class Xcls_cr_active_ticket : Object
781 public Gtk.CellRendererText el;
782 private Clones _this;
788 public Xcls_cr_active_ticket(Clones _owner )
791 _this.cr_active_ticket = this;
792 this.el = new Gtk.CellRendererText();
796 // set gobject values
799 // user defined functions
803 public class Xcls_tv_current_branch : Object
805 public Gtk.TreeViewColumn el;
806 private Clones _this;
812 public Xcls_tv_current_branch(Clones _owner )
815 _this.tv_current_branch = this;
816 this.el = new Gtk.TreeViewColumn();
820 // set gobject values
821 this.el.title = "Current Branch";
822 this.el.min_width = 50;
823 var child_0 = new Xcls_cr_current_branch( _this );
825 this.el.pack_start ( child_0.el , false );
829 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
830 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
833 // user defined functions
835 public class Xcls_cr_current_branch : Object
837 public Gtk.CellRendererText el;
838 private Clones _this;
844 public Xcls_cr_current_branch(Clones _owner )
847 _this.cr_current_branch = this;
848 this.el = new Gtk.CellRendererText();
852 // set gobject values
855 // user defined functions
859 public class Xcls_tv_last_updated : Object
861 public Gtk.TreeViewColumn el;
862 private Clones _this;
868 public Xcls_tv_last_updated(Clones _owner )
871 _this.tv_last_updated = this;
872 this.el = new Gtk.TreeViewColumn();
876 // set gobject values
877 this.el.title = "Last updated";
878 this.el.min_width = 50;
879 var child_0 = new Xcls_cr_last_updated( _this );
881 this.el.pack_start ( child_0.el , false );
885 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
888 // user defined functions
890 public class Xcls_cr_last_updated : Object
892 public Gtk.CellRendererText el;
893 private Clones _this;
899 public Xcls_cr_last_updated(Clones _owner )
902 _this.cr_last_updated = this;
903 this.el = new Gtk.CellRendererText();
907 // set gobject values
910 // user defined functions
914 public class Xcls_tv_all_branches : Object
916 public Gtk.TreeViewColumn el;
917 private Clones _this;
923 public Xcls_tv_all_branches(Clones _owner )
926 _this.tv_all_branches = this;
927 this.el = new Gtk.TreeViewColumn();
931 // set gobject values
932 this.el.title = "All Branches";
933 this.el.min_width = 50;
934 this.el.resizable = false;
935 var child_0 = new Xcls_cr_all_branches( _this );
937 this.el.pack_start ( child_0.el , false );
941 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
944 // user defined functions
946 public class Xcls_cr_all_branches : Object
948 public Gtk.CellRendererText el;
949 private Clones _this;
955 public Xcls_cr_all_branches(Clones _owner )
958 _this.cr_all_branches = this;
959 this.el = new Gtk.CellRendererText();
963 // set gobject values
966 // user defined functions