Clones.bjs
[gitlive] / Clones.vala
1 static Clones  _Clones;
2
3 public class Clones : Object
4 {
5     public Gtk.Popover el;
6     private Clones  _this;
7
8     public static Clones singleton()
9     {
10         if (_Clones == null) {
11             _Clones= new Clones();
12         }
13         return _Clones;
14     }
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_repo tv_repo;
22     public Xcls_cr_repo cr_repo;
23     public Xcls_tv_current_branch tv_current_branch;
24     public Xcls_cr_current_branch cr_current_branch;
25     public Xcls_tv_last_updated tv_last_updated;
26     public Xcls_cr_last_updated cr_last_updated;
27     public Xcls_tv_all_branches tv_all_branches;
28     public Xcls_cr_all_branches cr_all_branches;
29     public Xcls_ok_button ok_button;
30
31         // my vars (def)
32
33     // ctor
34     public Clones()
35     {
36         _this = this;
37         this.el = new Gtk.Popover( null );
38
39         // my vars (dec)
40
41         // set gobject values
42         this.el.border_width = 3;
43         this.el.modal = true;
44         var child_0 = new Xcls_Box2( _this );
45         child_0.ref();
46         this.el.add (  child_0.el  );
47     }
48
49     // user defined functions
50     public void show (Gtk.Widget icon)    {
51     
52         Gdk.Rectangle area;
53         Gdk.Screen screen;
54         Gtk.Orientation ori;
55         
56         icon.get_geometry(out screen, out area, out ori);
57         
58         this.el.set_pointing_to(area);
59         
60                 //console.log('show all');
61         this.el.set_modal(true);
62     
63     
64         this.el.set_position(Gtk.PositionType.BOTTOM);
65     //  this.el.popup();
66         // window + header?
67         this.el.show_all();
68         this.el.set_size_request(800,500);
69     
70         //this.view.el.grab_focus();
71     }
72     public class Xcls_Box2 : Object
73     {
74         public Gtk.Box el;
75         private Clones  _this;
76
77
78             // my vars (def)
79
80         // ctor
81         public Xcls_Box2(Clones _owner )
82         {
83             _this = _owner;
84             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
85
86             // my vars (dec)
87
88             // set gobject values
89             var child_0 = new Xcls_Box3( _this );
90             child_0.ref();
91             this.el.pack_start (  child_0.el , false,false,0 );
92             var child_1 = new Xcls_ScrolledWindow9( _this );
93             child_1.ref();
94             this.el.add (  child_1.el  );
95             var child_2 = new Xcls_ok_button( _this );
96             child_2.ref();
97             this.el.add (  child_2.el  );
98         }
99
100         // user defined functions
101     }
102     public class Xcls_Box3 : Object
103     {
104         public Gtk.Box el;
105         private Clones  _this;
106
107
108             // my vars (def)
109
110         // ctor
111         public Xcls_Box3(Clones _owner )
112         {
113             _this = _owner;
114             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
115
116             // my vars (dec)
117
118             // set gobject values
119             var child_0 = new Xcls_Button4( _this );
120             child_0.ref();
121             this.el.add (  child_0.el  );
122             var child_1 = new Xcls_Button5( _this );
123             child_1.ref();
124             this.el.add (  child_1.el  );
125             var child_2 = new Xcls_Button6( _this );
126             child_2.ref();
127             this.el.add (  child_2.el  );
128             var child_3 = new Xcls_Button7( _this );
129             child_3.ref();
130             this.el.add (  child_3.el  );
131             var child_4 = new Xcls_Button8( _this );
132             child_4.ref();
133             this.el.add (  child_4.el  );
134         }
135
136         // user defined functions
137     }
138     public class Xcls_Button4 : Object
139     {
140         public Gtk.Button el;
141         private Clones  _this;
142
143
144             // my vars (def)
145
146         // ctor
147         public Xcls_Button4(Clones _owner )
148         {
149             _this = _owner;
150             this.el = new Gtk.Button();
151
152             // my vars (dec)
153
154             // set gobject values
155             this.el.label = "Remotes / Clones";
156
157             //listeners
158             this.el.clicked.connect( () => {
159             
160             /*    var rv = this.get('/reposView');
161                 var rs = this.get('/reposStore');
162                 if (rv.el.get_selection().count_selected_rows() != 1) {
163                     //nothing?
164                     // error condition.
165                     return;
166                 }
167                 var Remotes =     imports.Remotes.Remotes;
168                 
169              
170                 var ret = {};       
171                 var s = rv.el.get_selection();
172                 var path = '';
173                 s.selected_foreach(function(model,p,iter) {
174                                                                 
175                    path = model.get_value(iter, 6).value.get_string();
176                  
177                 }); 
178             
179                 var repo = false;
180                 rs.repos.forEach(function(r) {
181                     if (r.repopath == path) {
182                         repo = r;
183                     
184                     }
185                 
186                 });
187                 Remotes.repo = repo;
188                 Remotes.el.set_transient_for(Clones.el);
189                 Clones.el.set_title("Manage Clones - " + repo.repopath);
190                 Remotes.show();
191                 Clones.el.set_title("Manage Clones");
192             
193               */   
194                 
195                  
196             
197                    
198                 
199                 
200             });
201         }
202
203         // user defined functions
204     }
205
206     public class Xcls_Button5 : Object
207     {
208         public Gtk.Button el;
209         private Clones  _this;
210
211
212             // my vars (def)
213
214         // ctor
215         public Xcls_Button5(Clones _owner )
216         {
217             _this = _owner;
218             this.el = new Gtk.Button();
219
220             // my vars (dec)
221
222             // set gobject values
223             this.el.label = "Branches";
224
225             //listeners
226             this.el.clicked.connect( () => {
227             /*
228                 var rv = this.get('/reposView');
229                 var rs = this.get('/reposStore');
230                 if (rv.el.get_selection().count_selected_rows() != 1) {
231                     //nothing?
232                     // error condition.
233                     return;
234                 }
235                 var Branches =     imports.Branches.Branches;
236                 
237              
238                 var ret = {};       
239                 var s = rv.el.get_selection();
240                 var path = '';
241                 s.selected_foreach(function(model,p,iter) {
242                                                                 
243                    path = model.get_value(iter, 6).value.get_string();
244                  
245                 }); 
246             
247                 var repo = false;
248                 rs.repos.forEach(function(r) {
249                     if (r.repopath == path) {
250                         repo = r;
251                     
252                     }
253                 
254                 });
255                 Branches.repo = repo;
256                 Branches.el.set_transient_for(Clones.el);
257                 Clones.el.set_title("Manage Clones - " + repo.repopath);
258                 Branches.show();
259                 Clones.el.set_title("Manage Clones");
260             
261                  
262                 
263                 
264                 
265             
266                    
267              */   
268                 
269             });
270         }
271
272         // user defined functions
273     }
274
275     public class Xcls_Button6 : Object
276     {
277         public Gtk.Button el;
278         private Clones  _this;
279
280
281             // my vars (def)
282
283         // ctor
284         public Xcls_Button6(Clones _owner )
285         {
286             _this = _owner;
287             this.el = new Gtk.Button();
288
289             // my vars (dec)
290
291             // set gobject values
292             this.el.label = "Merge";
293
294             //listeners
295             this.el.clicked.connect( () =>  {
296             /*
297                 var rv = this.get('/reposView');
298                 var rs = this.get('/reposStore');
299                 if (rv.el.get_selection().count_selected_rows() != 1) {
300                     //nothing?
301                     // error condition.
302                     return;
303                 }
304                 var Merger =     imports.Merger.Merger;
305                 
306              
307                 var ret = {};       
308                 var s = rv.el.get_selection();
309                 var path = '';
310                 s.selected_foreach(function(model,p,iter) {
311                                                                 
312                    path = model.get_value(iter, 6).value.get_string();
313                  
314                 }); 
315             
316                 var repo = false;
317                 rs.repos.forEach(function(r) {
318                     if (r.repopath == path) {
319                         repo = r;
320                     
321                     }
322                 
323                 });
324                 Merger.repo = repo;
325                 Merger.el.set_transient_for(Clones.el);
326                 Clones.el.set_title("Manage Clones - " + repo.repopath);
327                 Merger.show();
328                 Clones.el.set_title("Manage Clones");
329             
330                 
331                 
332             
333                  
334                 
335             
336              */      
337                 
338                 
339             });
340         }
341
342         // user defined functions
343     }
344
345     public class Xcls_Button7 : Object
346     {
347         public Gtk.Button el;
348         private Clones  _this;
349
350
351             // my vars (def)
352
353         // ctor
354         public Xcls_Button7(Clones _owner )
355         {
356             _this = _owner;
357             this.el = new Gtk.Button();
358
359             // my vars (dec)
360
361             // set gobject values
362             this.el.label = "Switch Branch";
363
364             //listeners
365             this.el.clicked.connect( () => {
366                 
367                 
368              
369                    
370                 
371                 
372             });
373         }
374
375         // user defined functions
376     }
377
378     public class Xcls_Button8 : Object
379     {
380         public Gtk.Button el;
381         private Clones  _this;
382
383
384             // my vars (def)
385
386         // ctor
387         public Xcls_Button8(Clones _owner )
388         {
389             _this = _owner;
390             this.el = new Gtk.Button();
391
392             // my vars (dec)
393
394             // set gobject values
395             this.el.label = "Pull";
396
397             //listeners
398             this.el.clicked.connect( () => {
399                 
400                 
401              
402                    
403                 
404                 
405             });
406         }
407
408         // user defined functions
409     }
410
411
412     public class Xcls_ScrolledWindow9 : Object
413     {
414         public Gtk.ScrolledWindow el;
415         private Clones  _this;
416
417
418             // my vars (def)
419
420         // ctor
421         public Xcls_ScrolledWindow9(Clones _owner )
422         {
423             _this = _owner;
424             this.el = new Gtk.ScrolledWindow( null, null );
425
426             // my vars (dec)
427
428             // set gobject values
429             this.el.expand = true;
430             this.el.shadow_type = Gtk.ShadowType.IN;
431             var child_0 = new Xcls_reposView( _this );
432             child_0.ref();
433             this.el.add (  child_0.el  );
434
435             // init method
436
437             {
438               
439                this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
440             }
441         }
442
443         // user defined functions
444     }
445     public class Xcls_reposView : Object
446     {
447         public Gtk.TreeView el;
448         private Clones  _this;
449
450
451             // my vars (def)
452
453         // ctor
454         public Xcls_reposView(Clones _owner )
455         {
456             _this = _owner;
457             _this.reposView = this;
458             this.el = new Gtk.TreeView();
459
460             // my vars (dec)
461
462             // set gobject values
463             var child_0 = new Xcls_reposStore( _this );
464             child_0.ref();
465             this.el.set_model (  child_0.el  );
466             var child_1 = new Xcls_tv_autocommit( _this );
467             child_1.ref();
468             this.el.append_column (  child_1.el  );
469             var child_2 = new Xcls_tv_autopush( _this );
470             child_2.ref();
471             this.el.append_column (  child_2.el  );
472             var child_3 = new Xcls_tv_repo( _this );
473             child_3.ref();
474             this.el.append_column (  child_3.el  );
475             var child_4 = new Xcls_tv_current_branch( _this );
476             child_4.ref();
477             this.el.append_column (  child_4.el  );
478             var child_5 = new Xcls_tv_last_updated( _this );
479             child_5.ref();
480             this.el.append_column (  child_5.el  );
481             var child_6 = new Xcls_tv_all_branches( _this );
482             child_6.ref();
483             this.el.append_column (  child_6.el  );
484
485             // init method
486
487             {
488                 var selection = this.el.get_selection();
489                 selection.set_mode( Gtk.SelectionMode.SINGLE);
490             
491             
492                 var description = new Pango.FontDescription();
493                 description.set_size(10000);
494                 this.el.override_font(description);
495             }
496
497             //listeners
498             this.el.cursor_changed.connect( ()  => {
499               // SEE SELECTION.CHANGED
500               /*
501               
502               return;
503               
504                 if (this.el.get_selection().count_selected_rows() < 1) {
505                     //nothing? - clea it?
506                     return;
507                 }
508                     var ret = {};         
509                 var model = this.get('/changedFilesStore');
510             
511                  var s = this.el.get_selection();
512                  var files = [];
513                 s.selected_foreach(function(model,p,iter) {
514                 
515                    files.push( model.get_value(iter, 0).value.get_string());
516                  
517                 });
518                 this.get('/patchview').showDiff(files); 
519                 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
520                  //print("OUT?" + value);// id..
521                 // load the list in the right grid..
522                  
523                 return true;
524             */
525             });
526         }
527
528         // user defined functions
529     }
530     public class Xcls_reposStore : Object
531     {
532         public Gtk.ListStore el;
533         private Clones  _this;
534
535
536             // my vars (def)
537
538         // ctor
539         public Xcls_reposStore(Clones _owner )
540         {
541             _this = _owner;
542             _this.reposStore = this;
543             this.el = new Gtk.ListStore( 0,      typeof(string),  // 0 repo
544      typeof(string),  // 1 current branch
545      typeof(string),  // 2 all branch
546      typeof(string),  // 3 updated
547      typeof(bool),   // 4 auto commit
548      typeof(bool),   // 5 auto push
549      typeof(string),   // 7 repopath
550       typeof(string)   // 8 color highlighting?
551        );
552
553             // my vars (dec)
554
555             // set gobject values
556         }
557
558         // user defined functions
559     }
560
561     public class Xcls_tv_autocommit : Object
562     {
563         public Gtk.TreeViewColumn el;
564         private Clones  _this;
565
566
567             // my vars (def)
568
569         // ctor
570         public Xcls_tv_autocommit(Clones _owner )
571         {
572             _this = _owner;
573             _this.tv_autocommit = this;
574             this.el = new Gtk.TreeViewColumn();
575
576             // my vars (dec)
577
578             // set gobject values
579             this.el.title = "Auto Commit";
580             this.el.min_width = 50;
581             var child_0 = new Xcls_cr_autocommit( _this );
582             child_0.ref();
583             this.el.pack_start (  child_0.el , false );
584
585             // init method
586
587             //    this.items[0].el.set_activatable(true);
588              this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
589         }
590
591         // user defined functions
592     }
593     public class Xcls_cr_autocommit : Object
594     {
595         public Gtk.CellRendererToggle el;
596         private Clones  _this;
597
598
599             // my vars (def)
600
601         // ctor
602         public Xcls_cr_autocommit(Clones _owner )
603         {
604             _this = _owner;
605             _this.cr_autocommit = this;
606             this.el = new Gtk.CellRendererToggle();
607
608             // my vars (dec)
609
610             // set gobject values
611             this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
612
613             //listeners
614             this.el.toggled.connect( (self, path)  => {
615             /*    var ret ={} ;
616                 var store = this.get('/reposStore');
617                 store.el.get_iter_from_string(ret, path);
618                                                                              
619                 var value =   store.el.get_value(ret.iter,4).value.get_boolean();
620                                                                              
621                 //print(JSON.stringify(value));
622                 store.el.set_value(ret.iter,4, !value);
623                 
624                  var path =  store.el.get_value(ret.iter, 6).value.get_string();
625                  var repo = imports.Scm.Repo.Repo.get(path);
626                  repo.autocommit(!value);
627               */   
628                 
629                 
630             });
631         }
632
633         // user defined functions
634     }
635
636
637     public class Xcls_tv_autopush : Object
638     {
639         public Gtk.TreeViewColumn el;
640         private Clones  _this;
641
642
643             // my vars (def)
644
645         // ctor
646         public Xcls_tv_autopush(Clones _owner )
647         {
648             _this = _owner;
649             _this.tv_autopush = this;
650             this.el = new Gtk.TreeViewColumn();
651
652             // my vars (dec)
653
654             // set gobject values
655             this.el.title = "Auto Push";
656             this.el.min_width = 50;
657             var child_0 = new Xcls_cr_autopush( _this );
658             child_0.ref();
659             this.el.pack_start (  child_0.el , false );
660
661             // init method
662
663             this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
664             //      this.items[0].el.set_activatable(true);
665         }
666
667         // user defined functions
668     }
669     public class Xcls_cr_autopush : Object
670     {
671         public Gtk.CellRendererToggle el;
672         private Clones  _this;
673
674
675             // my vars (def)
676
677         // ctor
678         public Xcls_cr_autopush(Clones _owner )
679         {
680             _this = _owner;
681             _this.cr_autopush = this;
682             this.el = new Gtk.CellRendererToggle();
683
684             // my vars (dec)
685
686             // set gobject values
687             this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
688
689             //listeners
690             this.el.toggled.connect( (self, path)  => {
691             /*    var ret ={} ;
692                 var store = this.get('/reposStore');
693                 store.el.get_iter_from_string(ret, path);
694                                                                              
695                 var value =   store.el.get_value(ret.iter,5).value.get_boolean();
696                                                                              
697                 //print(JSON.stringify(value));
698                 store.el.set_value(ret.iter,5, !value);
699                   var path =  store.el.get_value(ret.iter, 6).value.get_string();
700                  var repo = imports.Scm.Repo.Repo.get(path);
701                  repo.autopush(!value);
702                 */
703             });
704         }
705
706         // user defined functions
707     }
708
709
710     public class Xcls_tv_repo : Object
711     {
712         public Gtk.TreeViewColumn el;
713         private Clones  _this;
714
715
716             // my vars (def)
717
718         // ctor
719         public Xcls_tv_repo(Clones _owner )
720         {
721             _this = _owner;
722             _this.tv_repo = this;
723             this.el = new Gtk.TreeViewColumn();
724
725             // my vars (dec)
726
727             // set gobject values
728             this.el.title = "Repo";
729             this.el.min_width = 200;
730             this.el.resizable = true;
731             var child_0 = new Xcls_cr_repo( _this );
732             child_0.ref();
733             this.el.pack_start (  child_0.el , false );
734
735             // init method
736
737             this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
738         }
739
740         // user defined functions
741     }
742     public class Xcls_cr_repo : Object
743     {
744         public Gtk.CellRendererText el;
745         private Clones  _this;
746
747
748             // my vars (def)
749
750         // ctor
751         public Xcls_cr_repo(Clones _owner )
752         {
753             _this = _owner;
754             _this.cr_repo = this;
755             this.el = new Gtk.CellRendererText();
756
757             // my vars (dec)
758
759             // set gobject values
760         }
761
762         // user defined functions
763     }
764
765
766     public class Xcls_tv_current_branch : Object
767     {
768         public Gtk.TreeViewColumn el;
769         private Clones  _this;
770
771
772             // my vars (def)
773
774         // ctor
775         public Xcls_tv_current_branch(Clones _owner )
776         {
777             _this = _owner;
778             _this.tv_current_branch = this;
779             this.el = new Gtk.TreeViewColumn();
780
781             // my vars (dec)
782
783             // set gobject values
784             this.el.title = "Current Branch";
785             this.el.min_width = 50;
786             var child_0 = new Xcls_cr_current_branch( _this );
787             child_0.ref();
788             this.el.pack_start (  child_0.el , false );
789
790             // init method
791
792             this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
793                  this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
794         }
795
796         // user defined functions
797     }
798     public class Xcls_cr_current_branch : Object
799     {
800         public Gtk.CellRendererText el;
801         private Clones  _this;
802
803
804             // my vars (def)
805
806         // ctor
807         public Xcls_cr_current_branch(Clones _owner )
808         {
809             _this = _owner;
810             _this.cr_current_branch = this;
811             this.el = new Gtk.CellRendererText();
812
813             // my vars (dec)
814
815             // set gobject values
816         }
817
818         // user defined functions
819     }
820
821
822     public class Xcls_tv_last_updated : Object
823     {
824         public Gtk.TreeViewColumn el;
825         private Clones  _this;
826
827
828             // my vars (def)
829
830         // ctor
831         public Xcls_tv_last_updated(Clones _owner )
832         {
833             _this = _owner;
834             _this.tv_last_updated = this;
835             this.el = new Gtk.TreeViewColumn();
836
837             // my vars (dec)
838
839             // set gobject values
840             this.el.title = "Last updated";
841             this.el.min_width = 50;
842             var child_0 = new Xcls_cr_last_updated( _this );
843             child_0.ref();
844             this.el.pack_start (  child_0.el , false );
845
846             // init method
847
848             this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
849         }
850
851         // user defined functions
852     }
853     public class Xcls_cr_last_updated : Object
854     {
855         public Gtk.CellRendererText el;
856         private Clones  _this;
857
858
859             // my vars (def)
860
861         // ctor
862         public Xcls_cr_last_updated(Clones _owner )
863         {
864             _this = _owner;
865             _this.cr_last_updated = this;
866             this.el = new Gtk.CellRendererText();
867
868             // my vars (dec)
869
870             // set gobject values
871         }
872
873         // user defined functions
874     }
875
876
877     public class Xcls_tv_all_branches : Object
878     {
879         public Gtk.TreeViewColumn el;
880         private Clones  _this;
881
882
883             // my vars (def)
884
885         // ctor
886         public Xcls_tv_all_branches(Clones _owner )
887         {
888             _this = _owner;
889             _this.tv_all_branches = this;
890             this.el = new Gtk.TreeViewColumn();
891
892             // my vars (dec)
893
894             // set gobject values
895             this.el.title = "All Branches";
896             this.el.min_width = 50;
897             this.el.resizable = false;
898             var child_0 = new Xcls_cr_all_branches( _this );
899             child_0.ref();
900             this.el.pack_start (  child_0.el , false );
901
902             // init method
903
904             this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
905         }
906
907         // user defined functions
908     }
909     public class Xcls_cr_all_branches : Object
910     {
911         public Gtk.CellRendererText el;
912         private Clones  _this;
913
914
915             // my vars (def)
916
917         // ctor
918         public Xcls_cr_all_branches(Clones _owner )
919         {
920             _this = _owner;
921             _this.cr_all_branches = this;
922             this.el = new Gtk.CellRendererText();
923
924             // my vars (dec)
925
926             // set gobject values
927         }
928
929         // user defined functions
930     }
931
932
933
934
935     public class Xcls_ok_button : Object
936     {
937         public Gtk.Button el;
938         private Clones  _this;
939
940
941             // my vars (def)
942
943         // ctor
944         public Xcls_ok_button(Clones _owner )
945         {
946             _this = _owner;
947             _this.ok_button = this;
948             this.el = new Gtk.Button();
949
950             // my vars (dec)
951
952             // set gobject values
953             this.el.label = "Close";
954         }
955
956         // user defined functions
957     }
958
959
960 }