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