NewBranch.bjs
[gitlive] / NewBranch.vala
1 static Xcls_DialogNewComponent  _DialogNewComponent;
2
3 public class Xcls_DialogNewComponent : Object
4 {
5     public Gtk.Dialog el;
6     private Xcls_DialogNewComponent  _this;
7
8     public static Xcls_DialogNewComponent singleton()
9     {
10         if (_DialogNewComponent == null) {
11             _DialogNewComponent= new Xcls_DialogNewComponent();
12         }
13         return _DialogNewComponent;
14     }
15     public Xcls_name name;
16     public Xcls_title title;
17     public Xcls_region region;
18     public Xcls_parent parent;
19     public Xcls_permname permname;
20     public Xcls_modOrder modOrder;
21     public Xcls_build_module build_module;
22     public Xcls_dbcellrenderer dbcellrenderer;
23     public Xcls_dbmodel dbmodel;
24
25         // my vars (def)
26     public signal void success (Project.Project pr, JsRender.JsRender file);
27
28     // ctor
29     public Xcls_DialogNewComponent()
30     {
31         _this = this;
32         this.el = new Gtk.Dialog();
33
34         // my vars (dec)
35
36         // set gobject values
37         this.el.title = "New Component";
38         this.el.default_height = 200;
39         this.el.default_width = 500;
40         this.el.deletable = true;
41         this.el.modal = true;
42         var child_0 = new Xcls_VBox2( _this );
43         child_0.ref();
44         this.el.get_content_area().add (  child_0.el  );
45         var child_1 = new Xcls_Button20( _this );
46         child_1.ref();
47         this.el.add_action_widget (  child_1.el , 0 );
48         var child_2 = new Xcls_Button21( _this );
49         child_2.ref();
50         this.el.add_action_widget (  child_2.el , 1 );
51
52         //listeners
53         this.el.delete_event.connect( (self, event) => {
54             this.el.hide();
55             return true; 
56             //test  
57         });
58         this.el.response.connect( (self, response_id) =>  { 
59           
60                  
61         });
62         this.el.show.connect( (self)  => {
63           this.el.show_all();
64           //test
65         });
66     }
67
68     // user defined functions
69     public   void updateFileFromEntry () {
70     
71             _this.file.title = _this.title.el.get_text();
72             _this.file.region = _this.region.el.get_text();            
73             _this.file.parent = _this.parent.el.get_text();                        
74             _this.file.permname = _this.permname.el.get_text();                                    
75             _this.file.modOrder = _this.modOrder.el.get_text();
76             
77             if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {
78                 _this.file.renameTo(_this.name.el.get_text());
79             }
80             // store the module...
81             _this.file.build_module = "";        
82              Gtk.TreeIter iter; 
83             if (_this.build_module.el.get_active_iter (out iter)) {
84                  Value vfname;
85                  this.dbmodel.el.get_value (iter, 0, out vfname);
86                  if (((string)vfname).length > 0) {
87                      _this.file.build_module = (string)vfname;
88                  }
89         
90             }
91             
92             
93     
94                                                         
95     }
96     public   void show ( ) 
97     {
98         
99         
100         //this.success = c.success;
101         
102         
103     }
104     public class Xcls_VBox2 : Object
105     {
106         public Gtk.VBox el;
107         private Xcls_DialogNewComponent  _this;
108
109
110             // my vars (def)
111
112         // ctor
113         public Xcls_VBox2(Xcls_DialogNewComponent _owner )
114         {
115             _this = _owner;
116             this.el = new Gtk.VBox( true, 0 );
117
118             // my vars (dec)
119
120             // set gobject values
121             var child_0 = new Xcls_Table3( _this );
122             child_0.ref();
123             this.el.pack_start (  child_0.el , false,false,0 );
124         }
125
126         // user defined functions
127     }
128     public class Xcls_Table3 : Object
129     {
130         public Gtk.Table el;
131         private Xcls_DialogNewComponent  _this;
132
133
134             // my vars (def)
135
136         // ctor
137         public Xcls_Table3(Xcls_DialogNewComponent _owner )
138         {
139             _this = _owner;
140             this.el = new Gtk.Table( 3, 2, true );
141
142             // my vars (dec)
143
144             // set gobject values
145             var child_0 = new Xcls_Label4( _this );
146             child_0.ref();
147             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
148             var child_1 = new Xcls_name( _this );
149             child_1.ref();
150             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
151             var child_2 = new Xcls_Label6( _this );
152             child_2.ref();
153             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
154             var child_3 = new Xcls_title( _this );
155             child_3.ref();
156             this.el.attach_defaults (  child_3.el , 1,2,1,2 );
157             var child_4 = new Xcls_Label8( _this );
158             child_4.ref();
159             this.el.attach_defaults (  child_4.el , 0,1,2,3 );
160             var child_5 = new Xcls_region( _this );
161             child_5.ref();
162             this.el.attach_defaults (  child_5.el , 1,2,2,3 );
163             var child_6 = new Xcls_Label10( _this );
164             child_6.ref();
165             this.el.attach_defaults (  child_6.el , 0,1,3,4 );
166             var child_7 = new Xcls_parent( _this );
167             child_7.ref();
168             this.el.attach_defaults (  child_7.el , 1,2,3,4 );
169             var child_8 = new Xcls_Label12( _this );
170             child_8.ref();
171             this.el.attach_defaults (  child_8.el , 0,1,4,5 );
172             var child_9 = new Xcls_permname( _this );
173             child_9.ref();
174             this.el.attach_defaults (  child_9.el , 1,2,4,5 );
175             var child_10 = new Xcls_Label14( _this );
176             child_10.ref();
177             this.el.attach_defaults (  child_10.el , 0,1,5,6 );
178             var child_11 = new Xcls_modOrder( _this );
179             child_11.ref();
180             this.el.attach_defaults (  child_11.el , 1,2,5,6 );
181             var child_12 = new Xcls_Label16( _this );
182             child_12.ref();
183             this.el.attach_defaults (  child_12.el , 0,1,6,7 );
184             var child_13 = new Xcls_build_module( _this );
185             child_13.ref();
186             this.el.attach_defaults (  child_13.el , 1,2,6,7 );
187         }
188
189         // user defined functions
190     }
191     public class Xcls_Label4 : Object
192     {
193         public Gtk.Label el;
194         private Xcls_DialogNewComponent  _this;
195
196
197             // my vars (def)
198
199         // ctor
200         public Xcls_Label4(Xcls_DialogNewComponent _owner )
201         {
202             _this = _owner;
203             this.el = new Gtk.Label( "Component Name" );
204
205             // my vars (dec)
206
207             // set gobject values
208             this.el.justify = Gtk.Justification.RIGHT;
209             this.el.xalign = 0.900000f;
210         }
211
212         // user defined functions
213     }
214
215     public class Xcls_name : Object
216     {
217         public Gtk.Entry el;
218         private Xcls_DialogNewComponent  _this;
219
220
221             // my vars (def)
222
223         // ctor
224         public Xcls_name(Xcls_DialogNewComponent _owner )
225         {
226             _this = _owner;
227             _this.name = this;
228             this.el = new Gtk.Entry();
229
230             // my vars (dec)
231
232             // set gobject values
233             this.el.visible = true;
234         }
235
236         // user defined functions
237     }
238
239     public class Xcls_Label6 : Object
240     {
241         public Gtk.Label el;
242         private Xcls_DialogNewComponent  _this;
243
244
245             // my vars (def)
246
247         // ctor
248         public Xcls_Label6(Xcls_DialogNewComponent _owner )
249         {
250             _this = _owner;
251             this.el = new Gtk.Label( "Title" );
252
253             // my vars (dec)
254
255             // set gobject values
256             this.el.justify = Gtk.Justification.RIGHT;
257             this.el.xalign = 0.900000f;
258             this.el.visible = true;
259         }
260
261         // user defined functions
262     }
263
264     public class Xcls_title : Object
265     {
266         public Gtk.Entry el;
267         private Xcls_DialogNewComponent  _this;
268
269
270             // my vars (def)
271
272         // ctor
273         public Xcls_title(Xcls_DialogNewComponent _owner )
274         {
275             _this = _owner;
276             _this.title = this;
277             this.el = new Gtk.Entry();
278
279             // my vars (dec)
280
281             // set gobject values
282             this.el.visible = true;
283         }
284
285         // user defined functions
286     }
287
288     public class Xcls_Label8 : Object
289     {
290         public Gtk.Label el;
291         private Xcls_DialogNewComponent  _this;
292
293
294             // my vars (def)
295
296         // ctor
297         public Xcls_Label8(Xcls_DialogNewComponent _owner )
298         {
299             _this = _owner;
300             this.el = new Gtk.Label( "Region" );
301
302             // my vars (dec)
303
304             // set gobject values
305             this.el.justify = Gtk.Justification.RIGHT;
306             this.el.xalign = 0.900000f;
307             this.el.tooltip_text = "center, north, south, east, west";
308             this.el.visible = true;
309         }
310
311         // user defined functions
312     }
313
314     public class Xcls_region : Object
315     {
316         public Gtk.Entry el;
317         private Xcls_DialogNewComponent  _this;
318
319
320             // my vars (def)
321
322         // ctor
323         public Xcls_region(Xcls_DialogNewComponent _owner )
324         {
325             _this = _owner;
326             _this.region = this;
327             this.el = new Gtk.Entry();
328
329             // my vars (dec)
330
331             // set gobject values
332             this.el.visible = true;
333         }
334
335         // user defined functions
336     }
337
338     public class Xcls_Label10 : Object
339     {
340         public Gtk.Label el;
341         private Xcls_DialogNewComponent  _this;
342
343
344             // my vars (def)
345
346         // ctor
347         public Xcls_Label10(Xcls_DialogNewComponent _owner )
348         {
349             _this = _owner;
350             this.el = new Gtk.Label( "Parent Name" );
351
352             // my vars (dec)
353
354             // set gobject values
355             this.el.justify = Gtk.Justification.RIGHT;
356             this.el.xalign = 0.900000f;
357             this.el.visible = true;
358         }
359
360         // user defined functions
361     }
362
363     public class Xcls_parent : Object
364     {
365         public Gtk.Entry el;
366         private Xcls_DialogNewComponent  _this;
367
368
369             // my vars (def)
370
371         // ctor
372         public Xcls_parent(Xcls_DialogNewComponent _owner )
373         {
374             _this = _owner;
375             _this.parent = this;
376             this.el = new Gtk.Entry();
377
378             // my vars (dec)
379
380             // set gobject values
381             this.el.visible = true;
382         }
383
384         // user defined functions
385     }
386
387     public class Xcls_Label12 : Object
388     {
389         public Gtk.Label el;
390         private Xcls_DialogNewComponent  _this;
391
392
393             // my vars (def)
394
395         // ctor
396         public Xcls_Label12(Xcls_DialogNewComponent _owner )
397         {
398             _this = _owner;
399             this.el = new Gtk.Label( "Permission Name" );
400
401             // my vars (dec)
402
403             // set gobject values
404             this.el.justify = Gtk.Justification.RIGHT;
405             this.el.xalign = 0.900000f;
406             this.el.visible = true;
407         }
408
409         // user defined functions
410     }
411
412     public class Xcls_permname : Object
413     {
414         public Gtk.Entry el;
415         private Xcls_DialogNewComponent  _this;
416
417
418             // my vars (def)
419
420         // ctor
421         public Xcls_permname(Xcls_DialogNewComponent _owner )
422         {
423             _this = _owner;
424             _this.permname = this;
425             this.el = new Gtk.Entry();
426
427             // my vars (dec)
428
429             // set gobject values
430             this.el.visible = true;
431         }
432
433         // user defined functions
434     }
435
436     public class Xcls_Label14 : Object
437     {
438         public Gtk.Label el;
439         private Xcls_DialogNewComponent  _this;
440
441
442             // my vars (def)
443
444         // ctor
445         public Xcls_Label14(Xcls_DialogNewComponent _owner )
446         {
447             _this = _owner;
448             this.el = new Gtk.Label( "Order (for tabs)" );
449
450             // my vars (dec)
451
452             // set gobject values
453             this.el.justify = Gtk.Justification.RIGHT;
454             this.el.xalign = 0.900000f;
455             this.el.visible = true;
456         }
457
458         // user defined functions
459     }
460
461     public class Xcls_modOrder : Object
462     {
463         public Gtk.Entry el;
464         private Xcls_DialogNewComponent  _this;
465
466
467             // my vars (def)
468
469         // ctor
470         public Xcls_modOrder(Xcls_DialogNewComponent _owner )
471         {
472             _this = _owner;
473             _this.modOrder = this;
474             this.el = new Gtk.Entry();
475
476             // my vars (dec)
477
478             // set gobject values
479             this.el.visible = true;
480         }
481
482         // user defined functions
483     }
484
485     public class Xcls_Label16 : Object
486     {
487         public Gtk.Label el;
488         private Xcls_DialogNewComponent  _this;
489
490
491             // my vars (def)
492
493         // ctor
494         public Xcls_Label16(Xcls_DialogNewComponent _owner )
495         {
496             _this = _owner;
497             this.el = new Gtk.Label( "Module to build (Vala only)" );
498
499             // my vars (dec)
500
501             // set gobject values
502             this.el.justify = Gtk.Justification.RIGHT;
503             this.el.xalign = 0.900000f;
504             this.el.visible = true;
505         }
506
507         // user defined functions
508     }
509
510     public class Xcls_build_module : Object
511     {
512         public Gtk.ComboBox el;
513         private Xcls_DialogNewComponent  _this;
514
515
516             // my vars (def)
517
518         // ctor
519         public Xcls_build_module(Xcls_DialogNewComponent _owner )
520         {
521             _this = _owner;
522             _this.build_module = this;
523             this.el = new Gtk.ComboBox();
524
525             // my vars (dec)
526
527             // set gobject values
528             var child_0 = new Xcls_dbcellrenderer( _this );
529             child_0.ref();
530             this.el.pack_start (  child_0.el , true );
531             var child_1 = new Xcls_dbmodel( _this );
532             child_1.ref();
533             this.el.set_model (  child_1.el  );
534
535             // init method
536
537             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
538         }
539
540         // user defined functions
541     }
542     public class Xcls_dbcellrenderer : Object
543     {
544         public Gtk.CellRendererText el;
545         private Xcls_DialogNewComponent  _this;
546
547
548             // my vars (def)
549
550         // ctor
551         public Xcls_dbcellrenderer(Xcls_DialogNewComponent _owner )
552         {
553             _this = _owner;
554             _this.dbcellrenderer = this;
555             this.el = new Gtk.CellRendererText();
556
557             // my vars (dec)
558
559             // set gobject values
560         }
561
562         // user defined functions
563     }
564
565     public class Xcls_dbmodel : Object
566     {
567         public Gtk.ListStore el;
568         private Xcls_DialogNewComponent  _this;
569
570
571             // my vars (def)
572
573         // ctor
574         public Xcls_dbmodel(Xcls_DialogNewComponent _owner )
575         {
576             _this = _owner;
577             _this.dbmodel = this;
578             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
579
580             // my vars (dec)
581
582             // set gobject values
583         }
584
585         // user defined functions
586         public void loadData (Gee.ArrayList<string> data, string cur) {
587             this.el.clear();                                    
588             Gtk.TreeIter iter;
589             var el = this.el;
590             
591            /// el.append(out iter);
592             
593              
594            // el.set_value(iter, 0, "");
595            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
596         
597             el.append(out iter);
598         
599             
600             el.set_value(iter, 0, "");
601             el.set_value(iter, 1, "-- select a module --");
602             _this.build_module.el.set_active_iter(iter);
603             
604             for (var i = 0; i < data.size;i++) {
605             
606         
607                 el.append(out iter);
608                 
609                 el.set_value(iter, 0, data.get(i));
610                 el.set_value(iter, 1, data.get(i));
611                 
612                 if (data.get(i) == cur) {
613                     _this.build_module.el.set_active_iter(iter);
614                 }
615                 
616             }
617              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
618                                              
619         }
620     }
621
622
623
624
625     public class Xcls_Button20 : Object
626     {
627         public Gtk.Button el;
628         private Xcls_DialogNewComponent  _this;
629
630
631             // my vars (def)
632
633         // ctor
634         public Xcls_Button20(Xcls_DialogNewComponent _owner )
635         {
636             _this = _owner;
637             this.el = new Gtk.Button();
638
639             // my vars (dec)
640
641             // set gobject values
642             this.el.label = "Cancel";
643         }
644
645         // user defined functions
646     }
647
648     public class Xcls_Button21 : Object
649     {
650         public Gtk.Button el;
651         private Xcls_DialogNewComponent  _this;
652
653
654             // my vars (def)
655
656         // ctor
657         public Xcls_Button21(Xcls_DialogNewComponent _owner )
658         {
659             _this = _owner;
660             this.el = new Gtk.Button();
661
662             // my vars (dec)
663
664             // set gobject values
665             this.el.label = "OK";
666         }
667
668         // user defined functions
669     }
670
671 }