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