NewBranch.bjs
[gitlive] / NewBranch.vala
1 static NewBranch  _NewBranch;
2
3 public class NewBranch : Object
4 {
5     public Gtk.Dialog el;
6     private NewBranch  _this;
7
8     public static NewBranch singleton()
9     {
10         if (_NewBranch == null) {
11             _NewBranch= new NewBranch();
12         }
13         return _NewBranch;
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 NewBranch()
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                  GLib.debug("got %d", (int) response_id);
55         });
56         this.el.show.connect( (self)  => {
57           this.el.run();
58           //test
59         });
60     }
61
62     // user defined functions
63     public   void show ( ) 
64     {
65         
66         this.el.show_all();
67           
68     }
69     public class Xcls_VBox2 : Object
70     {
71         public Gtk.VBox el;
72         private NewBranch  _this;
73
74
75             // my vars (def)
76
77         // ctor
78         public Xcls_VBox2(NewBranch _owner )
79         {
80             _this = _owner;
81             this.el = new Gtk.VBox( true, 0 );
82
83             // my vars (dec)
84
85             // set gobject values
86             var child_0 = new Xcls_Table3( _this );
87             child_0.ref();
88             this.el.pack_start (  child_0.el , false,false,0 );
89         }
90
91         // user defined functions
92     }
93     public class Xcls_Table3 : Object
94     {
95         public Gtk.Table el;
96         private NewBranch  _this;
97
98
99             // my vars (def)
100
101         // ctor
102         public Xcls_Table3(NewBranch _owner )
103         {
104             _this = _owner;
105             this.el = new Gtk.Table( 2, 2, true );
106
107             // my vars (dec)
108
109             // set gobject values
110             var child_0 = new Xcls_Label4( _this );
111             child_0.ref();
112             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
113             var child_1 = new Xcls_build_module( _this );
114             child_1.ref();
115             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
116             var child_2 = new Xcls_Label8( _this );
117             child_2.ref();
118             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
119             var child_3 = new Xcls_name( _this );
120             child_3.ref();
121             this.el.attach_defaults (  child_3.el , 1,2,1,2 );
122         }
123
124         // user defined functions
125     }
126     public class Xcls_Label4 : Object
127     {
128         public Gtk.Label el;
129         private NewBranch  _this;
130
131
132             // my vars (def)
133
134         // ctor
135         public Xcls_Label4(NewBranch _owner )
136         {
137             _this = _owner;
138             this.el = new Gtk.Label( "Select Ticket" );
139
140             // my vars (dec)
141
142             // set gobject values
143             this.el.justify = Gtk.Justification.RIGHT;
144             this.el.xalign = 0.900000f;
145             this.el.visible = true;
146         }
147
148         // user defined functions
149     }
150
151     public class Xcls_build_module : Object
152     {
153         public Gtk.ComboBox el;
154         private NewBranch  _this;
155
156
157             // my vars (def)
158
159         // ctor
160         public Xcls_build_module(NewBranch _owner )
161         {
162             _this = _owner;
163             _this.build_module = this;
164             this.el = new Gtk.ComboBox();
165
166             // my vars (dec)
167
168             // set gobject values
169             var child_0 = new Xcls_dbcellrenderer( _this );
170             child_0.ref();
171             this.el.pack_start (  child_0.el , true );
172             var child_1 = new Xcls_dbmodel( _this );
173             child_1.ref();
174             this.el.set_model (  child_1.el  );
175
176             // init method
177
178             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
179         }
180
181         // user defined functions
182     }
183     public class Xcls_dbcellrenderer : Object
184     {
185         public Gtk.CellRendererText el;
186         private NewBranch  _this;
187
188
189             // my vars (def)
190
191         // ctor
192         public Xcls_dbcellrenderer(NewBranch _owner )
193         {
194             _this = _owner;
195             _this.dbcellrenderer = this;
196             this.el = new Gtk.CellRendererText();
197
198             // my vars (dec)
199
200             // set gobject values
201         }
202
203         // user defined functions
204     }
205
206     public class Xcls_dbmodel : Object
207     {
208         public Gtk.ListStore el;
209         private NewBranch  _this;
210
211
212             // my vars (def)
213
214         // ctor
215         public Xcls_dbmodel(NewBranch _owner )
216         {
217             _this = _owner;
218             _this.dbmodel = this;
219             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
220
221             // my vars (dec)
222
223             // set gobject values
224         }
225
226         // user defined functions
227         public void loadData (Gee.ArrayList<string> data, string cur) {
228             this.el.clear();                                    
229             Gtk.TreeIter iter;
230             var el = this.el;
231             
232            /// el.append(out iter);
233             
234              
235            // el.set_value(iter, 0, "");
236            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
237         
238             el.append(out iter);
239         
240             
241             el.set_value(iter, 0, "");
242             el.set_value(iter, 1, "-- select a module --");
243             _this.build_module.el.set_active_iter(iter);
244             
245             for (var i = 0; i < data.size;i++) {
246             
247         
248                 el.append(out iter);
249                 
250                 el.set_value(iter, 0, data.get(i));
251                 el.set_value(iter, 1, data.get(i));
252                 
253                 if (data.get(i) == cur) {
254                     _this.build_module.el.set_active_iter(iter);
255                 }
256                 
257             }
258              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
259                                              
260         }
261     }
262
263
264     public class Xcls_Label8 : Object
265     {
266         public Gtk.Label el;
267         private NewBranch  _this;
268
269
270             // my vars (def)
271
272         // ctor
273         public Xcls_Label8(NewBranch _owner )
274         {
275             _this = _owner;
276             this.el = new Gtk.Label( "or use this as branch name" );
277
278             // my vars (dec)
279
280             // set gobject values
281             this.el.justify = Gtk.Justification.RIGHT;
282             this.el.xalign = 0.900000f;
283         }
284
285         // user defined functions
286     }
287
288     public class Xcls_name : Object
289     {
290         public Gtk.Entry el;
291         private NewBranch  _this;
292
293
294             // my vars (def)
295
296         // ctor
297         public Xcls_name(NewBranch _owner )
298         {
299             _this = _owner;
300             _this.name = this;
301             this.el = new Gtk.Entry();
302
303             // my vars (dec)
304
305             // set gobject values
306             this.el.visible = true;
307         }
308
309         // user defined functions
310     }
311
312
313
314     public class Xcls_Button10 : Object
315     {
316         public Gtk.Button el;
317         private NewBranch  _this;
318
319
320             // my vars (def)
321
322         // ctor
323         public Xcls_Button10(NewBranch _owner )
324         {
325             _this = _owner;
326             this.el = new Gtk.Button();
327
328             // my vars (dec)
329
330             // set gobject values
331             this.el.relief = Gtk.ReliefStyle.NONE;
332             this.el.label = "Do not create Branch";
333         }
334
335         // user defined functions
336     }
337
338     public class Xcls_Button11 : Object
339     {
340         public Gtk.Button el;
341         private NewBranch  _this;
342
343
344             // my vars (def)
345
346         // ctor
347         public Xcls_Button11(NewBranch _owner )
348         {
349             _this = _owner;
350             this.el = new Gtk.Button();
351
352             // my vars (dec)
353
354             // set gobject values
355             this.el.label = "Create Branch";
356         }
357
358         // user defined functions
359     }
360
361 }