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_build_module build_module;
17     public Xcls_dbcellrenderer dbcellrenderer;
18     public Xcls_dbmodel dbmodel;
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,0,1 );
143             var child_1 = new Xcls_name( _this );
144             child_1.ref();
145             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
146             var child_2 = new Xcls_Label6( _this );
147             child_2.ref();
148             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
149             var child_3 = new Xcls_build_module( _this );
150             child_3.ref();
151             this.el.attach_defaults (  child_3.el , 1,2,1,2 );
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( "Component Name" );
169
170             // my vars (dec)
171
172             // set gobject values
173             this.el.justify = Gtk.Justification.RIGHT;
174             this.el.xalign = 0.900000f;
175         }
176
177         // user defined functions
178     }
179
180     public class Xcls_name : Object
181     {
182         public Gtk.Entry el;
183         private Xcls_DialogNewComponent  _this;
184
185
186             // my vars (def)
187
188         // ctor
189         public Xcls_name(Xcls_DialogNewComponent _owner )
190         {
191             _this = _owner;
192             _this.name = this;
193             this.el = new Gtk.Entry();
194
195             // my vars (dec)
196
197             // set gobject values
198             this.el.visible = true;
199         }
200
201         // user defined functions
202     }
203
204     public class Xcls_Label6 : Object
205     {
206         public Gtk.Label el;
207         private Xcls_DialogNewComponent  _this;
208
209
210             // my vars (def)
211
212         // ctor
213         public Xcls_Label6(Xcls_DialogNewComponent _owner )
214         {
215             _this = _owner;
216             this.el = new Gtk.Label( "Module to build (Vala only)" );
217
218             // my vars (dec)
219
220             // set gobject values
221             this.el.justify = Gtk.Justification.RIGHT;
222             this.el.xalign = 0.900000f;
223             this.el.visible = true;
224         }
225
226         // user defined functions
227     }
228
229     public class Xcls_build_module : Object
230     {
231         public Gtk.ComboBox el;
232         private Xcls_DialogNewComponent  _this;
233
234
235             // my vars (def)
236
237         // ctor
238         public Xcls_build_module(Xcls_DialogNewComponent _owner )
239         {
240             _this = _owner;
241             _this.build_module = this;
242             this.el = new Gtk.ComboBox();
243
244             // my vars (dec)
245
246             // set gobject values
247             var child_0 = new Xcls_dbcellrenderer( _this );
248             child_0.ref();
249             this.el.pack_start (  child_0.el , true );
250             var child_1 = new Xcls_dbmodel( _this );
251             child_1.ref();
252             this.el.set_model (  child_1.el  );
253
254             // init method
255
256             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
257         }
258
259         // user defined functions
260     }
261     public class Xcls_dbcellrenderer : Object
262     {
263         public Gtk.CellRendererText el;
264         private Xcls_DialogNewComponent  _this;
265
266
267             // my vars (def)
268
269         // ctor
270         public Xcls_dbcellrenderer(Xcls_DialogNewComponent _owner )
271         {
272             _this = _owner;
273             _this.dbcellrenderer = this;
274             this.el = new Gtk.CellRendererText();
275
276             // my vars (dec)
277
278             // set gobject values
279         }
280
281         // user defined functions
282     }
283
284     public class Xcls_dbmodel : Object
285     {
286         public Gtk.ListStore el;
287         private Xcls_DialogNewComponent  _this;
288
289
290             // my vars (def)
291
292         // ctor
293         public Xcls_dbmodel(Xcls_DialogNewComponent _owner )
294         {
295             _this = _owner;
296             _this.dbmodel = this;
297             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
298
299             // my vars (dec)
300
301             // set gobject values
302         }
303
304         // user defined functions
305         public void loadData (Gee.ArrayList<string> data, string cur) {
306             this.el.clear();                                    
307             Gtk.TreeIter iter;
308             var el = this.el;
309             
310            /// el.append(out iter);
311             
312              
313            // el.set_value(iter, 0, "");
314            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
315         
316             el.append(out iter);
317         
318             
319             el.set_value(iter, 0, "");
320             el.set_value(iter, 1, "-- select a module --");
321             _this.build_module.el.set_active_iter(iter);
322             
323             for (var i = 0; i < data.size;i++) {
324             
325         
326                 el.append(out iter);
327                 
328                 el.set_value(iter, 0, data.get(i));
329                 el.set_value(iter, 1, data.get(i));
330                 
331                 if (data.get(i) == cur) {
332                     _this.build_module.el.set_active_iter(iter);
333                 }
334                 
335             }
336              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
337                                              
338         }
339     }
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 }