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