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