resources/RooUsage.txt
[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         
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 );
298             var child_17 = new Xcls_dir( _this );
299             child_17.ref();
300             this.el.attach (  child_17.el , 1,8 );
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                 for (var i = 2; i < 9;i++) {
380                         var el = _this.grid.el.get_child_at(0,i);
381                         
382                         var showhide= is_bjs;
383                         if (i> 7) {
384                                 showhide = !showhide;
385                         }
386                         
387                         if (showhide) {
388                            el.show();
389                         } else {
390                                 el.hide();
391                         }
392                          el = _this.grid.el.get_child_at(1,i);
393                         if (showhide) {
394                            el.show();
395                         } else {
396                                 el.hide();
397                         }     
398             }
399             // load up the directories
400             //??? why can we not create bjs files in other directories??
401                 if (!is_bjs && _this.file.path.length < 1) {
402                         _this.dirmodel.loadData();
403                         
404                         
405                 }
406            
407             
408         }
409     }
410     public class Xcls_ftdbcellrenderer : Object
411     {
412         public Gtk.CellRendererText el;
413         private Xcls_PopoverFileDetails  _this;
414
415
416             // my vars (def)
417
418         // ctor
419         public Xcls_ftdbcellrenderer(Xcls_PopoverFileDetails _owner )
420         {
421             _this = _owner;
422             _this.ftdbcellrenderer = this;
423             this.el = new Gtk.CellRendererText();
424
425             // my vars (dec)
426
427             // set gobject values
428         }
429
430         // user defined functions
431     }
432
433     public class Xcls_ftdbmodel : Object
434     {
435         public Gtk.ListStore el;
436         private Xcls_PopoverFileDetails  _this;
437
438
439             // my vars (def)
440
441         // ctor
442         public Xcls_ftdbmodel(Xcls_PopoverFileDetails _owner )
443         {
444             _this = _owner;
445             _this.ftdbmodel = this;
446             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
447
448             // my vars (dec)
449
450             // set gobject values
451         }
452
453         // user defined functions
454         public void loadData (string cur) {
455             this.el.clear();                                    
456             Gtk.TreeIter iter;
457             var el = this.el;
458             
459            /// el.append(out iter);
460             
461              
462            // el.set_value(iter, 0, "");
463            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
464         
465             el.append(out iter);
466         
467             
468             el.set_value(iter, 0, "bjs");
469             el.set_value(iter, 1, "User Interface File (bjs)");
470             _this.filetype.el.set_active_iter(iter);
471         
472             el.append(out iter);
473             
474             el.set_value(iter, 0, "vala");
475             el.set_value(iter, 1, "Vala");
476                 if (cur == "vala") {
477                     _this.filetype.el.set_active_iter(iter);
478             }
479         
480         
481         
482             el.append(out iter);
483             
484             el.set_value(iter, 0, "js");
485             el.set_value(iter, 1, "Javascript");
486         
487                 if (cur == "js") {
488                     _this.filetype.el.set_active_iter(iter);
489             }
490         
491             el.append(out iter);
492             
493             el.set_value(iter, 0, "css");
494             el.set_value(iter, 1, "CSS");
495         
496                 if (cur == "css") {
497                     _this.filetype.el.set_active_iter(iter);
498             }
499                                              
500         }
501     }
502
503
504     public class Xcls_Label9 : Object
505     {
506         public Gtk.Label el;
507         private Xcls_PopoverFileDetails  _this;
508
509
510             // my vars (def)
511
512         // ctor
513         public Xcls_Label9(Xcls_PopoverFileDetails _owner )
514         {
515             _this = _owner;
516             this.el = new Gtk.Label( "Component Name" );
517
518             // my vars (dec)
519
520             // set gobject values
521             this.el.justify = Gtk.Justification.RIGHT;
522             this.el.xalign = 0.900000f;
523         }
524
525         // user defined functions
526     }
527
528     public class Xcls_name : Object
529     {
530         public Gtk.Entry el;
531         private Xcls_PopoverFileDetails  _this;
532
533
534             // my vars (def)
535
536         // ctor
537         public Xcls_name(Xcls_PopoverFileDetails _owner )
538         {
539             _this = _owner;
540             _this.name = this;
541             this.el = new Gtk.Entry();
542
543             // my vars (dec)
544
545             // set gobject values
546             this.el.visible = true;
547         }
548
549         // user defined functions
550     }
551
552     public class Xcls_Label11 : Object
553     {
554         public Gtk.Label el;
555         private Xcls_PopoverFileDetails  _this;
556
557
558             // my vars (def)
559
560         // ctor
561         public Xcls_Label11(Xcls_PopoverFileDetails _owner )
562         {
563             _this = _owner;
564             this.el = new Gtk.Label( "Title" );
565
566             // my vars (dec)
567
568             // set gobject values
569             this.el.justify = Gtk.Justification.RIGHT;
570             this.el.xalign = 0.900000f;
571             this.el.visible = true;
572         }
573
574         // user defined functions
575     }
576
577     public class Xcls_title : Object
578     {
579         public Gtk.Entry el;
580         private Xcls_PopoverFileDetails  _this;
581
582
583             // my vars (def)
584
585         // ctor
586         public Xcls_title(Xcls_PopoverFileDetails _owner )
587         {
588             _this = _owner;
589             _this.title = this;
590             this.el = new Gtk.Entry();
591
592             // my vars (dec)
593
594             // set gobject values
595             this.el.visible = true;
596         }
597
598         // user defined functions
599     }
600
601     public class Xcls_Label13 : Object
602     {
603         public Gtk.Label el;
604         private Xcls_PopoverFileDetails  _this;
605
606
607             // my vars (def)
608
609         // ctor
610         public Xcls_Label13(Xcls_PopoverFileDetails _owner )
611         {
612             _this = _owner;
613             this.el = new Gtk.Label( "Region" );
614
615             // my vars (dec)
616
617             // set gobject values
618             this.el.justify = Gtk.Justification.RIGHT;
619             this.el.xalign = 0.900000f;
620             this.el.tooltip_text = "center, north, south, east, west";
621             this.el.visible = true;
622         }
623
624         // user defined functions
625     }
626
627     public class Xcls_region : Object
628     {
629         public Gtk.Entry el;
630         private Xcls_PopoverFileDetails  _this;
631
632
633             // my vars (def)
634
635         // ctor
636         public Xcls_region(Xcls_PopoverFileDetails _owner )
637         {
638             _this = _owner;
639             _this.region = this;
640             this.el = new Gtk.Entry();
641
642             // my vars (dec)
643
644             // set gobject values
645             this.el.visible = true;
646         }
647
648         // user defined functions
649     }
650
651     public class Xcls_Label15 : Object
652     {
653         public Gtk.Label el;
654         private Xcls_PopoverFileDetails  _this;
655
656
657             // my vars (def)
658
659         // ctor
660         public Xcls_Label15(Xcls_PopoverFileDetails _owner )
661         {
662             _this = _owner;
663             this.el = new Gtk.Label( "Parent Name" );
664
665             // my vars (dec)
666
667             // set gobject values
668             this.el.justify = Gtk.Justification.RIGHT;
669             this.el.xalign = 0.900000f;
670             this.el.visible = true;
671         }
672
673         // user defined functions
674     }
675
676     public class Xcls_parent : Object
677     {
678         public Gtk.Entry el;
679         private Xcls_PopoverFileDetails  _this;
680
681
682             // my vars (def)
683
684         // ctor
685         public Xcls_parent(Xcls_PopoverFileDetails _owner )
686         {
687             _this = _owner;
688             _this.parent = this;
689             this.el = new Gtk.Entry();
690
691             // my vars (dec)
692
693             // set gobject values
694             this.el.visible = true;
695         }
696
697         // user defined functions
698     }
699
700     public class Xcls_Label17 : Object
701     {
702         public Gtk.Label el;
703         private Xcls_PopoverFileDetails  _this;
704
705
706             // my vars (def)
707
708         // ctor
709         public Xcls_Label17(Xcls_PopoverFileDetails _owner )
710         {
711             _this = _owner;
712             this.el = new Gtk.Label( "Permission Name" );
713
714             // my vars (dec)
715
716             // set gobject values
717             this.el.justify = Gtk.Justification.RIGHT;
718             this.el.xalign = 0.900000f;
719             this.el.visible = true;
720         }
721
722         // user defined functions
723     }
724
725     public class Xcls_permname : Object
726     {
727         public Gtk.Entry el;
728         private Xcls_PopoverFileDetails  _this;
729
730
731             // my vars (def)
732
733         // ctor
734         public Xcls_permname(Xcls_PopoverFileDetails _owner )
735         {
736             _this = _owner;
737             _this.permname = this;
738             this.el = new Gtk.Entry();
739
740             // my vars (dec)
741
742             // set gobject values
743             this.el.visible = true;
744         }
745
746         // user defined functions
747     }
748
749     public class Xcls_Label19 : Object
750     {
751         public Gtk.Label el;
752         private Xcls_PopoverFileDetails  _this;
753
754
755             // my vars (def)
756
757         // ctor
758         public Xcls_Label19(Xcls_PopoverFileDetails _owner )
759         {
760             _this = _owner;
761             this.el = new Gtk.Label( "Order (for tabs)" );
762
763             // my vars (dec)
764
765             // set gobject values
766             this.el.justify = Gtk.Justification.RIGHT;
767             this.el.xalign = 0.900000f;
768             this.el.visible = true;
769         }
770
771         // user defined functions
772     }
773
774     public class Xcls_modOrder : Object
775     {
776         public Gtk.Entry el;
777         private Xcls_PopoverFileDetails  _this;
778
779
780             // my vars (def)
781
782         // ctor
783         public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
784         {
785             _this = _owner;
786             _this.modOrder = this;
787             this.el = new Gtk.Entry();
788
789             // my vars (dec)
790
791             // set gobject values
792             this.el.visible = true;
793         }
794
795         // user defined functions
796     }
797
798     public class Xcls_Label21 : Object
799     {
800         public Gtk.Label el;
801         private Xcls_PopoverFileDetails  _this;
802
803
804             // my vars (def)
805
806         // ctor
807         public Xcls_Label21(Xcls_PopoverFileDetails _owner )
808         {
809             _this = _owner;
810             this.el = new Gtk.Label( "Module to build (Vala only)" );
811
812             // my vars (dec)
813
814             // set gobject values
815             this.el.justify = Gtk.Justification.RIGHT;
816             this.el.xalign = 0.900000f;
817             this.el.visible = true;
818         }
819
820         // user defined functions
821     }
822
823     public class Xcls_build_module : Object
824     {
825         public Gtk.ComboBox el;
826         private Xcls_PopoverFileDetails  _this;
827
828
829             // my vars (def)
830
831         // ctor
832         public Xcls_build_module(Xcls_PopoverFileDetails _owner )
833         {
834             _this = _owner;
835             _this.build_module = this;
836             this.el = new Gtk.ComboBox();
837
838             // my vars (dec)
839
840             // set gobject values
841             var child_0 = new Xcls_dbcellrenderer( _this );
842             child_0.ref();
843             this.el.pack_start (  child_0.el , true );
844             var child_1 = new Xcls_dbmodel( _this );
845             child_1.ref();
846             this.el.set_model (  child_1.el  );
847
848             // init method
849
850             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
851         }
852
853         // user defined functions
854     }
855     public class Xcls_dbcellrenderer : Object
856     {
857         public Gtk.CellRendererText el;
858         private Xcls_PopoverFileDetails  _this;
859
860
861             // my vars (def)
862
863         // ctor
864         public Xcls_dbcellrenderer(Xcls_PopoverFileDetails _owner )
865         {
866             _this = _owner;
867             _this.dbcellrenderer = this;
868             this.el = new Gtk.CellRendererText();
869
870             // my vars (dec)
871
872             // set gobject values
873         }
874
875         // user defined functions
876     }
877
878     public class Xcls_dbmodel : Object
879     {
880         public Gtk.ListStore el;
881         private Xcls_PopoverFileDetails  _this;
882
883
884             // my vars (def)
885
886         // ctor
887         public Xcls_dbmodel(Xcls_PopoverFileDetails _owner )
888         {
889             _this = _owner;
890             _this.dbmodel = this;
891             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
892
893             // my vars (dec)
894
895             // set gobject values
896         }
897
898         // user defined functions
899         public void loadData (Gee.ArrayList<string> data, string cur) {
900             this.el.clear();                                    
901             Gtk.TreeIter iter;
902             var el = this.el;
903             
904            /// el.append(out iter);
905             
906              
907            // el.set_value(iter, 0, "");
908            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
909         
910             el.append(out iter);
911         
912             
913             el.set_value(iter, 0, "");
914             el.set_value(iter, 1, "-- select a module --");
915             _this.build_module.el.set_active_iter(iter);
916             
917             for (var i = 0; i < data.size;i++) {
918             
919         
920                 el.append(out iter);
921                 
922                 el.set_value(iter, 0, data.get(i));
923                 el.set_value(iter, 1, data.get(i));
924                 
925                 if (data.get(i) == cur) {
926                     _this.build_module.el.set_active_iter(iter);
927                 }
928                 
929             }
930              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
931                                              
932         }
933     }
934
935
936     public class Xcls_Label25 : Object
937     {
938         public Gtk.Label el;
939         private Xcls_PopoverFileDetails  _this;
940
941
942             // my vars (def)
943
944         // ctor
945         public Xcls_Label25(Xcls_PopoverFileDetails _owner )
946         {
947             _this = _owner;
948             this.el = new Gtk.Label( "Directory" );
949
950             // my vars (dec)
951
952             // set gobject values
953             this.el.justify = Gtk.Justification.RIGHT;
954             this.el.xalign = 0.900000f;
955             this.el.visible = true;
956         }
957
958         // user defined functions
959     }
960
961     public class Xcls_dir : Object
962     {
963         public Gtk.ComboBox el;
964         private Xcls_PopoverFileDetails  _this;
965
966
967             // my vars (def)
968
969         // ctor
970         public Xcls_dir(Xcls_PopoverFileDetails _owner )
971         {
972             _this = _owner;
973             _this.dir = this;
974             this.el = new Gtk.ComboBox();
975
976             // my vars (dec)
977
978             // set gobject values
979             var child_0 = new Xcls_dircellrenderer( _this );
980             child_0.ref();
981             this.el.pack_start (  child_0.el , true );
982             var child_1 = new Xcls_dirmodel( _this );
983             child_1.ref();
984             this.el.set_model (  child_1.el  );
985
986             // init method
987
988             this.el.add_attribute(_this.dircellrenderer.el , "markup", 1 );
989         }
990
991         // user defined functions
992     }
993     public class Xcls_dircellrenderer : Object
994     {
995         public Gtk.CellRendererText el;
996         private Xcls_PopoverFileDetails  _this;
997
998
999             // my vars (def)
1000
1001         // ctor
1002         public Xcls_dircellrenderer(Xcls_PopoverFileDetails _owner )
1003         {
1004             _this = _owner;
1005             _this.dircellrenderer = this;
1006             this.el = new Gtk.CellRendererText();
1007
1008             // my vars (dec)
1009
1010             // set gobject values
1011         }
1012
1013         // user defined functions
1014     }
1015
1016     public class Xcls_dirmodel : Object
1017     {
1018         public Gtk.ListStore el;
1019         private Xcls_PopoverFileDetails  _this;
1020
1021
1022             // my vars (def)
1023
1024         // ctor
1025         public Xcls_dirmodel(Xcls_PopoverFileDetails _owner )
1026         {
1027             _this = _owner;
1028             _this.dirmodel = this;
1029             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1030
1031             // my vars (dec)
1032
1033             // set gobject values
1034         }
1035
1036         // user defined functions
1037         public void loadData () {
1038                 
1039                 
1040           
1041             this.el.clear();                                    
1042             
1043             if (!(_this.project is Project.Gtk)) {
1044                         return;
1045                 }
1046             var sd = ((Project.Gtk)_this.project).sourcedirs();
1047             
1048             Gtk.TreeIter iter;
1049             var el = this.el;
1050             
1051            /// el.append(out iter);
1052             
1053              
1054            // el.set_value(iter, 0, "");
1055            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
1056         
1057         //    el.append(out iter);
1058         
1059             
1060         //    el.set_value(iter, 0, "");
1061           //  el.set_value(iter, 1, "-- select a directoyr --");
1062             //_this.build_module.el.set_active_iter(iter);
1063             
1064             for (var i = 0; i < sd.length;i++) {
1065             
1066         
1067                 el.append(out iter);
1068                 
1069                 el.set_value(iter, 0, sd[i]);
1070                 el.set_value(iter, 1, sd[i]);
1071                 
1072                 //if (data.get(i) == cur) {
1073                 //    _this.build_module.el.set_active_iter(iter);
1074                // }
1075                 
1076             }
1077           //  this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1078                                              
1079         }
1080     }
1081
1082
1083
1084     public class Xcls_HButtonBox29 : Object
1085     {
1086         public Gtk.HButtonBox el;
1087         private Xcls_PopoverFileDetails  _this;
1088
1089
1090             // my vars (def)
1091
1092         // ctor
1093         public Xcls_HButtonBox29(Xcls_PopoverFileDetails _owner )
1094         {
1095             _this = _owner;
1096             this.el = new Gtk.HButtonBox();
1097
1098             // my vars (dec)
1099
1100             // set gobject values
1101             this.el.margin_right = 4;
1102             this.el.margin_left = 4;
1103             this.el.margin_bottom = 4;
1104             var child_0 = new Xcls_Button30( _this );
1105             child_0.ref();
1106             this.el.add (  child_0.el  );
1107             var child_1 = new Xcls_save_btn( _this );
1108             child_1.ref();
1109             this.el.add (  child_1.el  );
1110         }
1111
1112         // user defined functions
1113     }
1114     public class Xcls_Button30 : Object
1115     {
1116         public Gtk.Button el;
1117         private Xcls_PopoverFileDetails  _this;
1118
1119
1120             // my vars (def)
1121
1122         // ctor
1123         public Xcls_Button30(Xcls_PopoverFileDetails _owner )
1124         {
1125             _this = _owner;
1126             this.el = new Gtk.Button();
1127
1128             // my vars (dec)
1129
1130             // set gobject values
1131             this.el.label = "Cancel";
1132
1133             //listeners
1134             this.el.clicked.connect( () => { 
1135             
1136               _this.done = true;
1137                 _this.el.hide(); 
1138             });
1139         }
1140
1141         // user defined functions
1142     }
1143
1144     public class Xcls_save_btn : Object
1145     {
1146         public Gtk.Button el;
1147         private Xcls_PopoverFileDetails  _this;
1148
1149
1150             // my vars (def)
1151
1152         // ctor
1153         public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
1154         {
1155             _this = _owner;
1156             _this.save_btn = this;
1157             this.el = new Gtk.Button();
1158
1159             // my vars (dec)
1160
1161             // set gobject values
1162             this.el.label = "Save";
1163
1164             //listeners
1165             this.el.clicked.connect( ( ) =>  { 
1166             
1167              
1168             
1169             
1170                 if (_this.name.el.get_text().length  < 1) {
1171                     StandardErrorDialog.show(
1172                         _this.mainwindow.el,
1173                         "You have to set Component name "
1174                     );
1175                      
1176                     return;
1177                 }
1178                 // what does this do?
1179                 
1180                 var isNew = _this.file.name.length  > 0 ? false : true;
1181                 /*
1182                 if (!isNew && this.file.name != _this.name.el.get_text()) {
1183                     Xcls_StandardErrorDialog.singleton().show(
1184                         this.el,
1185                         "Sorry changing names does not work yet. "
1186                     );
1187                      
1188                     return;
1189                 }
1190                 */
1191                  
1192                 
1193               
1194                 // FIXME - this may be more complicated...
1195                 //for (var i in this.def) {
1196                 //    this.file[i] =  this.get(i).el.get_text();
1197                 //}
1198             
1199                 if (!isNew) {
1200                     try {
1201                          _this.updateFileFromEntry();
1202                      } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
1203                           Xcls_StandardErrorDialog.singleton().show(
1204                             _this.mainwindow.el,
1205                             "The name you used already exists "
1206                         );
1207                         return;
1208                          
1209                      }
1210             
1211                       _this.done = true;
1212                     _this.file.save();
1213                     _this.el.hide();
1214                     return;
1215                 }
1216                 
1217                 // ---------------- NEW FILES...
1218                 Gtk.TreeIter iter;
1219             
1220                 if (!_this.filetype.el.get_active_iter(out iter)) {
1221                         // should not happen...
1222                         // so we are jut going to return without 
1223                         StandardErrorDialog.show(
1224                         _this.mainwindow.el,
1225                         "You must select a file type. "
1226                     );
1227                     return;
1228                          
1229                 }
1230                 
1231                 
1232                 var fn = _this.name.el.get_text();
1233                 
1234                 Value ftypename;
1235                 _this.ftdbmodel.el.get_value (iter, 0, out ftypename);
1236                 var ext = ((string)ftypename);
1237                 var dir = _this.project.firstPath(); 
1238                 if (ext != "bjs") {
1239                  
1240                         if (!_this.dir.el.get_active_iter(out iter)) {
1241                                 // should not happen...
1242                                 // so we are jut going to return without 
1243                                 StandardErrorDialog.show(
1244                                     _this.mainwindow.el,
1245                                     "You must select a directory "
1246                                 );
1247                                 return;
1248                         }
1249                         Value vdir;
1250                         _this.dirmodel.el.get_value (iter, 0, out vdir);
1251                         dir = (string)vdir;
1252                 }
1253                 
1254                 var targetfile = dir + "/" + fn;
1255                 
1256                 // strip the file type off the end..
1257                 
1258                 
1259                 var rx = new GLib.Regex("\\." + ext + "$",GLib.RegexCompileFlags.CASELESS);
1260                 targetfile = rx.replace(targetfile, targetfile.length, 0, ""); 
1261                
1262                 if (GLib.FileUtils.test(targetfile + "." + ext, GLib.FileTest.EXISTS)) {
1263                     Xcls_StandardErrorDialog.singleton().show(
1264                         _this.mainwindow.el,
1265                         "That file already exists"
1266                     ); 
1267                     return;
1268                 }
1269                
1270                var f =  JsRender.JsRender.factory(
1271                         ext == "bjs" ? _this.file.project.xtype : "PlainFile",  
1272                         _this.file.project, 
1273                         targetfile + "." + ext);
1274             
1275                 _this.file = f;
1276                 
1277             
1278                 
1279                 _this.updateFileFromEntry();
1280                 _this.file.loaded = true;
1281                 _this.file.save();
1282                 if (ext == "bjs") {
1283                         _this.file.project.addFile(_this.file);
1284                 }
1285                 
1286              
1287                 // what about .js ?
1288                _this.done = true;
1289                 _this.el.hide();
1290             
1291             // hopefull this will work with bjs files..
1292                 
1293                 _this.success(_this.project, _this.file);
1294                
1295             });
1296         }
1297
1298         // user defined functions
1299     }
1300
1301
1302
1303 }