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";
175 this.el.get_style_context().add_class("suggested-action");
179 this.el.clicked.connect( () => {
180 Clone.singleton().show(this.el);
187 // user defined functions
191 public class Xcls_ScrolledWindow5 : Object
193 public Gtk.ScrolledWindow el;
194 private Clones _this;
200 public Xcls_ScrolledWindow5(Clones _owner )
203 this.el = new Gtk.ScrolledWindow( null, null );
207 // set gobject values
208 this.el.expand = true;
209 this.el.hexpand = true;
210 this.el.shadow_type = Gtk.ShadowType.IN;
211 var child_0 = new Xcls_reposView( _this );
213 this.el.add ( child_0.el );
219 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
223 // user defined functions
225 public class Xcls_reposView : Object
227 public Gtk.TreeView el;
228 private Clones _this;
234 public Xcls_reposView(Clones _owner )
237 _this.reposView = this;
238 this.el = new Gtk.TreeView();
242 // set gobject values
243 this.el.search_column = 0;
244 this.el.activate_on_single_click = true;
245 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
246 var child_0 = new Xcls_reposStore( _this );
248 this.el.set_model ( child_0.el );
249 var child_1 = new Xcls_tv_autocommit( _this );
251 this.el.append_column ( child_1.el );
252 var child_2 = new Xcls_tv_autopush( _this );
254 this.el.append_column ( child_2.el );
255 var child_3 = new Xcls_tv_autobranch( _this );
257 this.el.append_column ( child_3.el );
258 var child_4 = new Xcls_tv_repo( _this );
260 this.el.append_column ( child_4.el );
261 var child_5 = new Xcls_tv_active_ticket( _this );
263 this.el.append_column ( child_5.el );
264 var child_6 = new Xcls_tv_current_branch( _this );
266 this.el.append_column ( child_6.el );
267 var child_7 = new Xcls_tv_last_updated( _this );
269 this.el.append_column ( child_7.el );
270 var child_8 = new Xcls_tv_all_branches( _this );
272 this.el.append_column ( child_8.el );
277 var selection = this.el.get_selection();
278 selection.set_mode( Gtk.SelectionMode.SINGLE);
281 var description = new Pango.FontDescription();
282 description.set_size(10000);
283 this.el.override_font(description);
288 this.el.row_activated.connect( (path, col) => {
290 if (col.title != "Current Branch") {
297 _this.reposStore.el.get_iter(out iter, path);
299 _this.reposStore.el.get_value(iter, 6, out val);
300 var git_working_dir = (string)val;
302 var repo = GitRepo.singleton().get(git_working_dir);
305 _this.reposView.el.get_cell_area(path, col, out rect);
306 RepoStatusPopover.singleton().show(this.el, rect, repo);
311 this.el.cursor_changed.connect( () => {
312 // SEE SELECTION.CHANGED
317 if (this.el.get_selection().count_selected_rows() < 1) {
318 //nothing? - clea it?
322 var model = this.get('/changedFilesStore');
324 var s = this.el.get_selection();
326 s.selected_foreach(function(model,p,iter) {
328 files.push( model.get_value(iter, 0).value.get_string());
331 this.get('/patchview').showDiff(files);
332 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
333 //print("OUT?" + value);// id..
334 // load the list in the right grid..
341 // user defined functions
343 public class Xcls_reposStore : Object
345 public Gtk.ListStore el;
346 private Clones _this;
352 public Xcls_reposStore(Clones _owner )
355 _this.reposStore = this;
356 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
357 typeof(string), // 1 current branch
358 typeof(string), // 2 all branch
359 typeof(string), // 3 updated
360 typeof(bool), // 4 auto commit
361 typeof(bool), // 5 auto push
362 typeof(string), // 6 repopath
363 typeof(string), // 7 color highlighting?
364 typeof(bool), // 8 auto branch,
365 typeof(string) // 9 active Ticket
370 // set gobject values
373 // user defined functions
376 //this.insert(citer,iter,0);
377 print("getting list");
378 var tr = GitRepo.list();
382 // fixme .. sort by last updated ...
385 for(var i =0 ; i < tr.length; i++) {
386 var repo = tr.index(i);
387 // this is done before we display stuff...
388 //repo.loadBranches();
392 this.el.append(out iter);
394 //print(JSON.stringify(ret,null,4));
395 //tr[i].getBranches();
400 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
401 // print(JSON.stringify(hi,null,4));
402 // } catch(e) { print(e);}
404 this.el.set_value(iter, 0, repo.name );
405 this.el.set_value( iter, 1, repo.currentBranch.name );
406 this.el.set_value( iter, 2, repo.branchesToString() );
407 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
408 // function(e) { return e.name;
411 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
412 this.el.set_value(iter, 4, repo.is_autocommit() );
413 this.el.set_value(iter, 5, repo.is_autopush() );
414 this.el.set_value(iter, 6, repo.git_working_dir );
416 var cb = repo.currentBranch;
417 //print(JSON.stringify(cb,null,4));
420 if (cb.lastrev != cb.remoterev) {
422 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
423 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
427 if (repo.has_local_changes) {
429 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
431 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
433 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
434 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote") +
435 "\nHas uncommitted changes" );
438 this.el.set_value(iter, 7, col );
439 var ticket = repo.activeTicket;
441 this.el.set_value(iter, 8, repo.is_auto_branch() );
442 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
446 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
450 public class Xcls_tv_autocommit : Object
452 public Gtk.TreeViewColumn el;
453 private Clones _this;
459 public Xcls_tv_autocommit(Clones _owner )
462 _this.tv_autocommit = this;
463 this.el = new Gtk.TreeViewColumn();
467 // set gobject values
468 this.el.title = "Auto Commit";
469 this.el.min_width = 50;
470 var child_0 = new Xcls_cr_autocommit( _this );
472 this.el.pack_start ( child_0.el , false );
476 // this.items[0].el.set_activatable(true);
477 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
480 // user defined functions
482 public class Xcls_cr_autocommit : Object
484 public Gtk.CellRendererToggle el;
485 private Clones _this;
491 public Xcls_cr_autocommit(Clones _owner )
494 _this.cr_autocommit = this;
495 this.el = new Gtk.CellRendererToggle();
499 // set gobject values
500 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
503 this.el.toggled.connect( (self, path) => {
506 _this.reposStore.el.get_iter_from_string(out iter, path);
510 _this.reposStore.el.get_value(iter, 4, out val);
511 _this.reposStore.el.get_value(iter, 6, out rval);
513 var repopath = (string)rval;
514 var bval = (bool)val;
515 _this.reposStore.el.set_value(iter, 4, !bval);
516 GLib.debug("got repopath? %s", repopath);
518 var repo = GitRepo.get(repopath);
519 repo.set_autocommit(!bval);
527 // user defined functions
531 public class Xcls_tv_autopush : Object
533 public Gtk.TreeViewColumn el;
534 private Clones _this;
540 public Xcls_tv_autopush(Clones _owner )
543 _this.tv_autopush = this;
544 this.el = new Gtk.TreeViewColumn();
548 // set gobject values
549 this.el.title = "Auto Push";
550 this.el.min_width = 50;
551 var child_0 = new Xcls_cr_autopush( _this );
553 this.el.pack_start ( child_0.el , false );
557 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
558 // this.items[0].el.set_activatable(true);
561 // user defined functions
563 public class Xcls_cr_autopush : Object
565 public Gtk.CellRendererToggle el;
566 private Clones _this;
572 public Xcls_cr_autopush(Clones _owner )
575 _this.cr_autopush = this;
576 this.el = new Gtk.CellRendererToggle();
580 // set gobject values
581 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
584 this.el.toggled.connect( (self, path) => {
587 _this.reposStore.el.get_iter_from_string(out iter, path);
591 _this.reposStore.el.get_value(iter, 5, out val);
592 _this.reposStore.el.get_value(iter, 6, out rval);
594 var repopath = (string)rval;
595 var bval = (bool)val;
596 _this.reposStore.el.set_value(iter, 5, !bval);
597 var repo = GitRepo.get(repopath);
598 repo.set_autopush(!bval);
606 // user defined functions
610 public class Xcls_tv_autobranch : Object
612 public Gtk.TreeViewColumn el;
613 private Clones _this;
619 public Xcls_tv_autobranch(Clones _owner )
622 _this.tv_autobranch = this;
623 this.el = new Gtk.TreeViewColumn();
627 // set gobject values
628 this.el.title = "Auto Branch";
629 this.el.min_width = 50;
630 var child_0 = new Xcls_cr_autobranch( _this );
632 this.el.pack_start ( child_0.el , false );
636 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
637 // this.items[0].el.set_activatable(true);
640 // user defined functions
642 public class Xcls_cr_autobranch : Object
644 public Gtk.CellRendererToggle el;
645 private Clones _this;
651 public Xcls_cr_autobranch(Clones _owner )
654 _this.cr_autobranch = this;
655 this.el = new Gtk.CellRendererToggle();
659 // set gobject values
660 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
663 this.el.toggled.connect( (self, path) => {
666 _this.reposStore.el.get_iter_from_string(out iter, path);
670 _this.reposStore.el.get_value(iter, 8, out val);
671 _this.reposStore.el.get_value(iter, 6, out rval);
673 var repopath = (string)rval;
674 var bval = (bool)val;
675 _this.reposStore.el.set_value(iter, 8, !bval);
676 var repo = GitRepo.get(repopath);
677 repo.set_auto_branch(!bval);
685 // user defined functions
689 public class Xcls_tv_repo : Object
691 public Gtk.TreeViewColumn el;
692 private Clones _this;
698 public Xcls_tv_repo(Clones _owner )
701 _this.tv_repo = this;
702 this.el = new Gtk.TreeViewColumn();
706 // set gobject values
707 this.el.sort_column_id = 0;
708 this.el.title = "Repo";
709 this.el.min_width = 200;
710 this.el.sort_order = Gtk.SortType.ASCENDING;
711 this.el.resizable = true;
712 var child_0 = new Xcls_cr_repo( _this );
714 this.el.pack_start ( child_0.el , false );
718 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
721 // user defined functions
723 public class Xcls_cr_repo : Object
725 public Gtk.CellRendererText el;
726 private Clones _this;
732 public Xcls_cr_repo(Clones _owner )
735 _this.cr_repo = this;
736 this.el = new Gtk.CellRendererText();
740 // set gobject values
743 // user defined functions
747 public class Xcls_tv_active_ticket : Object
749 public Gtk.TreeViewColumn el;
750 private Clones _this;
756 public Xcls_tv_active_ticket(Clones _owner )
759 _this.tv_active_ticket = this;
760 this.el = new Gtk.TreeViewColumn();
764 // set gobject values
765 this.el.title = "Active Ticket";
766 this.el.min_width = 50;
767 var child_0 = new Xcls_cr_active_ticket( _this );
769 this.el.pack_start ( child_0.el , false );
773 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
776 // user defined functions
778 public class Xcls_cr_active_ticket : Object
780 public Gtk.CellRendererText el;
781 private Clones _this;
787 public Xcls_cr_active_ticket(Clones _owner )
790 _this.cr_active_ticket = this;
791 this.el = new Gtk.CellRendererText();
795 // set gobject values
798 // user defined functions
802 public class Xcls_tv_current_branch : Object
804 public Gtk.TreeViewColumn el;
805 private Clones _this;
811 public Xcls_tv_current_branch(Clones _owner )
814 _this.tv_current_branch = this;
815 this.el = new Gtk.TreeViewColumn();
819 // set gobject values
820 this.el.title = "Current Branch";
821 this.el.min_width = 50;
822 var child_0 = new Xcls_cr_current_branch( _this );
824 this.el.pack_start ( child_0.el , false );
828 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
829 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
832 // user defined functions
834 public class Xcls_cr_current_branch : Object
836 public Gtk.CellRendererText el;
837 private Clones _this;
843 public Xcls_cr_current_branch(Clones _owner )
846 _this.cr_current_branch = this;
847 this.el = new Gtk.CellRendererText();
851 // set gobject values
854 // user defined functions
858 public class Xcls_tv_last_updated : Object
860 public Gtk.TreeViewColumn el;
861 private Clones _this;
867 public Xcls_tv_last_updated(Clones _owner )
870 _this.tv_last_updated = this;
871 this.el = new Gtk.TreeViewColumn();
875 // set gobject values
876 this.el.title = "Last updated";
877 this.el.min_width = 50;
878 var child_0 = new Xcls_cr_last_updated( _this );
880 this.el.pack_start ( child_0.el , false );
884 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
887 // user defined functions
889 public class Xcls_cr_last_updated : Object
891 public Gtk.CellRendererText el;
892 private Clones _this;
898 public Xcls_cr_last_updated(Clones _owner )
901 _this.cr_last_updated = this;
902 this.el = new Gtk.CellRendererText();
906 // set gobject values
909 // user defined functions
913 public class Xcls_tv_all_branches : Object
915 public Gtk.TreeViewColumn el;
916 private Clones _this;
922 public Xcls_tv_all_branches(Clones _owner )
925 _this.tv_all_branches = this;
926 this.el = new Gtk.TreeViewColumn();
930 // set gobject values
931 this.el.title = "All Branches";
932 this.el.min_width = 50;
933 this.el.resizable = false;
934 var child_0 = new Xcls_cr_all_branches( _this );
936 this.el.pack_start ( child_0.el , false );
940 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
943 // user defined functions
945 public class Xcls_cr_all_branches : Object
947 public Gtk.CellRendererText el;
948 private Clones _this;
954 public Xcls_cr_all_branches(Clones _owner )
957 _this.cr_all_branches = this;
958 this.el = new Gtk.CellRendererText();
962 // set gobject values
965 // user defined functions