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