src/Builder4/PopoverFileDetails.bjs
[app.Builder.js] / src / Builder4 / PopoverFileDetails.vala
1 static Xcls_PopoverFileDetails  _PopoverFileDetails;
2
3 public class Xcls_PopoverFileDetails : Object
4 {
5     public Gtk.Popover el;
6     private Xcls_PopoverFileDetails  _this;
7
8     public static Xcls_PopoverFileDetails singleton()
9     {
10         if (_PopoverFileDetails == null) {
11             _PopoverFileDetails= new Xcls_PopoverFileDetails();
12         }
13         return _PopoverFileDetails;
14     }
15     public Xcls_filetypelbl filetypelbl;
16     public Xcls_filetype filetype;
17     public Xcls_ftdbcellrenderer ftdbcellrenderer;
18     public Xcls_ftdbmodel ftdbmodel;
19     public Xcls_name name;
20     public Xcls_title title;
21     public Xcls_region region;
22     public Xcls_parent parent;
23     public Xcls_permname permname;
24     public Xcls_modOrder modOrder;
25     public Xcls_build_module build_module;
26     public Xcls_dbcellrenderer dbcellrenderer;
27     public Xcls_dbmodel dbmodel;
28     public Xcls_save_btn save_btn;
29
30         // my vars (def)
31     public signal void success (Project.Project pr, JsRender.JsRender file);
32     public bool done;
33     public Project.Project project;
34     public JsRender.JsRender file;
35     public Xcls_MainWindow mainwindow;
36
37     // ctor
38     public Xcls_PopoverFileDetails()
39     {
40         _this = this;
41         this.el = new Gtk.Popover( null );
42
43         // my vars (dec)
44         this.done = false;
45         this.file = null;
46         this.mainwindow = null;
47
48         // set gobject values
49         this.el.border_width = 0;
50         this.el.modal = true;
51         this.el.position = Gtk.PositionType.RIGHT;
52         var child_0 = new Xcls_Box2( _this );
53         child_0.ref();
54         this.el.add (  child_0.el  );
55
56         //listeners
57         this.el.closed.connect( () => {
58           if (!this.done) {
59             _this.el.show();
60           
61           }
62         });
63     }
64
65     // user defined functions
66     public   void updateFileFromEntry () {
67     
68             _this.file.title = _this.title.el.get_text();
69             _this.file.region = _this.region.el.get_text();            
70             _this.file.parent = _this.parent.el.get_text();                        
71             _this.file.permname = _this.permname.el.get_text();                                    
72             _this.file.modOrder = _this.modOrder.el.get_text();
73             
74             if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {
75                 _this.file.renameTo(_this.name.el.get_text());
76             }
77             // store the module...
78             _this.file.build_module = "";        
79              Gtk.TreeIter iter; 
80             if (_this.build_module.el.get_active_iter (out iter)) {
81                  Value vfname;
82                  this.dbmodel.el.get_value (iter, 0, out vfname);
83                  if (((string)vfname).length > 0) {
84                      _this.file.build_module = (string)vfname;
85                  }
86         
87             }
88             
89             
90     
91                                                         
92     }
93     public void show (JsRender.JsRender c, Gtk.Widget btn) 
94     {
95         this.project = c.project;
96         this.done = false;
97         
98         
99         //if (!this.el) {
100             //this.init();
101          //}
102         
103         _this.name.el.set_text(c.name);
104         _this.title.el.set_text(c.title);
105         _this.parent.el.set_text(c.parent);    
106         _this.region.el.set_text(c.region);
107         _this.modOrder.el.set_text(c.modOrder);
108          _this.permname.el.set_text(c.permname);
109         
110         
111         
112         _this.ftdbmodel.loadData("bjs"); // fixme - need to determine type..
113         _this.filetype.el.hide();
114         _this.filetypelbl.el.hide();
115         
116         
117         if (c.path.length > 0) {
118             this.save_btn.el.set_label("Save");
119         } else {
120             this.save_btn.el.set_label("Create");
121             _this.filetype.el.show();
122             _this.filetypelbl.el.show();
123         }
124         
125          var ar = new Gee.ArrayList<string>();
126          _this.dbmodel.loadData(ar,"");
127         // load the modules... if relivant..
128         if (this.project.xtype == "Gtk") {
129             var p = (Project.Gtk)c.project;
130               var cg = p.compilegroups;
131     
132             var iter = cg.map_iterator();
133            while(iter.next()) {
134                 var key = iter.get_key();
135                 if (key == "_default_") {
136                     continue;
137                 }
138                 ar.add(key);
139             };
140             _this.dbmodel.loadData(ar, c.build_module);
141     
142         }
143         
144          
145         _this.file = c;
146         //console.log('show all');
147        this.el.set_modal(true);
148         this.el.set_relative_to(btn);
149     
150         this.el.set_position(Gtk.PositionType.RIGHT);
151         
152         // window + header?
153          print("SHOWALL - POPIP\n");
154         this.el.show_all();
155         this.name.el.grab_focus();
156         
157         //this.success = c.success;
158         
159         
160     }
161     public class Xcls_Box2 : Object
162     {
163         public Gtk.Box el;
164         private Xcls_PopoverFileDetails  _this;
165
166
167             // my vars (def)
168
169         // ctor
170         public Xcls_Box2(Xcls_PopoverFileDetails _owner )
171         {
172             _this = _owner;
173             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
174
175             // my vars (dec)
176
177             // set gobject values
178             this.el.homogeneous = false;
179             var child_0 = new Xcls_HeaderBar3( _this );
180             child_0.ref();
181             this.el.pack_start (  child_0.el , false,true,0 );
182             var child_1 = new Xcls_Grid4( _this );
183             child_1.ref();
184             this.el.pack_start (  child_1.el , false,false,4 );
185             var child_2 = new Xcls_HButtonBox25( _this );
186             child_2.ref();
187             this.el.pack_end (  child_2.el , false,true,0 );
188         }
189
190         // user defined functions
191     }
192     public class Xcls_HeaderBar3 : Object
193     {
194         public Gtk.HeaderBar el;
195         private Xcls_PopoverFileDetails  _this;
196
197
198             // my vars (def)
199
200         // ctor
201         public Xcls_HeaderBar3(Xcls_PopoverFileDetails _owner )
202         {
203             _this = _owner;
204             this.el = new Gtk.HeaderBar();
205
206             // my vars (dec)
207
208             // set gobject values
209             this.el.title = "Add / Edit File";
210         }
211
212         // user defined functions
213     }
214
215     public class Xcls_Grid4 : Object
216     {
217         public Gtk.Grid el;
218         private Xcls_PopoverFileDetails  _this;
219
220
221             // my vars (def)
222
223         // ctor
224         public Xcls_Grid4(Xcls_PopoverFileDetails _owner )
225         {
226             _this = _owner;
227             this.el = new Gtk.Grid();
228
229             // my vars (dec)
230
231             // set gobject values
232             this.el.margin_right = 4;
233             this.el.margin_left = 4;
234             this.el.row_spacing = 2;
235             var child_0 = new Xcls_filetypelbl( _this );
236             child_0.ref();
237             this.el.attach (  child_0.el , 0,0,1,1 );
238             var child_1 = new Xcls_filetype( _this );
239             child_1.ref();
240             this.el.attach (  child_1.el , 1,0,1,1 );
241             var child_2 = new Xcls_Label9( _this );
242             child_2.ref();
243             this.el.attach (  child_2.el , 0,1,1,1 );
244             var child_3 = new Xcls_name( _this );
245             child_3.ref();
246             this.el.attach (  child_3.el , 1,1,1,1 );
247             var child_4 = new Xcls_Label11( _this );
248             child_4.ref();
249             this.el.attach (  child_4.el , 0,2,1,1 );
250             var child_5 = new Xcls_title( _this );
251             child_5.ref();
252             this.el.attach (  child_5.el , 1,2,1,1 );
253             var child_6 = new Xcls_Label13( _this );
254             child_6.ref();
255             this.el.attach (  child_6.el , 0,3,1,1 );
256             var child_7 = new Xcls_region( _this );
257             child_7.ref();
258             this.el.attach (  child_7.el , 1,3,1,1 );
259             var child_8 = new Xcls_Label15( _this );
260             child_8.ref();
261             this.el.attach (  child_8.el , 0,4,1,1 );
262             var child_9 = new Xcls_parent( _this );
263             child_9.ref();
264             this.el.attach (  child_9.el , 1,4,1,1 );
265             var child_10 = new Xcls_Label17( _this );
266             child_10.ref();
267             this.el.attach (  child_10.el , 0,5,1,1 );
268             var child_11 = new Xcls_permname( _this );
269             child_11.ref();
270             this.el.attach (  child_11.el , 1,5,1,1 );
271             var child_12 = new Xcls_Label19( _this );
272             child_12.ref();
273             this.el.attach (  child_12.el , 0,6,1,1 );
274             var child_13 = new Xcls_modOrder( _this );
275             child_13.ref();
276             this.el.attach (  child_13.el , 1,6,1,1 );
277             var child_14 = new Xcls_Label21( _this );
278             child_14.ref();
279             this.el.attach (  child_14.el , 0,7,1,1 );
280             var child_15 = new Xcls_build_module( _this );
281             child_15.ref();
282             this.el.attach (  child_15.el , 1,7,1,1 );
283         }
284
285         // user defined functions
286     }
287     public class Xcls_filetypelbl : Object
288     {
289         public Gtk.Label el;
290         private Xcls_PopoverFileDetails  _this;
291
292
293             // my vars (def)
294
295         // ctor
296         public Xcls_filetypelbl(Xcls_PopoverFileDetails _owner )
297         {
298             _this = _owner;
299             _this.filetypelbl = this;
300             this.el = new Gtk.Label( "File type" );
301
302             // my vars (dec)
303
304             // set gobject values
305             this.el.justify = Gtk.Justification.RIGHT;
306             this.el.xalign = 0.900000f;
307         }
308
309         // user defined functions
310     }
311
312     public class Xcls_filetype : Object
313     {
314         public Gtk.ComboBox el;
315         private Xcls_PopoverFileDetails  _this;
316
317
318             // my vars (def)
319
320         // ctor
321         public Xcls_filetype(Xcls_PopoverFileDetails _owner )
322         {
323             _this = _owner;
324             _this.filetype = this;
325             this.el = new Gtk.ComboBox();
326
327             // my vars (dec)
328
329             // set gobject values
330             var child_0 = new Xcls_ftdbcellrenderer( _this );
331             child_0.ref();
332             this.el.pack_start (  child_0.el , true );
333             var child_1 = new Xcls_ftdbmodel( _this );
334             child_1.ref();
335             this.el.set_model (  child_1.el  );
336
337             // init method
338
339             this.el.add_attribute(_this.ftdbcellrenderer.el , "markup", 1 );
340
341             //listeners
342             this.el.changed.connect( () => {
343                 Gtk.TreeIter iter;
344                 bool is_bjs = true;
345                 if (this.el.get_active_iter(out iter)) {
346                         Value vfname;
347                         _this.ftdbmodel.el.get_value (iter, 0, out vfname);
348                          is_bjs = ((string)vfname) == "BJS";
349                 }
350                 
351                for (var i = 2; i < 8;i++) {
352                         var el = _this.grid.el.get_child_at(0,i);
353                         if (is_bjs) {
354                            el.show();
355                         } else {
356                                 el.hide();
357                         }
358                         var el = _this.grid..el.get_child_at(1,i);
359                         if (is_bjs) {
360                            el.show();
361                         } else {
362                                 el.hide();
363                         }     
364                 }
365                  
366                  
367             
368             
369             });
370         }
371
372         // user defined functions
373     }
374     public class Xcls_ftdbcellrenderer : Object
375     {
376         public Gtk.CellRendererText el;
377         private Xcls_PopoverFileDetails  _this;
378
379
380             // my vars (def)
381
382         // ctor
383         public Xcls_ftdbcellrenderer(Xcls_PopoverFileDetails _owner )
384         {
385             _this = _owner;
386             _this.ftdbcellrenderer = this;
387             this.el = new Gtk.CellRendererText();
388
389             // my vars (dec)
390
391             // set gobject values
392         }
393
394         // user defined functions
395     }
396
397     public class Xcls_ftdbmodel : Object
398     {
399         public Gtk.ListStore el;
400         private Xcls_PopoverFileDetails  _this;
401
402
403             // my vars (def)
404
405         // ctor
406         public Xcls_ftdbmodel(Xcls_PopoverFileDetails _owner )
407         {
408             _this = _owner;
409             _this.ftdbmodel = this;
410             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
411
412             // my vars (dec)
413
414             // set gobject values
415         }
416
417         // user defined functions
418         public void loadData (string cur) {
419             this.el.clear();                                    
420             Gtk.TreeIter iter;
421             var el = this.el;
422             
423            /// el.append(out iter);
424             
425              
426            // el.set_value(iter, 0, "");
427            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
428         
429             el.append(out iter);
430         
431             
432             el.set_value(iter, 0, "bjs");
433             el.set_value(iter, 1, "User Interface File (bjs)");
434             _this.filetype.el.set_active_iter(iter);
435         
436             el.append(out iter);
437             
438             el.set_value(iter, 0, "vala");
439             el.set_value(iter, 1, "Vala");
440                 if (cur == "vala") {
441                     _this.filetype.el.set_active_iter(iter);
442             }
443         
444         
445         
446             el.append(out iter);
447             
448             el.set_value(iter, 0, "js");
449             el.set_value(iter, 1, "Javascript");
450         
451                 if (cur == "js") {
452                     _this.filetype.el.set_active_iter(iter);
453             }
454         
455             el.append(out iter);
456             
457             el.set_value(iter, 0, "css");
458             el.set_value(iter, 1, "CSS");
459         
460                 if (cur == "css") {
461                     _this.filetype.el.set_active_iter(iter);
462             }
463                                              
464         }
465     }
466
467
468     public class Xcls_Label9 : Object
469     {
470         public Gtk.Label el;
471         private Xcls_PopoverFileDetails  _this;
472
473
474             // my vars (def)
475
476         // ctor
477         public Xcls_Label9(Xcls_PopoverFileDetails _owner )
478         {
479             _this = _owner;
480             this.el = new Gtk.Label( "Component Name" );
481
482             // my vars (dec)
483
484             // set gobject values
485             this.el.justify = Gtk.Justification.RIGHT;
486             this.el.xalign = 0.900000f;
487         }
488
489         // user defined functions
490     }
491
492     public class Xcls_name : Object
493     {
494         public Gtk.Entry el;
495         private Xcls_PopoverFileDetails  _this;
496
497
498             // my vars (def)
499
500         // ctor
501         public Xcls_name(Xcls_PopoverFileDetails _owner )
502         {
503             _this = _owner;
504             _this.name = this;
505             this.el = new Gtk.Entry();
506
507             // my vars (dec)
508
509             // set gobject values
510             this.el.visible = true;
511         }
512
513         // user defined functions
514     }
515
516     public class Xcls_Label11 : Object
517     {
518         public Gtk.Label el;
519         private Xcls_PopoverFileDetails  _this;
520
521
522             // my vars (def)
523
524         // ctor
525         public Xcls_Label11(Xcls_PopoverFileDetails _owner )
526         {
527             _this = _owner;
528             this.el = new Gtk.Label( "Title" );
529
530             // my vars (dec)
531
532             // set gobject values
533             this.el.justify = Gtk.Justification.RIGHT;
534             this.el.xalign = 0.900000f;
535             this.el.visible = true;
536         }
537
538         // user defined functions
539     }
540
541     public class Xcls_title : Object
542     {
543         public Gtk.Entry el;
544         private Xcls_PopoverFileDetails  _this;
545
546
547             // my vars (def)
548
549         // ctor
550         public Xcls_title(Xcls_PopoverFileDetails _owner )
551         {
552             _this = _owner;
553             _this.title = this;
554             this.el = new Gtk.Entry();
555
556             // my vars (dec)
557
558             // set gobject values
559             this.el.visible = true;
560         }
561
562         // user defined functions
563     }
564
565     public class Xcls_Label13 : Object
566     {
567         public Gtk.Label el;
568         private Xcls_PopoverFileDetails  _this;
569
570
571             // my vars (def)
572
573         // ctor
574         public Xcls_Label13(Xcls_PopoverFileDetails _owner )
575         {
576             _this = _owner;
577             this.el = new Gtk.Label( "Region" );
578
579             // my vars (dec)
580
581             // set gobject values
582             this.el.justify = Gtk.Justification.RIGHT;
583             this.el.xalign = 0.900000f;
584             this.el.tooltip_text = "center, north, south, east, west";
585             this.el.visible = true;
586         }
587
588         // user defined functions
589     }
590
591     public class Xcls_region : Object
592     {
593         public Gtk.Entry el;
594         private Xcls_PopoverFileDetails  _this;
595
596
597             // my vars (def)
598
599         // ctor
600         public Xcls_region(Xcls_PopoverFileDetails _owner )
601         {
602             _this = _owner;
603             _this.region = this;
604             this.el = new Gtk.Entry();
605
606             // my vars (dec)
607
608             // set gobject values
609             this.el.visible = true;
610         }
611
612         // user defined functions
613     }
614
615     public class Xcls_Label15 : Object
616     {
617         public Gtk.Label el;
618         private Xcls_PopoverFileDetails  _this;
619
620
621             // my vars (def)
622
623         // ctor
624         public Xcls_Label15(Xcls_PopoverFileDetails _owner )
625         {
626             _this = _owner;
627             this.el = new Gtk.Label( "Parent Name" );
628
629             // my vars (dec)
630
631             // set gobject values
632             this.el.justify = Gtk.Justification.RIGHT;
633             this.el.xalign = 0.900000f;
634             this.el.visible = true;
635         }
636
637         // user defined functions
638     }
639
640     public class Xcls_parent : Object
641     {
642         public Gtk.Entry el;
643         private Xcls_PopoverFileDetails  _this;
644
645
646             // my vars (def)
647
648         // ctor
649         public Xcls_parent(Xcls_PopoverFileDetails _owner )
650         {
651             _this = _owner;
652             _this.parent = this;
653             this.el = new Gtk.Entry();
654
655             // my vars (dec)
656
657             // set gobject values
658             this.el.visible = true;
659         }
660
661         // user defined functions
662     }
663
664     public class Xcls_Label17 : Object
665     {
666         public Gtk.Label el;
667         private Xcls_PopoverFileDetails  _this;
668
669
670             // my vars (def)
671
672         // ctor
673         public Xcls_Label17(Xcls_PopoverFileDetails _owner )
674         {
675             _this = _owner;
676             this.el = new Gtk.Label( "Permission Name" );
677
678             // my vars (dec)
679
680             // set gobject values
681             this.el.justify = Gtk.Justification.RIGHT;
682             this.el.xalign = 0.900000f;
683             this.el.visible = true;
684         }
685
686         // user defined functions
687     }
688
689     public class Xcls_permname : Object
690     {
691         public Gtk.Entry el;
692         private Xcls_PopoverFileDetails  _this;
693
694
695             // my vars (def)
696
697         // ctor
698         public Xcls_permname(Xcls_PopoverFileDetails _owner )
699         {
700             _this = _owner;
701             _this.permname = this;
702             this.el = new Gtk.Entry();
703
704             // my vars (dec)
705
706             // set gobject values
707             this.el.visible = true;
708         }
709
710         // user defined functions
711     }
712
713     public class Xcls_Label19 : Object
714     {
715         public Gtk.Label el;
716         private Xcls_PopoverFileDetails  _this;
717
718
719             // my vars (def)
720
721         // ctor
722         public Xcls_Label19(Xcls_PopoverFileDetails _owner )
723         {
724             _this = _owner;
725             this.el = new Gtk.Label( "Order (for tabs)" );
726
727             // my vars (dec)
728
729             // set gobject values
730             this.el.justify = Gtk.Justification.RIGHT;
731             this.el.xalign = 0.900000f;
732             this.el.visible = true;
733         }
734
735         // user defined functions
736     }
737
738     public class Xcls_modOrder : Object
739     {
740         public Gtk.Entry el;
741         private Xcls_PopoverFileDetails  _this;
742
743
744             // my vars (def)
745
746         // ctor
747         public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
748         {
749             _this = _owner;
750             _this.modOrder = this;
751             this.el = new Gtk.Entry();
752
753             // my vars (dec)
754
755             // set gobject values
756             this.el.visible = true;
757         }
758
759         // user defined functions
760     }
761
762     public class Xcls_Label21 : Object
763     {
764         public Gtk.Label el;
765         private Xcls_PopoverFileDetails  _this;
766
767
768             // my vars (def)
769
770         // ctor
771         public Xcls_Label21(Xcls_PopoverFileDetails _owner )
772         {
773             _this = _owner;
774             this.el = new Gtk.Label( "Module to build (Vala only)" );
775
776             // my vars (dec)
777
778             // set gobject values
779             this.el.justify = Gtk.Justification.RIGHT;
780             this.el.xalign = 0.900000f;
781             this.el.visible = true;
782         }
783
784         // user defined functions
785     }
786
787     public class Xcls_build_module : Object
788     {
789         public Gtk.ComboBox el;
790         private Xcls_PopoverFileDetails  _this;
791
792
793             // my vars (def)
794
795         // ctor
796         public Xcls_build_module(Xcls_PopoverFileDetails _owner )
797         {
798             _this = _owner;
799             _this.build_module = this;
800             this.el = new Gtk.ComboBox();
801
802             // my vars (dec)
803
804             // set gobject values
805             var child_0 = new Xcls_dbcellrenderer( _this );
806             child_0.ref();
807             this.el.pack_start (  child_0.el , true );
808             var child_1 = new Xcls_dbmodel( _this );
809             child_1.ref();
810             this.el.set_model (  child_1.el  );
811
812             // init method
813
814             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
815         }
816
817         // user defined functions
818     }
819     public class Xcls_dbcellrenderer : Object
820     {
821         public Gtk.CellRendererText el;
822         private Xcls_PopoverFileDetails  _this;
823
824
825             // my vars (def)
826
827         // ctor
828         public Xcls_dbcellrenderer(Xcls_PopoverFileDetails _owner )
829         {
830             _this = _owner;
831             _this.dbcellrenderer = this;
832             this.el = new Gtk.CellRendererText();
833
834             // my vars (dec)
835
836             // set gobject values
837         }
838
839         // user defined functions
840     }
841
842     public class Xcls_dbmodel : Object
843     {
844         public Gtk.ListStore el;
845         private Xcls_PopoverFileDetails  _this;
846
847
848             // my vars (def)
849
850         // ctor
851         public Xcls_dbmodel(Xcls_PopoverFileDetails _owner )
852         {
853             _this = _owner;
854             _this.dbmodel = this;
855             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
856
857             // my vars (dec)
858
859             // set gobject values
860         }
861
862         // user defined functions
863         public void loadData (Gee.ArrayList<string> data, string cur) {
864             this.el.clear();                                    
865             Gtk.TreeIter iter;
866             var el = this.el;
867             
868            /// el.append(out iter);
869             
870              
871            // el.set_value(iter, 0, "");
872            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
873         
874             el.append(out iter);
875         
876             
877             el.set_value(iter, 0, "");
878             el.set_value(iter, 1, "-- select a module --");
879             _this.build_module.el.set_active_iter(iter);
880             
881             for (var i = 0; i < data.size;i++) {
882             
883         
884                 el.append(out iter);
885                 
886                 el.set_value(iter, 0, data.get(i));
887                 el.set_value(iter, 1, data.get(i));
888                 
889                 if (data.get(i) == cur) {
890                     _this.build_module.el.set_active_iter(iter);
891                 }
892                 
893             }
894              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
895                                              
896         }
897     }
898
899
900
901     public class Xcls_HButtonBox25 : Object
902     {
903         public Gtk.HButtonBox el;
904         private Xcls_PopoverFileDetails  _this;
905
906
907             // my vars (def)
908
909         // ctor
910         public Xcls_HButtonBox25(Xcls_PopoverFileDetails _owner )
911         {
912             _this = _owner;
913             this.el = new Gtk.HButtonBox();
914
915             // my vars (dec)
916
917             // set gobject values
918             this.el.margin_right = 4;
919             this.el.margin_left = 4;
920             this.el.margin_bottom = 4;
921             var child_0 = new Xcls_Button26( _this );
922             child_0.ref();
923             this.el.add (  child_0.el  );
924             var child_1 = new Xcls_save_btn( _this );
925             child_1.ref();
926             this.el.add (  child_1.el  );
927         }
928
929         // user defined functions
930     }
931     public class Xcls_Button26 : Object
932     {
933         public Gtk.Button el;
934         private Xcls_PopoverFileDetails  _this;
935
936
937             // my vars (def)
938
939         // ctor
940         public Xcls_Button26(Xcls_PopoverFileDetails _owner )
941         {
942             _this = _owner;
943             this.el = new Gtk.Button();
944
945             // my vars (dec)
946
947             // set gobject values
948             this.el.label = "Cancel";
949
950             //listeners
951             this.el.clicked.connect( () => { 
952             
953               _this.done = true;
954                 _this.el.hide(); 
955             });
956         }
957
958         // user defined functions
959     }
960
961     public class Xcls_save_btn : Object
962     {
963         public Gtk.Button el;
964         private Xcls_PopoverFileDetails  _this;
965
966
967             // my vars (def)
968
969         // ctor
970         public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
971         {
972             _this = _owner;
973             _this.save_btn = this;
974             this.el = new Gtk.Button();
975
976             // my vars (dec)
977
978             // set gobject values
979             this.el.label = "Save";
980
981             //listeners
982             this.el.clicked.connect( ( ) =>  { 
983             
984              
985             
986             
987                 if (_this.name.el.get_text().length  < 1) {
988                     StandardErrorDialog.show(
989                         _this.mainwindow.el,
990                         "You have to set Component name "
991                     );
992                      
993                     return;
994                 }
995                 // what does this do?
996                 
997                 var isNew = _this.file.name.length  > 0 ? false : true;
998                 /*
999                 if (!isNew && this.file.name != _this.name.el.get_text()) {
1000                     Xcls_StandardErrorDialog.singleton().show(
1001                         this.el,
1002                         "Sorry changing names does not work yet. "
1003                     );
1004                      
1005                     return;
1006                 }
1007                 */
1008                  
1009                 
1010               
1011                 // FIXME - this may be more complicated...
1012                 //for (var i in this.def) {
1013                 //    this.file[i] =  this.get(i).el.get_text();
1014                 //}
1015             
1016                 if (!isNew) {
1017                     try {
1018                          _this.updateFileFromEntry();
1019                      } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
1020                           Xcls_StandardErrorDialog.singleton().show(
1021                             _this.mainwindow.el,
1022                             "The name you used already exists "
1023                         );
1024                         return;
1025                          
1026                      }
1027             
1028                       _this.done = true;
1029                     _this.file.save();
1030                     _this.el.hide();
1031                     return;
1032                 }
1033                 var fn = _this.name.el.get_text();
1034                 var dir = _this.project.firstPath();
1035                
1036                 if (GLib.FileUtils.test(dir + "/" + fn + ".bjs", GLib.FileTest.EXISTS)) {
1037                     Xcls_StandardErrorDialog.singleton().show(
1038                         _this.mainwindow.el,
1039                         "That file already exists"
1040                     ); 
1041                     return;
1042                 }
1043                
1044                var f =  JsRender.JsRender.factory(
1045                         _this.file.project.xtype,  
1046                         _this.file.project, 
1047                         dir + "/" + fn + ".bjs");
1048             
1049                 _this.file = f;
1050                 
1051             
1052                 
1053                 _this.updateFileFromEntry();
1054                 _this.file.loaded = true;
1055                 _this.file.save();
1056                 _this.file.project.addFile(_this.file);
1057                 
1058              
1059                 // what about .js ?
1060                _this.done = true;
1061                 _this.el.hide();
1062             
1063                 
1064                 
1065                 _this.success(_this.project, _this.file);
1066                
1067             });
1068         }
1069
1070         // user defined functions
1071     }
1072
1073
1074
1075 }