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_build_module build_module;
16     public Xcls_dbcellrenderer dbcellrenderer;
17     public Xcls_dbmodel dbmodel;
18     public Xcls_name name;
19
20         // my vars (def)
21     public signal void success (Project.Project pr, JsRender.JsRender file);
22
23     // ctor
24     public Xcls_DialogNewComponent()
25     {
26         _this = this;
27         this.el = new Gtk.Dialog();
28
29         // my vars (dec)
30
31         // set gobject values
32         this.el.title = "New Component";
33         this.el.default_height = 200;
34         this.el.default_width = 500;
35         this.el.deletable = true;
36         this.el.modal = true;
37         var child_0 = new Xcls_VBox2( _this );
38         child_0.ref();
39         this.el.get_content_area().add (  child_0.el  );
40         var child_1 = new Xcls_Button10( _this );
41         child_1.ref();
42         this.el.add_action_widget (  child_1.el , 0 );
43         var child_2 = new Xcls_Button11( _this );
44         child_2.ref();
45         this.el.add_action_widget (  child_2.el , 1 );
46
47         //listeners
48         this.el.delete_event.connect( (self, event) => {
49             this.el.hide();
50             return true; 
51             //test  
52         });
53         this.el.response.connect( (self, response_id) =>  { 
54           
55                  
56         });
57         this.el.show.connect( (self)  => {
58           this.el.show_all();
59           //test
60         });
61     }
62
63     // user defined functions
64     public   void updateFileFromEntry () {
65     
66             _this.file.title = _this.title.el.get_text();
67             _this.file.region = _this.region.el.get_text();            
68             _this.file.parent = _this.parent.el.get_text();                        
69             _this.file.permname = _this.permname.el.get_text();                                    
70             _this.file.modOrder = _this.modOrder.el.get_text();
71             
72             if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {
73                 _this.file.renameTo(_this.name.el.get_text());
74             }
75             // store the module...
76             _this.file.build_module = "";        
77              Gtk.TreeIter iter; 
78             if (_this.build_module.el.get_active_iter (out iter)) {
79                  Value vfname;
80                  this.dbmodel.el.get_value (iter, 0, out vfname);
81                  if (((string)vfname).length > 0) {
82                      _this.file.build_module = (string)vfname;
83                  }
84         
85             }
86             
87             
88     
89                                                         
90     }
91     public   void show ( ) 
92     {
93         
94         
95         //this.success = c.success;
96         
97         
98     }
99     public class Xcls_VBox2 : Object
100     {
101         public Gtk.VBox el;
102         private Xcls_DialogNewComponent  _this;
103
104
105             // my vars (def)
106
107         // ctor
108         public Xcls_VBox2(Xcls_DialogNewComponent _owner )
109         {
110             _this = _owner;
111             this.el = new Gtk.VBox( true, 0 );
112
113             // my vars (dec)
114
115             // set gobject values
116             var child_0 = new Xcls_Table3( _this );
117             child_0.ref();
118             this.el.pack_start (  child_0.el , false,false,0 );
119         }
120
121         // user defined functions
122     }
123     public class Xcls_Table3 : Object
124     {
125         public Gtk.Table el;
126         private Xcls_DialogNewComponent  _this;
127
128
129             // my vars (def)
130
131         // ctor
132         public Xcls_Table3(Xcls_DialogNewComponent _owner )
133         {
134             _this = _owner;
135             this.el = new Gtk.Table( 3, 2, true );
136
137             // my vars (dec)
138
139             // set gobject values
140             var child_0 = new Xcls_Label4( _this );
141             child_0.ref();
142             this.el.attach_defaults (  child_0.el , 0,1,1,2 );
143             var child_1 = new Xcls_build_module( _this );
144             child_1.ref();
145             this.el.attach_defaults (  child_1.el , 1,2,1,2 );
146             var child_2 = new Xcls_Label8( _this );
147             child_2.ref();
148             this.el.attach_defaults (  child_2.el , 0,1,0,1 );
149             var child_3 = new Xcls_name( _this );
150             child_3.ref();
151             this.el.attach_defaults (  child_3.el , 1,2,0,1 );
152         }
153
154         // user defined functions
155     }
156     public class Xcls_Label4 : Object
157     {
158         public Gtk.Label el;
159         private Xcls_DialogNewComponent  _this;
160
161
162             // my vars (def)
163
164         // ctor
165         public Xcls_Label4(Xcls_DialogNewComponent _owner )
166         {
167             _this = _owner;
168             this.el = new Gtk.Label( "Module to build (Vala only)" );
169
170             // my vars (dec)
171
172             // set gobject values
173             this.el.justify = Gtk.Justification.RIGHT;
174             this.el.xalign = 0.900000f;
175             this.el.visible = true;
176         }
177
178         // user defined functions
179     }
180
181     public class Xcls_build_module : Object
182     {
183         public Gtk.ComboBox el;
184         private Xcls_DialogNewComponent  _this;
185
186
187             // my vars (def)
188
189         // ctor
190         public Xcls_build_module(Xcls_DialogNewComponent _owner )
191         {
192             _this = _owner;
193             _this.build_module = this;
194             this.el = new Gtk.ComboBox();
195
196             // my vars (dec)
197
198             // set gobject values
199             var child_0 = new Xcls_dbcellrenderer( _this );
200             child_0.ref();
201             this.el.pack_start (  child_0.el , true );
202             var child_1 = new Xcls_dbmodel( _this );
203             child_1.ref();
204             this.el.set_model (  child_1.el  );
205
206             // init method
207
208             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
209         }
210
211         // user defined functions
212     }
213     public class Xcls_dbcellrenderer : Object
214     {
215         public Gtk.CellRendererText el;
216         private Xcls_DialogNewComponent  _this;
217
218
219             // my vars (def)
220
221         // ctor
222         public Xcls_dbcellrenderer(Xcls_DialogNewComponent _owner )
223         {
224             _this = _owner;
225             _this.dbcellrenderer = this;
226             this.el = new Gtk.CellRendererText();
227
228             // my vars (dec)
229
230             // set gobject values
231         }
232
233         // user defined functions
234     }
235
236     public class Xcls_dbmodel : Object
237     {
238         public Gtk.ListStore el;
239         private Xcls_DialogNewComponent  _this;
240
241
242             // my vars (def)
243
244         // ctor
245         public Xcls_dbmodel(Xcls_DialogNewComponent _owner )
246         {
247             _this = _owner;
248             _this.dbmodel = this;
249             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
250
251             // my vars (dec)
252
253             // set gobject values
254         }
255
256         // user defined functions
257         public void loadData (Gee.ArrayList<string> data, string cur) {
258             this.el.clear();                                    
259             Gtk.TreeIter iter;
260             var el = this.el;
261             
262            /// el.append(out iter);
263             
264              
265            // el.set_value(iter, 0, "");
266            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
267         
268             el.append(out iter);
269         
270             
271             el.set_value(iter, 0, "");
272             el.set_value(iter, 1, "-- select a module --");
273             _this.build_module.el.set_active_iter(iter);
274             
275             for (var i = 0; i < data.size;i++) {
276             
277         
278                 el.append(out iter);
279                 
280                 el.set_value(iter, 0, data.get(i));
281                 el.set_value(iter, 1, data.get(i));
282                 
283                 if (data.get(i) == cur) {
284                     _this.build_module.el.set_active_iter(iter);
285                 }
286                 
287             }
288              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
289                                              
290         }
291     }
292
293
294     public class Xcls_Label8 : Object
295     {
296         public Gtk.Label el;
297         private Xcls_DialogNewComponent  _this;
298
299
300             // my vars (def)
301
302         // ctor
303         public Xcls_Label8(Xcls_DialogNewComponent _owner )
304         {
305             _this = _owner;
306             this.el = new Gtk.Label( "Component Name" );
307
308             // my vars (dec)
309
310             // set gobject values
311             this.el.justify = Gtk.Justification.RIGHT;
312             this.el.xalign = 0.900000f;
313         }
314
315         // user defined functions
316     }
317
318     public class Xcls_name : Object
319     {
320         public Gtk.Entry el;
321         private Xcls_DialogNewComponent  _this;
322
323
324             // my vars (def)
325
326         // ctor
327         public Xcls_name(Xcls_DialogNewComponent _owner )
328         {
329             _this = _owner;
330             _this.name = this;
331             this.el = new Gtk.Entry();
332
333             // my vars (dec)
334
335             // set gobject values
336             this.el.visible = true;
337         }
338
339         // user defined functions
340     }
341
342
343
344     public class Xcls_Button10 : Object
345     {
346         public Gtk.Button el;
347         private Xcls_DialogNewComponent  _this;
348
349
350             // my vars (def)
351
352         // ctor
353         public Xcls_Button10(Xcls_DialogNewComponent _owner )
354         {
355             _this = _owner;
356             this.el = new Gtk.Button();
357
358             // my vars (dec)
359
360             // set gobject values
361             this.el.label = "Cancel";
362         }
363
364         // user defined functions
365     }
366
367     public class Xcls_Button11 : Object
368     {
369         public Gtk.Button el;
370         private Xcls_DialogNewComponent  _this;
371
372
373             // my vars (def)
374
375         // ctor
376         public Xcls_Button11(Xcls_DialogNewComponent _owner )
377         {
378             _this = _owner;
379             this.el = new Gtk.Button();
380
381             // my vars (dec)
382
383             // set gobject values
384             this.el.label = "OK";
385         }
386
387         // user defined functions
388     }
389
390 }