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