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