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