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