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