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