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