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 () {
74 GLib.debug("show clones?");
75 this.el.set_deletable(true);
76 this.el.set_gravity(Gdk.Gravity.NORTH);
77 this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);
79 this.el.set_default_size(
80 int.min(1024,Gdk.Screen.width()),
81 int.max(500,Gdk.Screen.height() - 300)
85 _this.reposStore.load();
86 this.el.set_keep_above(true);
87 GLib.debug("show clones = run?");
90 // this.get('/reposStore').load();
92 //this.get('/ok_button').el.set_sensitive(false);
94 // block until we return.
95 // var run_ret = this.el.run();
96 // if (run_ret < 1 ) {
99 // print("RUN RETURN : " + run_ret);
101 //print(JSON.stringify(this.get('bug').getValue()));
102 // return this.get('bug').getValue();
103 //this.success = c.success;
105 public class Xcls_Box2 : Object
108 private Clones _this;
114 public Xcls_Box2(Clones _owner )
117 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
121 // set gobject values
122 var child_0 = new Xcls_Box3( _this );
124 this.el.pack_start ( child_0.el , false,false,0 );
125 var child_1 = new Xcls_ScrolledWindow5( _this );
127 this.el.pack_end ( child_1.el , true,true,0 );
130 // user defined functions
132 public class Xcls_Box3 : Object
135 private Clones _this;
141 public Xcls_Box3(Clones _owner )
144 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
148 // set gobject values
149 this.el.homogeneous = true;
150 var child_0 = new Xcls_Button4( _this );
152 this.el.add ( child_0.el );
155 // user defined functions
157 public class Xcls_Button4 : Object
159 public Gtk.Button el;
160 private Clones _this;
166 public Xcls_Button4(Clones _owner )
169 this.el = new Gtk.Button();
173 // set gobject values
174 this.el.label = "Add Repository";
179 this.el.get_style_context().add_class("suggested-action");
183 this.el.clicked.connect( () => {
184 Clone.singleton().show(this.el);
191 // user defined functions
195 public class Xcls_ScrolledWindow5 : Object
197 public Gtk.ScrolledWindow el;
198 private Clones _this;
204 public Xcls_ScrolledWindow5(Clones _owner )
207 this.el = new Gtk.ScrolledWindow( null, null );
211 // set gobject values
212 this.el.expand = true;
213 this.el.hexpand = true;
214 this.el.shadow_type = Gtk.ShadowType.IN;
215 var child_0 = new Xcls_reposView( _this );
217 this.el.add ( child_0.el );
223 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
227 // user defined functions
229 public class Xcls_reposView : Object
231 public Gtk.TreeView el;
232 private Clones _this;
238 public Xcls_reposView(Clones _owner )
241 _this.reposView = this;
242 this.el = new Gtk.TreeView();
246 // set gobject values
247 this.el.search_column = 0;
248 this.el.activate_on_single_click = true;
249 this.el.enable_grid_lines = Gtk.TreeViewGridLines.HORIZONTAL;
250 var child_0 = new Xcls_reposStore( _this );
252 this.el.set_model ( child_0.el );
253 var child_1 = new Xcls_tv_autocommit( _this );
255 this.el.append_column ( child_1.el );
256 var child_2 = new Xcls_tv_autopush( _this );
258 this.el.append_column ( child_2.el );
259 var child_3 = new Xcls_tv_autobranch( _this );
261 this.el.append_column ( child_3.el );
262 var child_4 = new Xcls_tv_repo( _this );
264 this.el.append_column ( child_4.el );
265 var child_5 = new Xcls_tv_active_ticket( _this );
267 this.el.append_column ( child_5.el );
268 var child_6 = new Xcls_tv_current_branch( _this );
270 this.el.append_column ( child_6.el );
271 var child_7 = new Xcls_tv_last_updated( _this );
273 this.el.append_column ( child_7.el );
274 var child_8 = new Xcls_tv_all_branches( _this );
276 this.el.append_column ( child_8.el );
281 var selection = this.el.get_selection();
282 selection.set_mode( Gtk.SelectionMode.SINGLE);
285 var description = new Pango.FontDescription();
286 description.set_size(10000);
287 this.el.override_font(description);
292 this.el.row_activated.connect( (path, col) => {
294 if (col.title != "Current Branch") {
301 _this.reposStore.el.get_iter(out iter, path);
303 _this.reposStore.el.get_value(iter, 6, out val);
304 var git_working_dir = (string)val;
306 var repo = GitRepo.singleton().get(git_working_dir);
309 _this.reposView.el.get_cell_area(path, col, out rect);
310 RepoStatusPopover.singleton().show(this.el, rect, repo);
315 this.el.cursor_changed.connect( () => {
316 // SEE SELECTION.CHANGED
321 if (this.el.get_selection().count_selected_rows() < 1) {
322 //nothing? - clea it?
326 var model = this.get('/changedFilesStore');
328 var s = this.el.get_selection();
330 s.selected_foreach(function(model,p,iter) {
332 files.push( model.get_value(iter, 0).value.get_string());
335 this.get('/patchview').showDiff(files);
336 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
337 //print("OUT?" + value);// id..
338 // load the list in the right grid..
345 // user defined functions
347 public class Xcls_reposStore : Object
349 public Gtk.ListStore el;
350 private Clones _this;
356 public Xcls_reposStore(Clones _owner )
359 _this.reposStore = this;
360 this.el = new Gtk.ListStore( 10, typeof(string), // 0 repo
361 typeof(string), // 1 current branch
362 typeof(string), // 2 all branch
363 typeof(string), // 3 updated
364 typeof(bool), // 4 auto commit
365 typeof(bool), // 5 auto push
366 typeof(string), // 6 repopath
367 typeof(string), // 7 color highlighting?
368 typeof(bool), // 8 auto branch,
369 typeof(string) // 9 active Ticket
374 // set gobject values
377 // user defined functions
380 //this.insert(citer,iter,0);
381 print("getting list");
382 var tr = GitRepo.list();
386 // fixme .. sort by last updated ...
389 for(var i =0 ; i < tr.length; i++) {
390 var repo = tr.index(i);
391 // this is done before we display stuff...
392 //repo.loadBranches();
396 this.el.append(out iter);
398 //print(JSON.stringify(ret,null,4));
399 //tr[i].getBranches();
404 // hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );
405 // print(JSON.stringify(hi,null,4));
406 // } catch(e) { print(e);}
408 this.el.set_value(iter, 0, repo.name );
409 this.el.set_value( iter, 1, repo.currentBranch.name );
410 this.el.set_value( iter, 2, repo.branchesToString() );
411 // this.el.set_value(ret.iter, 2, '' + repo.branches.map(
412 // function(e) { return e.name;
415 // this.el.set_value(iter, 3, '' + (!hi ? '??' : hi[0].changed_raw));
416 this.el.set_value(iter, 4, repo.is_autocommit() );
417 this.el.set_value(iter, 5, repo.is_autopush() );
418 this.el.set_value(iter, 6, repo.git_working_dir );
420 var cb = repo.currentBranch;
421 //print(JSON.stringify(cb,null,4));
424 if (cb.lastrev != cb.remoterev) {
426 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
427 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
431 if (repo.has_local_changes) {
433 this.el.set_value( iter, 1, repo.currentBranch.name +"\nHas uncommitted changes" );
435 if ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
437 this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
438 (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote") +
439 "\nHas uncommitted changes" );
442 this.el.set_value(iter, 7, col );
443 var ticket = repo.activeTicket;
445 this.el.set_value(iter, 8, repo.is_auto_branch() );
446 this.el.set_value(iter, 9, ticket == null ? "" : ticket.id );
450 this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);
454 public class Xcls_tv_autocommit : Object
456 public Gtk.TreeViewColumn el;
457 private Clones _this;
463 public Xcls_tv_autocommit(Clones _owner )
466 _this.tv_autocommit = this;
467 this.el = new Gtk.TreeViewColumn();
471 // set gobject values
472 this.el.title = "Auto Commit";
473 this.el.min_width = 50;
474 var child_0 = new Xcls_cr_autocommit( _this );
476 this.el.pack_start ( child_0.el , false );
480 // this.items[0].el.set_activatable(true);
481 this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
484 // user defined functions
486 public class Xcls_cr_autocommit : Object
488 public Gtk.CellRendererToggle el;
489 private Clones _this;
495 public Xcls_cr_autocommit(Clones _owner )
498 _this.cr_autocommit = this;
499 this.el = new Gtk.CellRendererToggle();
503 // set gobject values
504 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
507 this.el.toggled.connect( (self, path) => {
510 _this.reposStore.el.get_iter_from_string(out iter, path);
514 _this.reposStore.el.get_value(iter, 4, out val);
515 _this.reposStore.el.get_value(iter, 6, out rval);
517 var repopath = (string)rval;
518 var bval = (bool)val;
519 _this.reposStore.el.set_value(iter, 4, !bval);
520 GLib.debug("got repopath? %s", repopath);
522 var repo = GitRepo.get(repopath);
523 repo.set_autocommit(!bval);
531 // user defined functions
535 public class Xcls_tv_autopush : Object
537 public Gtk.TreeViewColumn el;
538 private Clones _this;
544 public Xcls_tv_autopush(Clones _owner )
547 _this.tv_autopush = this;
548 this.el = new Gtk.TreeViewColumn();
552 // set gobject values
553 this.el.title = "Auto Push";
554 this.el.min_width = 50;
555 var child_0 = new Xcls_cr_autopush( _this );
557 this.el.pack_start ( child_0.el , false );
561 this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
562 // this.items[0].el.set_activatable(true);
565 // user defined functions
567 public class Xcls_cr_autopush : Object
569 public Gtk.CellRendererToggle el;
570 private Clones _this;
576 public Xcls_cr_autopush(Clones _owner )
579 _this.cr_autopush = this;
580 this.el = new Gtk.CellRendererToggle();
584 // set gobject values
585 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
588 this.el.toggled.connect( (self, path) => {
591 _this.reposStore.el.get_iter_from_string(out iter, path);
595 _this.reposStore.el.get_value(iter, 5, out val);
596 _this.reposStore.el.get_value(iter, 6, out rval);
598 var repopath = (string)rval;
599 var bval = (bool)val;
600 _this.reposStore.el.set_value(iter, 5, !bval);
601 var repo = GitRepo.get(repopath);
602 repo.set_autopush(!bval);
610 // user defined functions
614 public class Xcls_tv_autobranch : Object
616 public Gtk.TreeViewColumn el;
617 private Clones _this;
623 public Xcls_tv_autobranch(Clones _owner )
626 _this.tv_autobranch = this;
627 this.el = new Gtk.TreeViewColumn();
631 // set gobject values
632 this.el.title = "Auto Branch";
633 this.el.min_width = 50;
634 var child_0 = new Xcls_cr_autobranch( _this );
636 this.el.pack_start ( child_0.el , false );
640 this.el.add_attribute(_this.cr_autobranch.el , "active", 8 );
641 // this.items[0].el.set_activatable(true);
644 // user defined functions
646 public class Xcls_cr_autobranch : Object
648 public Gtk.CellRendererToggle el;
649 private Clones _this;
655 public Xcls_cr_autobranch(Clones _owner )
658 _this.cr_autobranch = this;
659 this.el = new Gtk.CellRendererToggle();
663 // set gobject values
664 this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
667 this.el.toggled.connect( (self, path) => {
670 _this.reposStore.el.get_iter_from_string(out iter, path);
674 _this.reposStore.el.get_value(iter, 8, out val);
675 _this.reposStore.el.get_value(iter, 6, out rval);
677 var repopath = (string)rval;
678 var bval = (bool)val;
679 _this.reposStore.el.set_value(iter, 8, !bval);
680 var repo = GitRepo.get(repopath);
681 repo.set_auto_branch(!bval);
689 // user defined functions
693 public class Xcls_tv_repo : Object
695 public Gtk.TreeViewColumn el;
696 private Clones _this;
702 public Xcls_tv_repo(Clones _owner )
705 _this.tv_repo = this;
706 this.el = new Gtk.TreeViewColumn();
710 // set gobject values
711 this.el.sort_column_id = 0;
712 this.el.title = "Repo";
713 this.el.min_width = 200;
714 this.el.sort_order = Gtk.SortType.ASCENDING;
715 this.el.resizable = true;
716 var child_0 = new Xcls_cr_repo( _this );
718 this.el.pack_start ( child_0.el , false );
722 this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
725 // user defined functions
727 public class Xcls_cr_repo : Object
729 public Gtk.CellRendererText el;
730 private Clones _this;
736 public Xcls_cr_repo(Clones _owner )
739 _this.cr_repo = this;
740 this.el = new Gtk.CellRendererText();
744 // set gobject values
747 // user defined functions
751 public class Xcls_tv_active_ticket : Object
753 public Gtk.TreeViewColumn el;
754 private Clones _this;
760 public Xcls_tv_active_ticket(Clones _owner )
763 _this.tv_active_ticket = this;
764 this.el = new Gtk.TreeViewColumn();
768 // set gobject values
769 this.el.title = "Active Ticket";
770 this.el.min_width = 50;
771 var child_0 = new Xcls_cr_active_ticket( _this );
773 this.el.pack_start ( child_0.el , false );
777 this.el.add_attribute(_this.cr_active_ticket.el , "markup", 9 );
780 // user defined functions
782 public class Xcls_cr_active_ticket : Object
784 public Gtk.CellRendererText el;
785 private Clones _this;
791 public Xcls_cr_active_ticket(Clones _owner )
794 _this.cr_active_ticket = this;
795 this.el = new Gtk.CellRendererText();
799 // set gobject values
802 // user defined functions
806 public class Xcls_tv_current_branch : Object
808 public Gtk.TreeViewColumn el;
809 private Clones _this;
815 public Xcls_tv_current_branch(Clones _owner )
818 _this.tv_current_branch = this;
819 this.el = new Gtk.TreeViewColumn();
823 // set gobject values
824 this.el.title = "Current Branch";
825 this.el.min_width = 50;
826 var child_0 = new Xcls_cr_current_branch( _this );
828 this.el.pack_start ( child_0.el , false );
832 this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
833 this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
836 // user defined functions
838 public class Xcls_cr_current_branch : Object
840 public Gtk.CellRendererText el;
841 private Clones _this;
847 public Xcls_cr_current_branch(Clones _owner )
850 _this.cr_current_branch = this;
851 this.el = new Gtk.CellRendererText();
855 // set gobject values
858 // user defined functions
862 public class Xcls_tv_last_updated : Object
864 public Gtk.TreeViewColumn el;
865 private Clones _this;
871 public Xcls_tv_last_updated(Clones _owner )
874 _this.tv_last_updated = this;
875 this.el = new Gtk.TreeViewColumn();
879 // set gobject values
880 this.el.title = "Last updated";
881 this.el.min_width = 50;
882 var child_0 = new Xcls_cr_last_updated( _this );
884 this.el.pack_start ( child_0.el , false );
888 this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
891 // user defined functions
893 public class Xcls_cr_last_updated : Object
895 public Gtk.CellRendererText el;
896 private Clones _this;
902 public Xcls_cr_last_updated(Clones _owner )
905 _this.cr_last_updated = this;
906 this.el = new Gtk.CellRendererText();
910 // set gobject values
913 // user defined functions
917 public class Xcls_tv_all_branches : Object
919 public Gtk.TreeViewColumn el;
920 private Clones _this;
926 public Xcls_tv_all_branches(Clones _owner )
929 _this.tv_all_branches = this;
930 this.el = new Gtk.TreeViewColumn();
934 // set gobject values
935 this.el.title = "All Branches";
936 this.el.min_width = 50;
937 this.el.resizable = false;
938 var child_0 = new Xcls_cr_all_branches( _this );
940 this.el.pack_start ( child_0.el , false );
944 this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
947 // user defined functions
949 public class Xcls_cr_all_branches : Object
951 public Gtk.CellRendererText el;
952 private Clones _this;
958 public Xcls_cr_all_branches(Clones _owner )
961 _this.cr_all_branches = this;
962 this.el = new Gtk.CellRendererText();
966 // set gobject values
969 // user defined functions