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