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