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