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             
344             
345             
346             });
347         }
348
349         // user defined functions
350     }
351     public class Xcls_ftdbcellrenderer : Object
352     {
353         public Gtk.CellRendererText el;
354         private Xcls_PopoverFileDetails  _this;
355
356
357             // my vars (def)
358
359         // ctor
360         public Xcls_ftdbcellrenderer(Xcls_PopoverFileDetails _owner )
361         {
362             _this = _owner;
363             _this.ftdbcellrenderer = this;
364             this.el = new Gtk.CellRendererText();
365
366             // my vars (dec)
367
368             // set gobject values
369         }
370
371         // user defined functions
372     }
373
374     public class Xcls_ftdbmodel : Object
375     {
376         public Gtk.ListStore el;
377         private Xcls_PopoverFileDetails  _this;
378
379
380             // my vars (def)
381
382         // ctor
383         public Xcls_ftdbmodel(Xcls_PopoverFileDetails _owner )
384         {
385             _this = _owner;
386             _this.ftdbmodel = this;
387             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
388
389             // my vars (dec)
390
391             // set gobject values
392         }
393
394         // user defined functions
395         public void loadData (string cur) {
396             this.el.clear();                                    
397             Gtk.TreeIter iter;
398             var el = this.el;
399             
400            /// el.append(out iter);
401             
402              
403            // el.set_value(iter, 0, "");
404            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
405         
406             el.append(out iter);
407         
408             
409             el.set_value(iter, 0, "bjs");
410             el.set_value(iter, 1, "User Interface File (bjs)");
411             _this.filetype.el.set_active_iter(iter);
412         
413             el.append(out iter);
414             
415             el.set_value(iter, 0, "vala");
416             el.set_value(iter, 1, "Vala");
417                 if (cur == "vala") {
418                     _this.filetype.el.set_active_iter(iter);
419             }
420         
421         
422         
423             el.append(out iter);
424             
425             el.set_value(iter, 0, "js");
426             el.set_value(iter, 1, "Javascript");
427         
428                 if (cur == "js") {
429                     _this.filetype.el.set_active_iter(iter);
430             }
431         
432             el.append(out iter);
433             
434             el.set_value(iter, 0, "css");
435             el.set_value(iter, 1, "CSS");
436         
437                 if (cur == "css") {
438                     _this.filetype.el.set_active_iter(iter);
439             }
440                                              
441         }
442     }
443
444
445     public class Xcls_Label9 : Object
446     {
447         public Gtk.Label el;
448         private Xcls_PopoverFileDetails  _this;
449
450
451             // my vars (def)
452
453         // ctor
454         public Xcls_Label9(Xcls_PopoverFileDetails _owner )
455         {
456             _this = _owner;
457             this.el = new Gtk.Label( "Component Name" );
458
459             // my vars (dec)
460
461             // set gobject values
462             this.el.justify = Gtk.Justification.RIGHT;
463             this.el.xalign = 0.900000f;
464         }
465
466         // user defined functions
467     }
468
469     public class Xcls_name : Object
470     {
471         public Gtk.Entry el;
472         private Xcls_PopoverFileDetails  _this;
473
474
475             // my vars (def)
476
477         // ctor
478         public Xcls_name(Xcls_PopoverFileDetails _owner )
479         {
480             _this = _owner;
481             _this.name = this;
482             this.el = new Gtk.Entry();
483
484             // my vars (dec)
485
486             // set gobject values
487             this.el.visible = true;
488         }
489
490         // user defined functions
491     }
492
493     public class Xcls_Label11 : Object
494     {
495         public Gtk.Label el;
496         private Xcls_PopoverFileDetails  _this;
497
498
499             // my vars (def)
500
501         // ctor
502         public Xcls_Label11(Xcls_PopoverFileDetails _owner )
503         {
504             _this = _owner;
505             this.el = new Gtk.Label( "Title" );
506
507             // my vars (dec)
508
509             // set gobject values
510             this.el.justify = Gtk.Justification.RIGHT;
511             this.el.xalign = 0.900000f;
512             this.el.visible = true;
513         }
514
515         // user defined functions
516     }
517
518     public class Xcls_title : Object
519     {
520         public Gtk.Entry el;
521         private Xcls_PopoverFileDetails  _this;
522
523
524             // my vars (def)
525
526         // ctor
527         public Xcls_title(Xcls_PopoverFileDetails _owner )
528         {
529             _this = _owner;
530             _this.title = this;
531             this.el = new Gtk.Entry();
532
533             // my vars (dec)
534
535             // set gobject values
536             this.el.visible = true;
537         }
538
539         // user defined functions
540     }
541
542     public class Xcls_Label13 : Object
543     {
544         public Gtk.Label el;
545         private Xcls_PopoverFileDetails  _this;
546
547
548             // my vars (def)
549
550         // ctor
551         public Xcls_Label13(Xcls_PopoverFileDetails _owner )
552         {
553             _this = _owner;
554             this.el = new Gtk.Label( "Region" );
555
556             // my vars (dec)
557
558             // set gobject values
559             this.el.justify = Gtk.Justification.RIGHT;
560             this.el.xalign = 0.900000f;
561             this.el.tooltip_text = "center, north, south, east, west";
562             this.el.visible = true;
563         }
564
565         // user defined functions
566     }
567
568     public class Xcls_region : Object
569     {
570         public Gtk.Entry el;
571         private Xcls_PopoverFileDetails  _this;
572
573
574             // my vars (def)
575
576         // ctor
577         public Xcls_region(Xcls_PopoverFileDetails _owner )
578         {
579             _this = _owner;
580             _this.region = this;
581             this.el = new Gtk.Entry();
582
583             // my vars (dec)
584
585             // set gobject values
586             this.el.visible = true;
587         }
588
589         // user defined functions
590     }
591
592     public class Xcls_Label15 : Object
593     {
594         public Gtk.Label el;
595         private Xcls_PopoverFileDetails  _this;
596
597
598             // my vars (def)
599
600         // ctor
601         public Xcls_Label15(Xcls_PopoverFileDetails _owner )
602         {
603             _this = _owner;
604             this.el = new Gtk.Label( "Parent Name" );
605
606             // my vars (dec)
607
608             // set gobject values
609             this.el.justify = Gtk.Justification.RIGHT;
610             this.el.xalign = 0.900000f;
611             this.el.visible = true;
612         }
613
614         // user defined functions
615     }
616
617     public class Xcls_parent : Object
618     {
619         public Gtk.Entry el;
620         private Xcls_PopoverFileDetails  _this;
621
622
623             // my vars (def)
624
625         // ctor
626         public Xcls_parent(Xcls_PopoverFileDetails _owner )
627         {
628             _this = _owner;
629             _this.parent = this;
630             this.el = new Gtk.Entry();
631
632             // my vars (dec)
633
634             // set gobject values
635             this.el.visible = true;
636         }
637
638         // user defined functions
639     }
640
641     public class Xcls_Label17 : Object
642     {
643         public Gtk.Label el;
644         private Xcls_PopoverFileDetails  _this;
645
646
647             // my vars (def)
648
649         // ctor
650         public Xcls_Label17(Xcls_PopoverFileDetails _owner )
651         {
652             _this = _owner;
653             this.el = new Gtk.Label( "Permission Name" );
654
655             // my vars (dec)
656
657             // set gobject values
658             this.el.justify = Gtk.Justification.RIGHT;
659             this.el.xalign = 0.900000f;
660             this.el.visible = true;
661         }
662
663         // user defined functions
664     }
665
666     public class Xcls_permname : Object
667     {
668         public Gtk.Entry el;
669         private Xcls_PopoverFileDetails  _this;
670
671
672             // my vars (def)
673
674         // ctor
675         public Xcls_permname(Xcls_PopoverFileDetails _owner )
676         {
677             _this = _owner;
678             _this.permname = this;
679             this.el = new Gtk.Entry();
680
681             // my vars (dec)
682
683             // set gobject values
684             this.el.visible = true;
685         }
686
687         // user defined functions
688     }
689
690     public class Xcls_Label19 : Object
691     {
692         public Gtk.Label el;
693         private Xcls_PopoverFileDetails  _this;
694
695
696             // my vars (def)
697
698         // ctor
699         public Xcls_Label19(Xcls_PopoverFileDetails _owner )
700         {
701             _this = _owner;
702             this.el = new Gtk.Label( "Order (for tabs)" );
703
704             // my vars (dec)
705
706             // set gobject values
707             this.el.justify = Gtk.Justification.RIGHT;
708             this.el.xalign = 0.900000f;
709             this.el.visible = true;
710         }
711
712         // user defined functions
713     }
714
715     public class Xcls_modOrder : Object
716     {
717         public Gtk.Entry el;
718         private Xcls_PopoverFileDetails  _this;
719
720
721             // my vars (def)
722
723         // ctor
724         public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
725         {
726             _this = _owner;
727             _this.modOrder = this;
728             this.el = new Gtk.Entry();
729
730             // my vars (dec)
731
732             // set gobject values
733             this.el.visible = true;
734         }
735
736         // user defined functions
737     }
738
739     public class Xcls_Label21 : Object
740     {
741         public Gtk.Label el;
742         private Xcls_PopoverFileDetails  _this;
743
744
745             // my vars (def)
746
747         // ctor
748         public Xcls_Label21(Xcls_PopoverFileDetails _owner )
749         {
750             _this = _owner;
751             this.el = new Gtk.Label( "Module to build (Vala only)" );
752
753             // my vars (dec)
754
755             // set gobject values
756             this.el.justify = Gtk.Justification.RIGHT;
757             this.el.xalign = 0.900000f;
758             this.el.visible = true;
759         }
760
761         // user defined functions
762     }
763
764     public class Xcls_build_module : Object
765     {
766         public Gtk.ComboBox el;
767         private Xcls_PopoverFileDetails  _this;
768
769
770             // my vars (def)
771
772         // ctor
773         public Xcls_build_module(Xcls_PopoverFileDetails _owner )
774         {
775             _this = _owner;
776             _this.build_module = this;
777             this.el = new Gtk.ComboBox();
778
779             // my vars (dec)
780
781             // set gobject values
782             var child_0 = new Xcls_dbcellrenderer( _this );
783             child_0.ref();
784             this.el.pack_start (  child_0.el , true );
785             var child_1 = new Xcls_dbmodel( _this );
786             child_1.ref();
787             this.el.set_model (  child_1.el  );
788
789             // init method
790
791             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
792         }
793
794         // user defined functions
795     }
796     public class Xcls_dbcellrenderer : Object
797     {
798         public Gtk.CellRendererText el;
799         private Xcls_PopoverFileDetails  _this;
800
801
802             // my vars (def)
803
804         // ctor
805         public Xcls_dbcellrenderer(Xcls_PopoverFileDetails _owner )
806         {
807             _this = _owner;
808             _this.dbcellrenderer = this;
809             this.el = new Gtk.CellRendererText();
810
811             // my vars (dec)
812
813             // set gobject values
814         }
815
816         // user defined functions
817     }
818
819     public class Xcls_dbmodel : Object
820     {
821         public Gtk.ListStore el;
822         private Xcls_PopoverFileDetails  _this;
823
824
825             // my vars (def)
826
827         // ctor
828         public Xcls_dbmodel(Xcls_PopoverFileDetails _owner )
829         {
830             _this = _owner;
831             _this.dbmodel = this;
832             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
833
834             // my vars (dec)
835
836             // set gobject values
837         }
838
839         // user defined functions
840         public void loadData (Gee.ArrayList<string> data, string cur) {
841             this.el.clear();                                    
842             Gtk.TreeIter iter;
843             var el = this.el;
844             
845            /// el.append(out iter);
846             
847              
848            // el.set_value(iter, 0, "");
849            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
850         
851             el.append(out iter);
852         
853             
854             el.set_value(iter, 0, "");
855             el.set_value(iter, 1, "-- select a module --");
856             _this.build_module.el.set_active_iter(iter);
857             
858             for (var i = 0; i < data.size;i++) {
859             
860         
861                 el.append(out iter);
862                 
863                 el.set_value(iter, 0, data.get(i));
864                 el.set_value(iter, 1, data.get(i));
865                 
866                 if (data.get(i) == cur) {
867                     _this.build_module.el.set_active_iter(iter);
868                 }
869                 
870             }
871              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
872                                              
873         }
874     }
875
876
877
878     public class Xcls_HButtonBox25 : Object
879     {
880         public Gtk.HButtonBox el;
881         private Xcls_PopoverFileDetails  _this;
882
883
884             // my vars (def)
885
886         // ctor
887         public Xcls_HButtonBox25(Xcls_PopoverFileDetails _owner )
888         {
889             _this = _owner;
890             this.el = new Gtk.HButtonBox();
891
892             // my vars (dec)
893
894             // set gobject values
895             this.el.margin_right = 4;
896             this.el.margin_left = 4;
897             this.el.margin_bottom = 4;
898             var child_0 = new Xcls_Button26( _this );
899             child_0.ref();
900             this.el.add (  child_0.el  );
901             var child_1 = new Xcls_save_btn( _this );
902             child_1.ref();
903             this.el.add (  child_1.el  );
904         }
905
906         // user defined functions
907     }
908     public class Xcls_Button26 : Object
909     {
910         public Gtk.Button el;
911         private Xcls_PopoverFileDetails  _this;
912
913
914             // my vars (def)
915
916         // ctor
917         public Xcls_Button26(Xcls_PopoverFileDetails _owner )
918         {
919             _this = _owner;
920             this.el = new Gtk.Button();
921
922             // my vars (dec)
923
924             // set gobject values
925             this.el.label = "Cancel";
926
927             //listeners
928             this.el.clicked.connect( () => { 
929             
930               _this.done = true;
931                 _this.el.hide(); 
932             });
933         }
934
935         // user defined functions
936     }
937
938     public class Xcls_save_btn : Object
939     {
940         public Gtk.Button el;
941         private Xcls_PopoverFileDetails  _this;
942
943
944             // my vars (def)
945
946         // ctor
947         public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
948         {
949             _this = _owner;
950             _this.save_btn = this;
951             this.el = new Gtk.Button();
952
953             // my vars (dec)
954
955             // set gobject values
956             this.el.label = "Save";
957
958             //listeners
959             this.el.clicked.connect( ( ) =>  { 
960             
961              
962             
963             
964                 if (_this.name.el.get_text().length  < 1) {
965                     StandardErrorDialog.show(
966                         _this.mainwindow.el,
967                         "You have to set Component name "
968                     );
969                      
970                     return;
971                 }
972                 // what does this do?
973                 
974                 var isNew = _this.file.name.length  > 0 ? false : true;
975                 /*
976                 if (!isNew && this.file.name != _this.name.el.get_text()) {
977                     Xcls_StandardErrorDialog.singleton().show(
978                         this.el,
979                         "Sorry changing names does not work yet. "
980                     );
981                      
982                     return;
983                 }
984                 */
985                  
986                 
987               
988                 // FIXME - this may be more complicated...
989                 //for (var i in this.def) {
990                 //    this.file[i] =  this.get(i).el.get_text();
991                 //}
992             
993                 if (!isNew) {
994                     try {
995                          _this.updateFileFromEntry();
996                      } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
997                           Xcls_StandardErrorDialog.singleton().show(
998                             _this.mainwindow.el,
999                             "The name you used already exists "
1000                         );
1001                         return;
1002                          
1003                      }
1004             
1005                       _this.done = true;
1006                     _this.file.save();
1007                     _this.el.hide();
1008                     return;
1009                 }
1010                 var fn = _this.name.el.get_text();
1011                 var dir = _this.project.firstPath();
1012                
1013                 if (GLib.FileUtils.test(dir + "/" + fn + ".bjs", GLib.FileTest.EXISTS)) {
1014                     Xcls_StandardErrorDialog.singleton().show(
1015                         _this.mainwindow.el,
1016                         "That file already exists"
1017                     ); 
1018                     return;
1019                 }
1020                
1021                var f =  JsRender.JsRender.factory(
1022                         _this.file.project.xtype,  
1023                         _this.file.project, 
1024                         dir + "/" + fn + ".bjs");
1025             
1026                 _this.file = f;
1027                 
1028             
1029                 
1030                 _this.updateFileFromEntry();
1031                 _this.file.loaded = true;
1032                 _this.file.save();
1033                 _this.file.project.addFile(_this.file);
1034                 
1035              
1036                 // what about .js ?
1037                _this.done = true;
1038                 _this.el.hide();
1039             
1040                 
1041                 
1042                 _this.success(_this.project, _this.file);
1043                
1044             });
1045         }
1046
1047         // user defined functions
1048     }
1049
1050
1051
1052 }