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