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