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