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                         // is_bjs = ((string)vfname) == "bjs";
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             el.set_value(iter, 0, "roo.builder.html");
439             _this.filetype.el.set_active_iter(iter);
440         
441         
442             el.append(out iter);
443             el.set_value(iter, 0, "bootstrap.builder.html");
444             if (cur == "bootstrap.builder.html") {
445                    _this.base_template.el.set_active_iter(iter);
446            }
447         
448                 el.append(out iter);
449             el.set_value(iter, 0, "mailer.builder.html");
450         
451                 if (cur == "mailer.builder.html") {
452                     _this.base_template.el.set_active_iter(iter);
453             }
454         
455                                              
456         }
457     }
458
459
460
461     public class Xcls_Box13 : Object
462     {
463         public Gtk.Box el;
464         private Xcls_RooProjectSettings  _this;
465
466
467             // my vars (def)
468
469         // ctor
470         public Xcls_Box13(Xcls_RooProjectSettings _owner )
471         {
472             _this = _owner;
473             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
474
475             // my vars (dec)
476
477             // set gobject values
478             this.el.homogeneous = false;
479             this.el.expand = false;
480             var child_0 = new Xcls_Label14( _this );
481             child_0.ref();
482             this.el.pack_start (  child_0.el , false,false,0 );
483             var child_1 = new Xcls_rootURL( _this );
484             child_1.ref();
485             this.el.add (  child_1.el  );
486         }
487
488         // user defined functions
489     }
490     public class Xcls_Label14 : Object
491     {
492         public Gtk.Label el;
493         private Xcls_RooProjectSettings  _this;
494
495
496             // my vars (def)
497
498         // ctor
499         public Xcls_Label14(Xcls_RooProjectSettings _owner )
500         {
501             _this = _owner;
502             this.el = new Gtk.Label( "root URL" );
503
504             // my vars (dec)
505
506             // set gobject values
507             this.el.margin = 3;
508         }
509
510         // user defined functions
511     }
512
513     public class Xcls_rootURL : Object
514     {
515         public Gtk.Entry el;
516         private Xcls_RooProjectSettings  _this;
517
518
519             // my vars (def)
520
521         // ctor
522         public Xcls_rootURL(Xcls_RooProjectSettings _owner )
523         {
524             _this = _owner;
525             _this.rootURL = this;
526             this.el = new Gtk.Entry();
527
528             // my vars (dec)
529
530             // set gobject values
531         }
532
533         // user defined functions
534     }
535
536
537     public class Xcls_Label16 : Object
538     {
539         public Gtk.Label el;
540         private Xcls_RooProjectSettings  _this;
541
542
543             // my vars (def)
544
545         // ctor
546         public Xcls_Label16(Xcls_RooProjectSettings _owner )
547         {
548             _this = _owner;
549             this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
550
551             // my vars (dec)
552
553             // set gobject values
554         }
555
556         // user defined functions
557     }
558
559     public class Xcls_ScrolledWindow17 : Object
560     {
561         public Gtk.ScrolledWindow el;
562         private Xcls_RooProjectSettings  _this;
563
564
565             // my vars (def)
566
567         // ctor
568         public Xcls_ScrolledWindow17(Xcls_RooProjectSettings _owner )
569         {
570             _this = _owner;
571             this.el = new Gtk.ScrolledWindow( null, null );
572
573             // my vars (dec)
574
575             // set gobject values
576             var child_0 = new Xcls_view( _this );
577             child_0.ref();
578             this.el.add (  child_0.el  );
579         }
580
581         // user defined functions
582     }
583     public class Xcls_view : Object
584     {
585         public Gtk.SourceView el;
586         private Xcls_RooProjectSettings  _this;
587
588
589             // my vars (def)
590
591         // ctor
592         public Xcls_view(Xcls_RooProjectSettings _owner )
593         {
594             _this = _owner;
595             _this.view = this;
596             this.el = new Gtk.SourceView();
597
598             // my vars (dec)
599
600             // init method
601
602             var description =   Pango.FontDescription.from_string("monospace");
603                 description.set_size(9000);
604                 this.el.override_font(description);
605
606             //listeners
607             this.el.key_release_event.connect( ( event) =>{
608                 if (event.keyval != 115) {
609                     return false;
610                      
611                 }
612                 if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
613                     return false;
614                 }
615                  var buf =    this.el.get_buffer();
616                 Gtk.TextIter s;
617                 Gtk.TextIter e;
618                 buf.get_start_iter(out s);
619                 buf.get_end_iter(out e);
620                 _this.project.runhtml = buf.get_text(s,e,true);
621                 
622                       
623                 _this.buttonPressed("save");
624                  
625                 return false;
626                      
627             });
628         }
629
630         // user defined functions
631     }
632
633
634
635     public class Xcls_Box19 : Object
636     {
637         public Gtk.Box el;
638         private Xcls_RooProjectSettings  _this;
639
640
641             // my vars (def)
642
643         // ctor
644         public Xcls_Box19(Xcls_RooProjectSettings _owner )
645         {
646             _this = _owner;
647             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
648
649             // my vars (dec)
650
651             // set gobject values
652             this.el.homogeneous = false;
653             var child_0 = new Xcls_Label20( _this );
654             child_0.ref();
655             this.el.pack_start (  child_0.el , false,false,0 );
656             var child_1 = new Xcls_database_DBTYPE( _this );
657             child_1.ref();
658             this.el.pack_start (  child_1.el , false,false,0 );
659             var child_2 = new Xcls_Label22( _this );
660             child_2.ref();
661             this.el.pack_start (  child_2.el , false,false,0 );
662             var child_3 = new Xcls_database_DBNAME( _this );
663             child_3.ref();
664             this.el.pack_start (  child_3.el , false,false,0 );
665             var child_4 = new Xcls_Label24( _this );
666             child_4.ref();
667             this.el.pack_start (  child_4.el , false,false,0 );
668             var child_5 = new Xcls_database_DBUSERNAME( _this );
669             child_5.ref();
670             this.el.pack_start (  child_5.el , false,false,0 );
671             var child_6 = new Xcls_Label26( _this );
672             child_6.ref();
673             this.el.pack_start (  child_6.el , false,false,0 );
674             var child_7 = new Xcls_database_DBPASSWORD( _this );
675             child_7.ref();
676             this.el.pack_start (  child_7.el , false,false,0 );
677             var child_8 = new Xcls_Button28( _this );
678             child_8.ref();
679             this.el.pack_start (  child_8.el , false,false,0 );
680             var child_9 = new Xcls_database_ERROR( _this );
681             child_9.ref();
682             this.el.pack_start (  child_9.el , false,false,0 );
683         }
684
685         // user defined functions
686     }
687     public class Xcls_Label20 : Object
688     {
689         public Gtk.Label el;
690         private Xcls_RooProjectSettings  _this;
691
692
693             // my vars (def)
694
695         // ctor
696         public Xcls_Label20(Xcls_RooProjectSettings _owner )
697         {
698             _this = _owner;
699             this.el = new Gtk.Label( "Type (eg. MySQL or PostgreSQL)" );
700
701             // my vars (dec)
702
703             // set gobject values
704             this.el.xalign = 0f;
705         }
706
707         // user defined functions
708     }
709
710     public class Xcls_database_DBTYPE : Object
711     {
712         public Gtk.Entry el;
713         private Xcls_RooProjectSettings  _this;
714
715
716             // my vars (def)
717
718         // ctor
719         public Xcls_database_DBTYPE(Xcls_RooProjectSettings _owner )
720         {
721             _this = _owner;
722             _this.database_DBTYPE = this;
723             this.el = new Gtk.Entry();
724
725             // my vars (dec)
726
727             // set gobject values
728
729             //listeners
730             this.el.key_press_event.connect( (ev) => {
731             
732                 if (ev.keyval == Gdk.Key.Tab) {
733                     _this.database_DBNAME.el.grab_focus();
734                     return true;
735                 }
736             
737             
738                 return false;
739             });
740         }
741
742         // user defined functions
743     }
744
745     public class Xcls_Label22 : Object
746     {
747         public Gtk.Label el;
748         private Xcls_RooProjectSettings  _this;
749
750
751             // my vars (def)
752
753         // ctor
754         public Xcls_Label22(Xcls_RooProjectSettings _owner )
755         {
756             _this = _owner;
757             this.el = new Gtk.Label( "Name" );
758
759             // my vars (dec)
760
761             // set gobject values
762             this.el.xalign = 0f;
763         }
764
765         // user defined functions
766     }
767
768     public class Xcls_database_DBNAME : Object
769     {
770         public Gtk.Entry el;
771         private Xcls_RooProjectSettings  _this;
772
773
774             // my vars (def)
775
776         // ctor
777         public Xcls_database_DBNAME(Xcls_RooProjectSettings _owner )
778         {
779             _this = _owner;
780             _this.database_DBNAME = this;
781             this.el = new Gtk.Entry();
782
783             // my vars (dec)
784
785             // set gobject values
786
787             //listeners
788             this.el.key_press_event.connect( (ev) => {
789             
790                 if (ev.keyval == Gdk.Key.Tab) {
791                     _this.database_DBUSERNAME.el.grab_focus();
792                     return true;
793                 }
794             
795             
796                 return false;
797             });
798         }
799
800         // user defined functions
801     }
802
803     public class Xcls_Label24 : Object
804     {
805         public Gtk.Label el;
806         private Xcls_RooProjectSettings  _this;
807
808
809             // my vars (def)
810
811         // ctor
812         public Xcls_Label24(Xcls_RooProjectSettings _owner )
813         {
814             _this = _owner;
815             this.el = new Gtk.Label( "Username" );
816
817             // my vars (dec)
818
819             // set gobject values
820             this.el.xalign = 0f;
821         }
822
823         // user defined functions
824     }
825
826     public class Xcls_database_DBUSERNAME : Object
827     {
828         public Gtk.Entry el;
829         private Xcls_RooProjectSettings  _this;
830
831
832             // my vars (def)
833
834         // ctor
835         public Xcls_database_DBUSERNAME(Xcls_RooProjectSettings _owner )
836         {
837             _this = _owner;
838             _this.database_DBUSERNAME = this;
839             this.el = new Gtk.Entry();
840
841             // my vars (dec)
842
843             // set gobject values
844
845             //listeners
846             this.el.key_press_event.connect( (ev) => {
847             
848                 if (ev.keyval == Gdk.Key.Tab) {
849                     _this.database_DBPASSWORD.el.grab_focus();
850                     return true;
851                 }
852             
853             
854                 return false;
855             });
856         }
857
858         // user defined functions
859     }
860
861     public class Xcls_Label26 : Object
862     {
863         public Gtk.Label el;
864         private Xcls_RooProjectSettings  _this;
865
866
867             // my vars (def)
868
869         // ctor
870         public Xcls_Label26(Xcls_RooProjectSettings _owner )
871         {
872             _this = _owner;
873             this.el = new Gtk.Label( "Password" );
874
875             // my vars (dec)
876
877             // set gobject values
878             this.el.xalign = 0f;
879         }
880
881         // user defined functions
882     }
883
884     public class Xcls_database_DBPASSWORD : Object
885     {
886         public Gtk.Entry el;
887         private Xcls_RooProjectSettings  _this;
888
889
890             // my vars (def)
891
892         // ctor
893         public Xcls_database_DBPASSWORD(Xcls_RooProjectSettings _owner )
894         {
895             _this = _owner;
896             _this.database_DBPASSWORD = this;
897             this.el = new Gtk.Entry();
898
899             // my vars (dec)
900
901             // set gobject values
902         }
903
904         // user defined functions
905     }
906
907     public class Xcls_Button28 : Object
908     {
909         public Gtk.Button el;
910         private Xcls_RooProjectSettings  _this;
911
912
913             // my vars (def)
914
915         // ctor
916         public Xcls_Button28(Xcls_RooProjectSettings _owner )
917         {
918             _this = _owner;
919             this.el = new Gtk.Button();
920
921             // my vars (dec)
922
923             // set gobject values
924             this.el.label = "Check Connection";
925
926             //listeners
927             this.el.clicked.connect( () => {
928             
929             
930               _this.database_ERROR.el.label    = "";
931                 Gda.Connection cnc;
932                 try {
933                     // assumes localhost...
934                      cnc = Gda.Connection.open_from_string (
935                                 _this.database_DBTYPE.el.get_text(),
936                                 "DB_NAME=" + _this.database_DBNAME.el.get_text(), 
937                                 "USERNAME=" + _this.database_DBUSERNAME.el.get_text() + 
938                                 ";PASSWORD=" + _this.database_DBPASSWORD.el.get_text(),
939                                 Gda.ConnectionOptions.NONE
940                         );
941                //} catch (Gda.ConnectionError ce) { 
942                //   _this.database_ERROR.el.label = ce.message;        
943                } catch(Gda.ConnectionError ue) {
944                   _this.database_ERROR.el.label = ue.message;
945                     return;
946                }  catch(Gda.ConfigError ue) {
947                   _this.database_ERROR.el.label = ue.message;
948                     return;
949                }
950               _this.database_ERROR.el.label = "Connection Succeeded";
951                cnc.close();
952             });
953         }
954
955         // user defined functions
956     }
957
958     public class Xcls_database_ERROR : Object
959     {
960         public Gtk.Label el;
961         private Xcls_RooProjectSettings  _this;
962
963
964             // my vars (def)
965
966         // ctor
967         public Xcls_database_ERROR(Xcls_RooProjectSettings _owner )
968         {
969             _this = _owner;
970             _this.database_ERROR = this;
971             this.el = new Gtk.Label( " " );
972
973             // my vars (dec)
974
975             // set gobject values
976             this.el.margin = 3;
977             this.el.xalign = 0f;
978         }
979
980         // user defined functions
981     }
982
983
984
985     public class Xcls_Box30 : Object
986     {
987         public Gtk.Box el;
988         private Xcls_RooProjectSettings  _this;
989
990
991             // my vars (def)
992
993         // ctor
994         public Xcls_Box30(Xcls_RooProjectSettings _owner )
995         {
996             _this = _owner;
997             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
998
999             // my vars (dec)
1000
1001             // set gobject values
1002             this.el.homogeneous = true;
1003             this.el.expand = false;
1004             this.el.vexpand = false;
1005             var child_0 = new Xcls_Button31( _this );
1006             child_0.ref();
1007             this.el.add (  child_0.el  );
1008             var child_1 = new Xcls_Button32( _this );
1009             child_1.ref();
1010             this.el.add (  child_1.el  );
1011         }
1012
1013         // user defined functions
1014     }
1015     public class Xcls_Button31 : Object
1016     {
1017         public Gtk.Button el;
1018         private Xcls_RooProjectSettings  _this;
1019
1020
1021             // my vars (def)
1022
1023         // ctor
1024         public Xcls_Button31(Xcls_RooProjectSettings _owner )
1025         {
1026             _this = _owner;
1027             this.el = new Gtk.Button();
1028
1029             // my vars (dec)
1030
1031             // set gobject values
1032             this.el.label = "Apply";
1033
1034             //listeners
1035             this.el.button_press_event.connect( () => {
1036                 _this.save();
1037                       
1038                 _this.buttonPressed("apply");
1039                     return false;
1040             });
1041         }
1042
1043         // user defined functions
1044     }
1045
1046     public class Xcls_Button32 : Object
1047     {
1048         public Gtk.Button el;
1049         private Xcls_RooProjectSettings  _this;
1050
1051
1052             // my vars (def)
1053
1054         // ctor
1055         public Xcls_Button32(Xcls_RooProjectSettings _owner )
1056         {
1057             _this = _owner;
1058             this.el = new Gtk.Button();
1059
1060             // my vars (dec)
1061
1062             // set gobject values
1063             this.el.label = "Save";
1064
1065             //listeners
1066             this.el.button_press_event.connect( () => {
1067                    _this.save();
1068                       
1069                 _this.buttonPressed("save");
1070                     return false;
1071             });
1072         }
1073
1074         // user defined functions
1075     }
1076
1077
1078
1079 }