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