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