RepoStatusPopover.bjs
[gitlive] / RepoStatusPopover.vala
1 static Xcls_RooProjectSettings  _RooProjectSettings;
2
3 public class Xcls_RooProjectSettings : Object
4 {
5     public Gtk.Popover el;
6     private Xcls_RooProjectSettings  _this;
7
8     public static Xcls_RooProjectSettings singleton()
9     {
10         if (_RooProjectSettings == null) {
11             _RooProjectSettings= new Xcls_RooProjectSettings();
12         }
13         return _RooProjectSettings;
14     }
15     public Xcls_label_status label_status;
16     public Xcls_label_diff label_diff;
17     public Xcls_grid grid;
18     public Xcls_path path;
19     public Xcls_base_template base_template;
20     public Xcls_base_template_cellrenderer base_template_cellrenderer;
21     public Xcls_base_template_model base_template_model;
22     public Xcls_rootURL rootURL;
23     public Xcls_html_gen html_gen;
24     public Xcls_html_gen_cellrenderer html_gen_cellrenderer;
25     public Xcls_html_gen_model html_gen_model;
26     public Xcls_view view;
27     public Xcls_database_DBTYPE database_DBTYPE;
28     public Xcls_database_DBNAME database_DBNAME;
29     public Xcls_database_DBUSERNAME database_DBUSERNAME;
30     public Xcls_database_DBPASSWORD database_DBPASSWORD;
31     public Xcls_database_ERROR database_ERROR;
32
33         // my vars (def)
34     public signal void buttonPressed (string btn);
35     public Project.Project project;
36
37     // ctor
38     public Xcls_RooProjectSettings()
39     {
40         _this = this;
41         this.el = new Gtk.Popover( null );
42
43         // my vars (dec)
44
45         // set gobject values
46         this.el.border_width = 0;
47         this.el.modal = true;
48         this.el.position = Gtk.PositionType.RIGHT;
49         var child_0 = new Xcls_Box2( _this );
50         child_0.ref();
51         this.el.add (  child_0.el  );
52     }
53
54     // user defined functions
55     public void show (Gtk.Widget btn, Project.Project project) {
56         _this.project = project;
57         _this.path.el.label = project.firstPath();
58         // get the active project.
59          var lm = Gtk.SourceLanguageManager.get_default();
60                     
61         ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
62             lm.get_language("html")
63         );
64       
65         //print (project.fn);
66         //project.runhtml = project.runhtml || '';
67         _this.view.el.get_buffer().set_text(project.runhtml);
68         
69           
70           
71         _this.rootURL.el.set_text( _this.project.rootURL );
72         
73         _this.html_gen_model.loadData(_this.project.html_gen);
74     
75         _this.base_template_model.loadData();
76         
77          var js = _this.project;
78         _this.database_DBTYPE.el.set_text(     js.get_string_member("DBTYPE") );
79         _this.database_DBNAME.el.set_text(    js.get_string_member("DBNAME") );
80         _this.database_DBUSERNAME.el.set_text(    js.get_string_member("DBUSERNAME") );
81         _this.database_DBPASSWORD.el.set_text(    js.get_string_member("DBPASSWORD") );
82         
83                 //console.log('show all');
84         this.el.set_modal(true);
85         this.el.set_relative_to(btn);
86     
87         this.el.set_position(Gtk.PositionType.RIGHT);
88     
89         // window + header?
90          print("SHOWALL - POPIP\n");
91         this.el.show_all();
92         this.el.set_size_request(800,500);
93         this.view.el.grab_focus();
94         
95         
96         //this.el.show_all();
97     }
98     public void save () {
99        var buf =    _this.view.el.get_buffer();
100        Gtk.TextIter s;
101          Gtk.TextIter e;
102         buf.get_start_iter(out s);
103         buf.get_end_iter(out e);
104         _this.project.runhtml = buf.get_text(s,e,true);
105           
106         _this.project.rootURL = _this.rootURL.el.get_text();
107         
108         
109         Gtk.TreeIter iter;
110         Value html_gen_val;
111         _this.html_gen.el.get_active_iter(out iter);
112         _this.html_gen_model.el.get_value (iter, 0, out html_gen_val);
113         
114         _this.project.html_gen = (string)html_gen_val;
115         
116         // set by event changed...
117         //_this.project.base_template = _this.base_template.el.get_text();    
118         
119         var js = _this.project.json_project_data;
120         js.set_string_member("DBTYPE", _this.database_DBTYPE.el.get_text());
121        js.set_string_member("DBNAME", _this.database_DBNAME.el.get_text());
122         js.set_string_member("DBUSERNAME", _this.database_DBUSERNAME.el.get_text());
123         js.set_string_member("DBPASSWORD", _this.database_DBPASSWORD.el.get_text());
124     //    _this.project.set_string_member("DBHOST", _this.DBTYPE.el.get_text());    
125         
126         // need to re-init the database 
127         
128         _this.project.initRooDatabase();
129          
130         
131     }
132     public class Xcls_Box2 : Object
133     {
134         public Gtk.Box el;
135         private Xcls_RooProjectSettings  _this;
136
137
138             // my vars (def)
139
140         // ctor
141         public Xcls_Box2(Xcls_RooProjectSettings _owner )
142         {
143             _this = _owner;
144             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
145
146             // my vars (dec)
147
148             // set gobject values
149             this.el.homogeneous = false;
150             this.el.border_width = 5;
151             var child_0 = new Xcls_Notebook3( _this );
152             child_0.ref();
153             this.el.pack_start (  child_0.el , true,true,0 );
154             var child_1 = new Xcls_Box34( _this );
155             child_1.ref();
156             this.el.pack_end (  child_1.el , false,false,0 );
157         }
158
159         // user defined functions
160     }
161     public class Xcls_Notebook3 : Object
162     {
163         public Gtk.Notebook el;
164         private Xcls_RooProjectSettings  _this;
165
166
167             // my vars (def)
168
169         // ctor
170         public Xcls_Notebook3(Xcls_RooProjectSettings _owner )
171         {
172             _this = _owner;
173             this.el = new Gtk.Notebook();
174
175             // my vars (dec)
176
177             // set gobject values
178             var child_0 = new Xcls_label_status( _this );
179             child_0.ref();
180             var child_1 = new Xcls_label_diff( _this );
181             child_1.ref();
182             var child_2 = new Xcls_Box6( _this );
183             child_2.ref();
184             this.el.append_page (  child_2.el , _this.label_status.el );
185             var child_3 = new Xcls_Box23( _this );
186             child_3.ref();
187             this.el.append_page (  child_3.el , _this.label_database.el );
188         }
189
190         // user defined functions
191     }
192     public class Xcls_label_status : Object
193     {
194         public Gtk.Label el;
195         private Xcls_RooProjectSettings  _this;
196
197
198             // my vars (def)
199
200         // ctor
201         public Xcls_label_status(Xcls_RooProjectSettings _owner )
202         {
203             _this = _owner;
204             _this.label_status = this;
205             this.el = new Gtk.Label( "Status" );
206
207             // my vars (dec)
208
209             // set gobject values
210         }
211
212         // user defined functions
213     }
214
215     public class Xcls_label_diff : Object
216     {
217         public Gtk.Label el;
218         private Xcls_RooProjectSettings  _this;
219
220
221             // my vars (def)
222
223         // ctor
224         public Xcls_label_diff(Xcls_RooProjectSettings _owner )
225         {
226             _this = _owner;
227             _this.label_diff = this;
228             this.el = new Gtk.Label( "Diff" );
229
230             // my vars (dec)
231
232             // set gobject values
233         }
234
235         // user defined functions
236     }
237
238     public class Xcls_Box6 : Object
239     {
240         public Gtk.Box el;
241         private Xcls_RooProjectSettings  _this;
242
243
244             // my vars (def)
245
246         // ctor
247         public Xcls_Box6(Xcls_RooProjectSettings _owner )
248         {
249             _this = _owner;
250             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
251
252             // my vars (dec)
253
254             // set gobject values
255             this.el.homogeneous = false;
256             var child_0 = new Xcls_grid( _this );
257             child_0.ref();
258             this.el.pack_start (  child_0.el , false,false,4 );
259             var child_1 = new Xcls_Label20( _this );
260             child_1.ref();
261             this.el.pack_start (  child_1.el , false,false,0 );
262             var child_2 = new Xcls_ScrolledWindow21( _this );
263             child_2.ref();
264             this.el.pack_start (  child_2.el , true,true,0 );
265         }
266
267         // user defined functions
268     }
269     public class Xcls_grid : Object
270     {
271         public Gtk.Grid el;
272         private Xcls_RooProjectSettings  _this;
273
274
275             // my vars (def)
276
277         // ctor
278         public Xcls_grid(Xcls_RooProjectSettings _owner )
279         {
280             _this = _owner;
281             _this.grid = this;
282             this.el = new Gtk.Grid();
283
284             // my vars (dec)
285
286             // set gobject values
287             this.el.margin_right = 4;
288             this.el.margin_left = 4;
289             this.el.row_spacing = 2;
290             var child_0 = new Xcls_Label8( _this );
291             child_0.ref();
292             this.el.attach (  child_0.el , 0,0,1,1 );
293             var child_1 = new Xcls_path( _this );
294             child_1.ref();
295             this.el.attach (  child_1.el , 1,0,1,1 );
296             var child_2 = new Xcls_Label10( _this );
297             child_2.ref();
298             this.el.attach (  child_2.el , 0,1,1,1 );
299             var child_3 = new Xcls_base_template( _this );
300             child_3.ref();
301             this.el.attach (  child_3.el , 1,1,1,1 );
302             var child_4 = new Xcls_Label14( _this );
303             child_4.ref();
304             this.el.attach (  child_4.el , 0,2,1,1 );
305             var child_5 = new Xcls_rootURL( _this );
306             child_5.ref();
307             this.el.attach (  child_5.el , 1,2,1,1 );
308             var child_6 = new Xcls_Label16( _this );
309             child_6.ref();
310             this.el.attach (  child_6.el , 0,3,1,1 );
311             var child_7 = new Xcls_html_gen( _this );
312             child_7.ref();
313             this.el.attach (  child_7.el , 1,3,1,1 );
314         }
315
316         // user defined functions
317     }
318     public class Xcls_Label8 : Object
319     {
320         public Gtk.Label el;
321         private Xcls_RooProjectSettings  _this;
322
323
324             // my vars (def)
325
326         // ctor
327         public Xcls_Label8(Xcls_RooProjectSettings _owner )
328         {
329             _this = _owner;
330             this.el = new Gtk.Label( "Filename" );
331
332             // my vars (dec)
333
334             // set gobject values
335             this.el.margin = 3;
336             this.el.xalign = 0f;
337         }
338
339         // user defined functions
340     }
341
342     public class Xcls_path : Object
343     {
344         public Gtk.Label el;
345         private Xcls_RooProjectSettings  _this;
346
347
348             // my vars (def)
349
350         // ctor
351         public Xcls_path(Xcls_RooProjectSettings _owner )
352         {
353             _this = _owner;
354             _this.path = this;
355             this.el = new Gtk.Label( "filename" );
356
357             // my vars (dec)
358
359             // set gobject values
360             this.el.margin = 3;
361             this.el.xalign = 0f;
362         }
363
364         // user defined functions
365     }
366
367     public class Xcls_Label10 : Object
368     {
369         public Gtk.Label el;
370         private Xcls_RooProjectSettings  _this;
371
372
373             // my vars (def)
374
375         // ctor
376         public Xcls_Label10(Xcls_RooProjectSettings _owner )
377         {
378             _this = _owner;
379             this.el = new Gtk.Label( "HTML template file" );
380
381             // my vars (dec)
382
383             // set gobject values
384             this.el.margin = 3;
385         }
386
387         // user defined functions
388     }
389
390     public class Xcls_base_template : Object
391     {
392         public Gtk.ComboBox el;
393         private Xcls_RooProjectSettings  _this;
394
395
396             // my vars (def)
397         public bool loading;
398
399         // ctor
400         public Xcls_base_template(Xcls_RooProjectSettings _owner )
401         {
402             _this = _owner;
403             _this.base_template = this;
404             this.el = new Gtk.ComboBox();
405
406             // my vars (dec)
407             this.loading = false;
408
409             // set gobject values
410             var child_0 = new Xcls_base_template_cellrenderer( _this );
411             child_0.ref();
412             this.el.pack_start (  child_0.el , true );
413             var child_1 = new Xcls_base_template_model( _this );
414             child_1.ref();
415             this.el.set_model (  child_1.el  );
416
417             // init method
418
419             this.el.add_attribute(_this.base_template_cellrenderer.el , "markup", 0 );
420
421             //listeners
422             this.el.changed.connect( () => {
423                 Gtk.TreeIter iter;
424              
425                 // this get's called when we are filling in the data... ???
426                 if (this.loading) {
427                         return;
428                 }
429                 
430              
431                 if (this.el.get_active_iter(out iter)) {
432                         Value vfname;
433                         _this.base_template_model.el.get_value (iter, 0, out vfname);
434                         _this.project.base_template = ((string)vfname) ;
435                         
436                          print("\nSET base template to %s\n", _this.project.base_template );
437                         // is_bjs = ((string)vfname) == "bjs";
438                 }
439                 
440               
441                 // directory is only available for non-bjs 
442              
443             
444             
445             });
446         }
447
448         // user defined functions
449     }
450     public class Xcls_base_template_cellrenderer : Object
451     {
452         public Gtk.CellRendererText el;
453         private Xcls_RooProjectSettings  _this;
454
455
456             // my vars (def)
457
458         // ctor
459         public Xcls_base_template_cellrenderer(Xcls_RooProjectSettings _owner )
460         {
461             _this = _owner;
462             _this.base_template_cellrenderer = this;
463             this.el = new Gtk.CellRendererText();
464
465             // my vars (dec)
466
467             // set gobject values
468         }
469
470         // user defined functions
471     }
472
473     public class Xcls_base_template_model : Object
474     {
475         public Gtk.ListStore el;
476         private Xcls_RooProjectSettings  _this;
477
478
479             // my vars (def)
480
481         // ctor
482         public Xcls_base_template_model(Xcls_RooProjectSettings _owner )
483         {
484             _this = _owner;
485             _this.base_template_model = this;
486             this.el = new Gtk.ListStore( 1, typeof(string) );
487
488             // my vars (dec)
489
490             // set gobject values
491         }
492
493         // user defined functions
494         public void loadData () {
495                 _this.base_template.loading = true;
496           
497             this.el.clear();                                    
498             Gtk.TreeIter iter;
499             var el = this.el;
500             
501            /// el.append(out iter);
502             
503            
504             el.append(out iter);
505             el.set_value(iter, 0, "roo.builder.html");
506             _this.base_template.el.set_active_iter(iter);
507                 if (_this.project.base_template == "roo.builder.html") {
508                    _this.base_template.el.set_active_iter(iter);
509             }
510         
511             el.append(out iter);
512             el.set_value(iter, 0, "bootstrap.builder.html");
513          
514                 print("\ncur template = %s\n", _this.project.base_template);
515          
516             if (_this.project.base_template == "bootstrap.builder.html") {
517                    _this.base_template.el.set_active_iter(iter);
518             }
519         
520                 el.append(out iter);
521             el.set_value(iter, 0, "mailer.builder.html");
522         
523                 if (_this.project.base_template == "mailer.builder.html") {
524                     _this.base_template.el.set_active_iter(iter);
525             }
526                 _this.base_template.loading = false;
527                                              
528         }
529     }
530
531
532     public class Xcls_Label14 : Object
533     {
534         public Gtk.Label el;
535         private Xcls_RooProjectSettings  _this;
536
537
538             // my vars (def)
539
540         // ctor
541         public Xcls_Label14(Xcls_RooProjectSettings _owner )
542         {
543             _this = _owner;
544             this.el = new Gtk.Label( "root URL" );
545
546             // my vars (dec)
547
548             // set gobject values
549             this.el.margin = 3;
550         }
551
552         // user defined functions
553     }
554
555     public class Xcls_rootURL : Object
556     {
557         public Gtk.Entry el;
558         private Xcls_RooProjectSettings  _this;
559
560
561             // my vars (def)
562
563         // ctor
564         public Xcls_rootURL(Xcls_RooProjectSettings _owner )
565         {
566             _this = _owner;
567             _this.rootURL = this;
568             this.el = new Gtk.Entry();
569
570             // my vars (dec)
571
572             // set gobject values
573         }
574
575         // user defined functions
576     }
577
578     public class Xcls_Label16 : Object
579     {
580         public Gtk.Label el;
581         private Xcls_RooProjectSettings  _this;
582
583
584             // my vars (def)
585
586         // ctor
587         public Xcls_Label16(Xcls_RooProjectSettings _owner )
588         {
589             _this = _owner;
590             this.el = new Gtk.Label( "Generate HTML in" );
591
592             // my vars (dec)
593
594             // set gobject values
595             this.el.margin = 3;
596         }
597
598         // user defined functions
599     }
600
601     public class Xcls_html_gen : Object
602     {
603         public Gtk.ComboBox el;
604         private Xcls_RooProjectSettings  _this;
605
606
607             // my vars (def)
608
609         // ctor
610         public Xcls_html_gen(Xcls_RooProjectSettings _owner )
611         {
612             _this = _owner;
613             _this.html_gen = this;
614             this.el = new Gtk.ComboBox();
615
616             // my vars (dec)
617
618             // set gobject values
619             var child_0 = new Xcls_html_gen_cellrenderer( _this );
620             child_0.ref();
621             this.el.pack_start (  child_0.el , true );
622             var child_1 = new Xcls_html_gen_model( _this );
623             child_1.ref();
624             this.el.set_model (  child_1.el  );
625
626             // init method
627
628             this.el.add_attribute(_this.html_gen_cellrenderer.el , "markup", 1 );
629         }
630
631         // user defined functions
632     }
633     public class Xcls_html_gen_cellrenderer : Object
634     {
635         public Gtk.CellRendererText el;
636         private Xcls_RooProjectSettings  _this;
637
638
639             // my vars (def)
640
641         // ctor
642         public Xcls_html_gen_cellrenderer(Xcls_RooProjectSettings _owner )
643         {
644             _this = _owner;
645             _this.html_gen_cellrenderer = this;
646             this.el = new Gtk.CellRendererText();
647
648             // my vars (dec)
649
650             // set gobject values
651         }
652
653         // user defined functions
654     }
655
656     public class Xcls_html_gen_model : Object
657     {
658         public Gtk.ListStore el;
659         private Xcls_RooProjectSettings  _this;
660
661
662             // my vars (def)
663
664         // ctor
665         public Xcls_html_gen_model(Xcls_RooProjectSettings _owner )
666         {
667             _this = _owner;
668             _this.html_gen_model = this;
669             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
670
671             // my vars (dec)
672
673             // set gobject values
674         }
675
676         // user defined functions
677         public void loadData (string cur) {
678             this.el.clear();                                    
679             Gtk.TreeIter iter;
680             var el = this.el;
681             
682          
683             el.append(out iter);
684         
685             
686             el.set_value(iter, 0, "");
687             el.set_value(iter, 1, "Do not Generate");
688             _this.html_gen.el.set_active_iter(iter);
689         
690             el.append(out iter);
691             
692             el.set_value(iter, 0, "bjs");
693             el.set_value(iter, 1, "same directory as BJS file");
694                 if (cur == "bjs") {
695                     _this.html_gen.el.set_active_iter(iter);
696             }
697         
698         
699         
700             el.append(out iter);
701             
702             el.set_value(iter, 0, "templates");
703             el.set_value(iter, 1, "in templates subdirectory");
704         
705                 if (cur == "template") {
706                     _this.html_gen.el.set_active_iter(iter);
707             }
708         
709                                              
710         }
711     }
712
713
714
715     public class Xcls_Label20 : Object
716     {
717         public Gtk.Label el;
718         private Xcls_RooProjectSettings  _this;
719
720
721             // my vars (def)
722
723         // ctor
724         public Xcls_Label20(Xcls_RooProjectSettings _owner )
725         {
726             _this = _owner;
727             this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
728
729             // my vars (dec)
730
731             // set gobject values
732         }
733
734         // user defined functions
735     }
736
737     public class Xcls_ScrolledWindow21 : Object
738     {
739         public Gtk.ScrolledWindow el;
740         private Xcls_RooProjectSettings  _this;
741
742
743             // my vars (def)
744
745         // ctor
746         public Xcls_ScrolledWindow21(Xcls_RooProjectSettings _owner )
747         {
748             _this = _owner;
749             this.el = new Gtk.ScrolledWindow( null, null );
750
751             // my vars (dec)
752
753             // set gobject values
754             var child_0 = new Xcls_view( _this );
755             child_0.ref();
756             this.el.add (  child_0.el  );
757         }
758
759         // user defined functions
760     }
761     public class Xcls_view : Object
762     {
763         public Gtk.SourceView el;
764         private Xcls_RooProjectSettings  _this;
765
766
767             // my vars (def)
768
769         // ctor
770         public Xcls_view(Xcls_RooProjectSettings _owner )
771         {
772             _this = _owner;
773             _this.view = this;
774             this.el = new Gtk.SourceView();
775
776             // my vars (dec)
777
778             // init method
779
780             var description =   Pango.FontDescription.from_string("monospace");
781                 description.set_size(9000);
782                 this.el.override_font(description);
783
784             //listeners
785             this.el.key_release_event.connect( ( event) =>{
786                 if (event.keyval != 115) {
787                     return false;
788                      
789                 }
790                 if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
791                     return false;
792                 }
793                  var buf =    this.el.get_buffer();
794                 Gtk.TextIter s;
795                 Gtk.TextIter e;
796                 buf.get_start_iter(out s);
797                 buf.get_end_iter(out e);
798                 _this.project.runhtml = buf.get_text(s,e,true);
799                 
800                       
801                 _this.buttonPressed("save");
802                  
803                 return false;
804                      
805             });
806         }
807
808         // user defined functions
809     }
810
811
812
813     public class Xcls_Box23 : Object
814     {
815         public Gtk.Box el;
816         private Xcls_RooProjectSettings  _this;
817
818
819             // my vars (def)
820
821         // ctor
822         public Xcls_Box23(Xcls_RooProjectSettings _owner )
823         {
824             _this = _owner;
825             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
826
827             // my vars (dec)
828
829             // set gobject values
830             this.el.homogeneous = false;
831             var child_0 = new Xcls_Label24( _this );
832             child_0.ref();
833             this.el.pack_start (  child_0.el , false,false,0 );
834             var child_1 = new Xcls_database_DBTYPE( _this );
835             child_1.ref();
836             this.el.pack_start (  child_1.el , false,false,0 );
837             var child_2 = new Xcls_Label26( _this );
838             child_2.ref();
839             this.el.pack_start (  child_2.el , false,false,0 );
840             var child_3 = new Xcls_database_DBNAME( _this );
841             child_3.ref();
842             this.el.pack_start (  child_3.el , false,false,0 );
843             var child_4 = new Xcls_Label28( _this );
844             child_4.ref();
845             this.el.pack_start (  child_4.el , false,false,0 );
846             var child_5 = new Xcls_database_DBUSERNAME( _this );
847             child_5.ref();
848             this.el.pack_start (  child_5.el , false,false,0 );
849             var child_6 = new Xcls_Label30( _this );
850             child_6.ref();
851             this.el.pack_start (  child_6.el , false,false,0 );
852             var child_7 = new Xcls_database_DBPASSWORD( _this );
853             child_7.ref();
854             this.el.pack_start (  child_7.el , false,false,0 );
855             var child_8 = new Xcls_Button32( _this );
856             child_8.ref();
857             this.el.pack_start (  child_8.el , false,false,0 );
858             var child_9 = new Xcls_database_ERROR( _this );
859             child_9.ref();
860             this.el.pack_start (  child_9.el , false,false,0 );
861         }
862
863         // user defined functions
864     }
865     public class Xcls_Label24 : Object
866     {
867         public Gtk.Label el;
868         private Xcls_RooProjectSettings  _this;
869
870
871             // my vars (def)
872
873         // ctor
874         public Xcls_Label24(Xcls_RooProjectSettings _owner )
875         {
876             _this = _owner;
877             this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
878
879             // my vars (dec)
880
881             // set gobject values
882             this.el.xalign = 0f;
883         }
884
885         // user defined functions
886     }
887
888     public class Xcls_database_DBTYPE : Object
889     {
890         public Gtk.Entry el;
891         private Xcls_RooProjectSettings  _this;
892
893
894             // my vars (def)
895
896         // ctor
897         public Xcls_database_DBTYPE(Xcls_RooProjectSettings _owner )
898         {
899             _this = _owner;
900             _this.database_DBTYPE = this;
901             this.el = new Gtk.Entry();
902
903             // my vars (dec)
904
905             // set gobject values
906
907             //listeners
908             this.el.key_press_event.connect( (ev) => {
909             
910                 if (ev.keyval == Gdk.Key.Tab) {
911                     _this.database_DBNAME.el.grab_focus();
912                     return true;
913                 }
914             
915             
916                 return false;
917             });
918         }
919
920         // user defined functions
921     }
922
923     public class Xcls_Label26 : Object
924     {
925         public Gtk.Label el;
926         private Xcls_RooProjectSettings  _this;
927
928
929             // my vars (def)
930
931         // ctor
932         public Xcls_Label26(Xcls_RooProjectSettings _owner )
933         {
934             _this = _owner;
935             this.el = new Gtk.Label( "Name" );
936
937             // my vars (dec)
938
939             // set gobject values
940             this.el.xalign = 0f;
941         }
942
943         // user defined functions
944     }
945
946     public class Xcls_database_DBNAME : Object
947     {
948         public Gtk.Entry el;
949         private Xcls_RooProjectSettings  _this;
950
951
952             // my vars (def)
953
954         // ctor
955         public Xcls_database_DBNAME(Xcls_RooProjectSettings _owner )
956         {
957             _this = _owner;
958             _this.database_DBNAME = this;
959             this.el = new Gtk.Entry();
960
961             // my vars (dec)
962
963             // set gobject values
964
965             //listeners
966             this.el.key_press_event.connect( (ev) => {
967             
968                 if (ev.keyval == Gdk.Key.Tab) {
969                     _this.database_DBUSERNAME.el.grab_focus();
970                     return true;
971                 }
972             
973             
974                 return false;
975             });
976         }
977
978         // user defined functions
979     }
980
981     public class Xcls_Label28 : Object
982     {
983         public Gtk.Label el;
984         private Xcls_RooProjectSettings  _this;
985
986
987             // my vars (def)
988
989         // ctor
990         public Xcls_Label28(Xcls_RooProjectSettings _owner )
991         {
992             _this = _owner;
993             this.el = new Gtk.Label( "Username" );
994
995             // my vars (dec)
996
997             // set gobject values
998             this.el.xalign = 0f;
999         }
1000
1001         // user defined functions
1002     }
1003
1004     public class Xcls_database_DBUSERNAME : Object
1005     {
1006         public Gtk.Entry el;
1007         private Xcls_RooProjectSettings  _this;
1008
1009
1010             // my vars (def)
1011
1012         // ctor
1013         public Xcls_database_DBUSERNAME(Xcls_RooProjectSettings _owner )
1014         {
1015             _this = _owner;
1016             _this.database_DBUSERNAME = this;
1017             this.el = new Gtk.Entry();
1018
1019             // my vars (dec)
1020
1021             // set gobject values
1022
1023             //listeners
1024             this.el.key_press_event.connect( (ev) => {
1025             
1026                 if (ev.keyval == Gdk.Key.Tab) {
1027                     _this.database_DBPASSWORD.el.grab_focus();
1028                     return true;
1029                 }
1030             
1031             
1032                 return false;
1033             });
1034         }
1035
1036         // user defined functions
1037     }
1038
1039     public class Xcls_Label30 : Object
1040     {
1041         public Gtk.Label el;
1042         private Xcls_RooProjectSettings  _this;
1043
1044
1045             // my vars (def)
1046
1047         // ctor
1048         public Xcls_Label30(Xcls_RooProjectSettings _owner )
1049         {
1050             _this = _owner;
1051             this.el = new Gtk.Label( "Password" );
1052
1053             // my vars (dec)
1054
1055             // set gobject values
1056             this.el.xalign = 0f;
1057         }
1058
1059         // user defined functions
1060     }
1061
1062     public class Xcls_database_DBPASSWORD : Object
1063     {
1064         public Gtk.Entry el;
1065         private Xcls_RooProjectSettings  _this;
1066
1067
1068             // my vars (def)
1069
1070         // ctor
1071         public Xcls_database_DBPASSWORD(Xcls_RooProjectSettings _owner )
1072         {
1073             _this = _owner;
1074             _this.database_DBPASSWORD = this;
1075             this.el = new Gtk.Entry();
1076
1077             // my vars (dec)
1078
1079             // set gobject values
1080         }
1081
1082         // user defined functions
1083     }
1084
1085     public class Xcls_Button32 : Object
1086     {
1087         public Gtk.Button el;
1088         private Xcls_RooProjectSettings  _this;
1089
1090
1091             // my vars (def)
1092
1093         // ctor
1094         public Xcls_Button32(Xcls_RooProjectSettings _owner )
1095         {
1096             _this = _owner;
1097             this.el = new Gtk.Button();
1098
1099             // my vars (dec)
1100
1101             // set gobject values
1102             this.el.label = "Check Connection";
1103
1104             //listeners
1105             this.el.clicked.connect( () => {
1106             
1107             
1108               _this.database_ERROR.el.label    = "";
1109                 Gda.Connection cnc;
1110                 try {
1111                     // assumes localhost...
1112                      cnc = Gda.Connection.open_from_string (
1113                                 _this.database_DBTYPE.el.get_text(),
1114                                 "DB_NAME=" + _this.database_DBNAME.el.get_text(), 
1115                                 "USERNAME=" + _this.database_DBUSERNAME.el.get_text() + 
1116                                 ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
1117                                 Gda.ConnectionOptions.NONE
1118                         );
1119                //} catch (Gda.ConnectionError ce) { 
1120                //   _this.database_ERROR.el.label = ce.message;        
1121                } catch(Gda.ConnectionError ue) {
1122                   _this.database_ERROR.el.label = ue.message;
1123                     return;
1124                }  catch(Gda.ConfigError ue) {
1125                   _this.database_ERROR.el.label = ue.message;
1126                     return;
1127                }
1128               _this.database_ERROR.el.label = "Connection Succeeded";
1129                cnc.close();
1130             });
1131         }
1132
1133         // user defined functions
1134     }
1135
1136     public class Xcls_database_ERROR : Object
1137     {
1138         public Gtk.Label el;
1139         private Xcls_RooProjectSettings  _this;
1140
1141
1142             // my vars (def)
1143
1144         // ctor
1145         public Xcls_database_ERROR(Xcls_RooProjectSettings _owner )
1146         {
1147             _this = _owner;
1148             _this.database_ERROR = this;
1149             this.el = new Gtk.Label( " " );
1150
1151             // my vars (dec)
1152
1153             // set gobject values
1154             this.el.margin = 3;
1155             this.el.xalign = 0f;
1156         }
1157
1158         // user defined functions
1159     }
1160
1161
1162
1163     public class Xcls_Box34 : Object
1164     {
1165         public Gtk.Box el;
1166         private Xcls_RooProjectSettings  _this;
1167
1168
1169             // my vars (def)
1170
1171         // ctor
1172         public Xcls_Box34(Xcls_RooProjectSettings _owner )
1173         {
1174             _this = _owner;
1175             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
1176
1177             // my vars (dec)
1178
1179             // set gobject values
1180             this.el.homogeneous = true;
1181             this.el.expand = false;
1182             this.el.vexpand = false;
1183             var child_0 = new Xcls_Button35( _this );
1184             child_0.ref();
1185             this.el.add (  child_0.el  );
1186             var child_1 = new Xcls_Button36( _this );
1187             child_1.ref();
1188             this.el.add (  child_1.el  );
1189         }
1190
1191         // user defined functions
1192     }
1193     public class Xcls_Button35 : Object
1194     {
1195         public Gtk.Button el;
1196         private Xcls_RooProjectSettings  _this;
1197
1198
1199             // my vars (def)
1200
1201         // ctor
1202         public Xcls_Button35(Xcls_RooProjectSettings _owner )
1203         {
1204             _this = _owner;
1205             this.el = new Gtk.Button();
1206
1207             // my vars (dec)
1208
1209             // set gobject values
1210             this.el.label = "Apply";
1211
1212             //listeners
1213             this.el.button_press_event.connect( () => {
1214                 _this.save();
1215                       
1216                 _this.buttonPressed("apply");
1217                     return false;
1218             });
1219         }
1220
1221         // user defined functions
1222     }
1223
1224     public class Xcls_Button36 : Object
1225     {
1226         public Gtk.Button el;
1227         private Xcls_RooProjectSettings  _this;
1228
1229
1230             // my vars (def)
1231
1232         // ctor
1233         public Xcls_Button36(Xcls_RooProjectSettings _owner )
1234         {
1235             _this = _owner;
1236             this.el = new Gtk.Button();
1237
1238             // my vars (dec)
1239
1240             // set gobject values
1241             this.el.label = "Save";
1242
1243             //listeners
1244             this.el.button_press_event.connect( () => {
1245                    _this.save();
1246                       
1247                 _this.buttonPressed("save");
1248                     return false;
1249             });
1250         }
1251
1252         // user defined functions
1253     }
1254
1255
1256
1257 }