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