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