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