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
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);
86 // this.get('/reposStore').load();
88 //this.get('/ok_button').el.set_sensitive(false);
90 // block until we return.
91 // var run_ret = this.el.run();
92 // if (run_ret < 1 ) {
95 // print("RUN RETURN : " + run_ret);
97 //print(JSON.stringify(this.get('bug').getValue()));
98 // return this.get('bug').getValue();
99 //this.success = c.success;
101 public class Xcls_Box2 : Object
104 private Clones _this;
110 public Xcls_Box2(Clones _owner )
113 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
117 // set gobject values
118 var child_0 = new Xcls_Box3( _this );
120 this.el.pack_start ( child_0.el , false,false,0 );
121 var child_1 = new Xcls_ScrolledWindow5( _this );
123 this.el.pack_end ( child_1.el , true,true,0 );
126 // user defined functions
128 public class Xcls_Box3 : Object
131 private Clones _this;
137 public Xcls_Box3(Clones _owner )
140 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
144 // set gobject values
145 this.el.homogeneous = true;
146 var child_0 = new Xcls_Button4( _this );
148 this.el.add ( child_0.el );
151 // user defined functions
153 public class Xcls_Button4 : Object
155 public Gtk.Button el;
156 private Clones _this;
162 public Xcls_Button4(Clones _owner )
165 this.el = new Gtk.Button();
169 // set gobject values
170 this.el.label = "Add Repository";
173 this.el.clicked.connect( () => {
174 Clone.singleton().show(this.el);
181 // user defined functions
185 public class Xcls_ScrolledWindow5 : Object
187 public Gtk.ScrolledWindow el;
188 private Clones _this;
194 public Xcls_ScrolledWindow5(Clones _owner )
197 this.el = new Gtk.ScrolledWindow( null, null );
201 // set gobject values
202 this.el.expand = true;
203 this.el.hexpand = true;
204 this.el.shadow_type = Gtk.ShadowType.IN;
205 var child_0 = new Xcls_reposView( _this );
207 this.el.add ( child_0.el );
213 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
217 // user defined functions
219 public class Xcls_reposView : Object
221 public Gtk.TreeView el;
222 private Clones _this;
228 public Xcls_reposView(Clones _owner )
231 _this.reposView = this;
232 this.el = new Gtk.TreeView();
236 // set gobject values
237 this.el.search_column = 0;
238 this.el.activate_on_single_click = true;
239 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
240 var child_0 = new Xcls_reposStore( _this );
242 this.el.set_model ( child_0.el );
243 var child_1 = new Xcls_tv_autocommit( _this );
245 this.el.append_column ( child_1.el );
246 var child_2 = new Xcls_tv_autopush( _this );
248 this.el.append_column ( child_2.el );
249 var child_3 = new Xcls_tv_autobranch( _this );
251 this.el.append_column ( child_3.el );
252 var child_4 = new Xcls_tv_repo( _this );
254 this.el.append_column ( child_4.el );
255 var child_5 = new Xcls_tv_active_ticket( _this );
257 this.el.append_column ( child_5.el );
258 var child_6 = new Xcls_tv_current_branch( _this );
260 this.el.append_column ( child_6.el );
261 var child_7 = new Xcls_tv_last_updated( _this );
263 this.el.append_column ( child_7.el );
264 var child_8 = new Xcls_tv_all_branches( _this );
266 this.el.append_column ( child_8.el );
271 var selection = this.el.get_selection();
272 selection.set_mode( Gtk.SelectionMode.SINGLE);
275 var description = new Pango.FontDescription();
276 description.set_size(10000);
277 this.el.override_font(description);
282 this.el.row_activated.connect( (path, col) => {
284 if (col.title != "Current Branch") {
291 _this.reposStore.el.get_iter(out iter, path);
293 _this.reposStore.el.get_value(iter, 6, out val);
294 var git_working_dir = (string)val;
296 var repo = GitRepo.singleton().get(git_working_dir);
299 _this.reposView.el.get_cell_area(path, col, out rect);
300 RepoStatusPopover.singleton().show(this.el, rect, repo);
305 this.el.cursor_changed.connect( () => {
306 // SEE SELECTION.CHANGED
311 if (this.el.get_selection().count_selected_rows() < 1) {
312 //nothing? - clea it?
316 var model = this.get('/changedFilesStore');
318 var s = this.el.get_selection();
320 s.selected_foreach(function(model,p,iter) {
322 files.push( model.get_value(iter, 0).value.get_string());
325 this.get('/patchview').showDiff(files);
326 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
327 //print("OUT?" + value);// id..
328 // load the list in the right grid..
335 // user defined functions
337 public class Xcls_reposStore : Object
339 public Gtk.ListStore el;
340 private Clones _this;
346 public Xcls_reposStore(Clones _owner )
349 _this.reposStore = this;
350 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
351 typeof(string), // 1 current branch
352 typeof(string), // 2 all branch
353 typeof(string), // 3 updated
354 typeof(bool), // 4 auto commit
355 typeof(bool), // 5 auto push
356 typeof(string), // 6 repopath
357 typeof(string), // 7 color highlighting?
358 typeof(bool), // 8 auto branch,
359 typeof(string) // 9 active Ticket
364 // set gobject values
367 // user defined functions
370 //this.insert(citer,iter,0);
371 print("getting list");
372 var tr = GitRepo.list();
376 // fixme .. sort by last updated ...
379 for(var i =0 ; i < tr.length; i++) {
380 var repo = tr.index(i);
381 // this is done before we display stuff...
382 //repo.loadBranches();
386 this.el.append(out iter);
388 //print(JSON.stringify(ret,null,4));
389 //tr[i].getBranches();
394 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
395 // print(JSON.stringify(hi,null,4));
396 // } catch(e) { print(e);}
398 this.el.set_value(iter, 0, repo.name );
399 this.el.set_value( iter, 1, repo.currentBranch.name );
400 this.el.set_value( iter, 2, repo.branchesToString() );
401 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
402 // function(e) { return e.name;
405 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
406 this.el.set_value(iter, 4, repo.is_autocommit() );
407 this.el.set_value(iter, 5, repo.is_autopush() );
408 this.el.set_value(iter, 6, repo.git_working_dir );
410 var cb = repo.currentBranch;
411 //print(JSON.stringify(cb,null,4));
414 if (cb.lastrev != cb.remoterev) {
416 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
417 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
421 if (repo.has_local_changes) {
423 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
425 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
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") +
429 "\nHas uncommitted changes" );
432 this.el.set_value(iter, 7, col );
433 var ticket = repo.activeTicket;
435 this.el.set_value(iter, 8, repo.is_auto_branch() );
436 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
440 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
444 public class Xcls_tv_autocommit : Object
446 public Gtk.TreeViewColumn el;
447 private Clones _this;
453 public Xcls_tv_autocommit(Clones _owner )
456 _this.tv_autocommit = this;
457 this.el = new Gtk.TreeViewColumn();
461 // set gobject values
462 this.el.title = "Auto Commit";
463 this.el.min_width = 50;
464 var child_0 = new Xcls_cr_autocommit( _this );
466 this.el.pack_start ( child_0.el , false );
470 // this.items[0].el.set_activatable(true);
471 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
474 // user defined functions
476 public class Xcls_cr_autocommit : Object
478 public Gtk.CellRendererToggle el;
479 private Clones _this;
485 public Xcls_cr_autocommit(Clones _owner )
488 _this.cr_autocommit = this;
489 this.el = new Gtk.CellRendererToggle();
493 // set gobject values
494 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
497 this.el.toggled.connect( (self, path) => {
500 _this.reposStore.el.get_iter_from_string(out iter, path);
504 _this.reposStore.el.get_value(iter, 4, out val);
505 _this.reposStore.el.get_value(iter, 6, out rval);
507 var repopath = (string)rval;
508 var bval = (bool)val;
509 _this.reposStore.el.set_value(iter, 4, !bval);
510 GLib.debug("got repopath? %s", repopath);
512 var repo = GitRepo.get(repopath);
513 repo.set_autocommit(!bval);
521 // user defined functions
525 public class Xcls_tv_autopush : Object
527 public Gtk.TreeViewColumn el;
528 private Clones _this;
534 public Xcls_tv_autopush(Clones _owner )
537 _this.tv_autopush = this;
538 this.el = new Gtk.TreeViewColumn();
542 // set gobject values
543 this.el.title = "Auto Push";
544 this.el.min_width = 50;
545 var child_0 = new Xcls_cr_autopush( _this );
547 this.el.pack_start ( child_0.el , false );
551 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
552 // this.items[0].el.set_activatable(true);
555 // user defined functions
557 public class Xcls_cr_autopush : Object
559 public Gtk.CellRendererToggle el;
560 private Clones _this;
566 public Xcls_cr_autopush(Clones _owner )
569 _this.cr_autopush = this;
570 this.el = new Gtk.CellRendererToggle();
574 // set gobject values
575 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
578 this.el.toggled.connect( (self, path) => {
581 _this.reposStore.el.get_iter_from_string(out iter, path);
585 _this.reposStore.el.get_value(iter, 5, out val);
586 _this.reposStore.el.get_value(iter, 6, out rval);
588 var repopath = (string)rval;
589 var bval = (bool)val;
590 _this.reposStore.el.set_value(iter, 5, !bval);
591 var repo = GitRepo.get(repopath);
592 repo.set_autopush(!bval);
600 // user defined functions
604 public class Xcls_tv_autobranch : Object
606 public Gtk.TreeViewColumn el;
607 private Clones _this;
613 public Xcls_tv_autobranch(Clones _owner )
616 _this.tv_autobranch = this;
617 this.el = new Gtk.TreeViewColumn();
621 // set gobject values
622 this.el.title = "Auto Branch";
623 this.el.min_width = 50;
624 var child_0 = new Xcls_cr_autobranch( _this );
626 this.el.pack_start ( child_0.el , false );
630 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
631 // this.items[0].el.set_activatable(true);
634 // user defined functions
636 public class Xcls_cr_autobranch : Object
638 public Gtk.CellRendererToggle el;
639 private Clones _this;
645 public Xcls_cr_autobranch(Clones _owner )
648 _this.cr_autobranch = this;
649 this.el = new Gtk.CellRendererToggle();
653 // set gobject values
654 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
657 this.el.toggled.connect( (self, path) => {
660 _this.reposStore.el.get_iter_from_string(out iter, path);
664 _this.reposStore.el.get_value(iter, 8, out val);
665 _this.reposStore.el.get_value(iter, 6, out rval);
667 var repopath = (string)rval;
668 var bval = (bool)val;
669 _this.reposStore.el.set_value(iter, 8, !bval);
670 var repo = GitRepo.get(repopath);
671 repo.set_auto_branch(!bval);
679 // user defined functions
683 public class Xcls_tv_repo : Object
685 public Gtk.TreeViewColumn el;
686 private Clones _this;
692 public Xcls_tv_repo(Clones _owner )
695 _this.tv_repo = this;
696 this.el = new Gtk.TreeViewColumn();
700 // set gobject values
701 this.el.sort_column_id = 0;
702 this.el.title = "Repo";
703 this.el.min_width = 200;
704 this.el.sort_order = Gtk.SortType.ASCENDING;
705 this.el.resizable = true;
706 var child_0 = new Xcls_cr_repo( _this );
708 this.el.pack_start ( child_0.el , false );
712 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
715 // user defined functions
717 public class Xcls_cr_repo : Object
719 public Gtk.CellRendererText el;
720 private Clones _this;
726 public Xcls_cr_repo(Clones _owner )
729 _this.cr_repo = this;
730 this.el = new Gtk.CellRendererText();
734 // set gobject values
737 // user defined functions
741 public class Xcls_tv_active_ticket : Object
743 public Gtk.TreeViewColumn el;
744 private Clones _this;
750 public Xcls_tv_active_ticket(Clones _owner )
753 _this.tv_active_ticket = this;
754 this.el = new Gtk.TreeViewColumn();
758 // set gobject values
759 this.el.title = "Active Ticket";
760 this.el.min_width = 50;
761 var child_0 = new Xcls_cr_active_ticket( _this );
763 this.el.pack_start ( child_0.el , false );
767 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
770 // user defined functions
772 public class Xcls_cr_active_ticket : Object
774 public Gtk.CellRendererText el;
775 private Clones _this;
781 public Xcls_cr_active_ticket(Clones _owner )
784 _this.cr_active_ticket = this;
785 this.el = new Gtk.CellRendererText();
789 // set gobject values
792 // user defined functions
796 public class Xcls_tv_current_branch : Object
798 public Gtk.TreeViewColumn el;
799 private Clones _this;
805 public Xcls_tv_current_branch(Clones _owner )
808 _this.tv_current_branch = this;
809 this.el = new Gtk.TreeViewColumn();
813 // set gobject values
814 this.el.title = "Current Branch";
815 this.el.min_width = 50;
816 var child_0 = new Xcls_cr_current_branch( _this );
818 this.el.pack_start ( child_0.el , false );
822 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
823 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
826 // user defined functions
828 public class Xcls_cr_current_branch : Object
830 public Gtk.CellRendererText el;
831 private Clones _this;
837 public Xcls_cr_current_branch(Clones _owner )
840 _this.cr_current_branch = this;
841 this.el = new Gtk.CellRendererText();
845 // set gobject values
848 // user defined functions
852 public class Xcls_tv_last_updated : Object
854 public Gtk.TreeViewColumn el;
855 private Clones _this;
861 public Xcls_tv_last_updated(Clones _owner )
864 _this.tv_last_updated = this;
865 this.el = new Gtk.TreeViewColumn();
869 // set gobject values
870 this.el.title = "Last updated";
871 this.el.min_width = 50;
872 var child_0 = new Xcls_cr_last_updated( _this );
874 this.el.pack_start ( child_0.el , false );
878 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
881 // user defined functions
883 public class Xcls_cr_last_updated : Object
885 public Gtk.CellRendererText el;
886 private Clones _this;
892 public Xcls_cr_last_updated(Clones _owner )
895 _this.cr_last_updated = this;
896 this.el = new Gtk.CellRendererText();
900 // set gobject values
903 // user defined functions
907 public class Xcls_tv_all_branches : Object
909 public Gtk.TreeViewColumn el;
910 private Clones _this;
916 public Xcls_tv_all_branches(Clones _owner )
919 _this.tv_all_branches = this;
920 this.el = new Gtk.TreeViewColumn();
924 // set gobject values
925 this.el.title = "All Branches";
926 this.el.min_width = 50;
927 this.el.resizable = false;
928 var child_0 = new Xcls_cr_all_branches( _this );
930 this.el.pack_start ( child_0.el , false );
934 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
937 // user defined functions
939 public class Xcls_cr_all_branches : Object
941 public Gtk.CellRendererText el;
942 private Clones _this;
948 public Xcls_cr_all_branches(Clones _owner )
951 _this.cr_all_branches = this;
952 this.el = new Gtk.CellRendererText();
956 // set gobject values
959 // user defined functions