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