1 static NewBranch _NewBranch;
3 public class NewBranch : Object
6 private NewBranch _this;
8 public static NewBranch singleton()
10 if (_NewBranch == null) {
11 _NewBranch= new NewBranch();
15 public Xcls_build_module build_module;
16 public Xcls_dbcellrenderer dbcellrenderer;
17 public Xcls_dbmodel dbmodel;
18 public Xcls_name name;
26 this.el = new Gtk.Dialog();
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;
36 var child_0 = new Xcls_VBox2( _this );
38 this.el.get_content_area().add ( child_0.el );
39 var child_1 = new Xcls_Button10( _this );
41 this.el.add_action_widget ( child_1.el , 0 );
42 var child_2 = new Xcls_Button11( _this );
44 this.el.add_action_widget ( child_2.el , 1 );
47 this.el.delete_event.connect( (self, event) => {
52 this.el.response.connect( (self, response_id) => {
54 GLib.debug("got %d", (int) response_id);
56 this.el.show.connect( (self) => {
63 // user defined functions
66 // this.el.set_gravity(Gdk.Gravity.NORTH);
68 this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
69 GLib.debug("Loading tickets");
70 _this.dbmodel.loadTickets();
79 public class Xcls_VBox2 : Object
82 private NewBranch _this;
88 public Xcls_VBox2(NewBranch _owner )
91 this.el = new Gtk.VBox( true, 0 );
96 var child_0 = new Xcls_Table3( _this );
98 this.el.pack_start ( child_0.el , false,false,0 );
101 // user defined functions
103 public class Xcls_Table3 : Object
106 private NewBranch _this;
112 public Xcls_Table3(NewBranch _owner )
115 this.el = new Gtk.Table( 2, 2, false );
119 // set gobject values
121 this.el.column_spacing = 2;
122 var child_0 = new Xcls_Label4( _this );
124 this.el.attach_defaults ( child_0.el , 0,1,0,1 );
125 var child_1 = new Xcls_build_module( _this );
127 this.el.attach_defaults ( child_1.el , 1,2,0,1 );
128 var child_2 = new Xcls_Label8( _this );
130 this.el.attach_defaults ( child_2.el , 0,1,1,2 );
131 var child_3 = new Xcls_name( _this );
133 this.el.attach_defaults ( child_3.el , 1,2,1,2 );
136 // user defined functions
138 public class Xcls_Label4 : Object
141 private NewBranch _this;
147 public Xcls_Label4(NewBranch _owner )
150 this.el = new Gtk.Label( "Select Ticket" );
154 // set gobject values
155 this.el.justify = Gtk.Justification.RIGHT;
156 this.el.xalign = 0.900000f;
157 this.el.visible = true;
160 // user defined functions
163 public class Xcls_build_module : Object
165 public Gtk.ComboBox el;
166 private NewBranch _this;
172 public Xcls_build_module(NewBranch _owner )
175 _this.build_module = this;
176 this.el = new Gtk.ComboBox();
180 // set gobject values
181 var child_0 = new Xcls_dbcellrenderer( _this );
183 this.el.pack_start ( child_0.el , true );
184 var child_1 = new Xcls_dbmodel( _this );
186 this.el.set_model ( child_1.el );
190 this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
193 this.el.changed.connect( () => {
198 this.el.get_active_iter (out iter);
199 _this.dbmodel.el.get_value (iter, 0, out val1);
200 _this.dbmodel.el.get_value (iter, 1, out val2);
202 var ticket_id = (string) val1;
204 if (ticket_id == "") {
205 _this.name.el.set_text("wip_NAME_DATE");
209 var ticket = RooTicket.singleton().getById(ticket_id);
211 _this.name.el.set_text("wip_NAME_T%s_%s".printf(ticket.id, ticket.summaryToBranchName()));
213 //GLib.debug ("Selection: %s, %s\n", (string) val1, (string) val2);
217 // user defined functions
219 public class Xcls_dbcellrenderer : Object
221 public Gtk.CellRendererText el;
222 private NewBranch _this;
228 public Xcls_dbcellrenderer(NewBranch _owner )
231 _this.dbcellrenderer = this;
232 this.el = new Gtk.CellRendererText();
236 // set gobject values
239 // user defined functions
242 public class Xcls_dbmodel : Object
244 public Gtk.ListStore el;
245 private NewBranch _this;
251 public Xcls_dbmodel(NewBranch _owner )
254 _this.dbmodel = this;
255 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
259 // set gobject values
262 // user defined functions
263 public void loadTickets () {
265 RooTicket.singleton().loadTickets();
276 el.set_value(iter, 0, "");
277 el.set_value(iter, 1, "-- select a ticket --");
279 _this.build_module.el.set_active_iter(iter);
280 var tickets = RooTicket.singleton().tickets;
281 foreach(var ticket in tickets) {
286 el.set_value(iter, 0, ticket.id);
287 el.set_value(iter, 1, "#%s [%s] %s".printf( ticket.id, ticket.project_id_name , ticket.summary));
289 //if (data.get(i) == cur) {
290 // _this.build_module.el.set_active_iter(iter);
294 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
300 public class Xcls_Label8 : Object
303 private NewBranch _this;
309 public Xcls_Label8(NewBranch _owner )
312 this.el = new Gtk.Label( "or use this as branch name" );
316 // set gobject values
317 this.el.justify = Gtk.Justification.RIGHT;
318 this.el.xalign = 0.900000f;
321 // user defined functions
324 public class Xcls_name : Object
327 private NewBranch _this;
333 public Xcls_name(NewBranch _owner )
337 this.el = new Gtk.Entry();
341 // set gobject values
342 this.el.visible = true;
345 // user defined functions
350 public class Xcls_Button10 : Object
352 public Gtk.Button el;
353 private NewBranch _this;
359 public Xcls_Button10(NewBranch _owner )
362 this.el = new Gtk.Button();
366 // set gobject values
367 this.el.relief = Gtk.ReliefStyle.NONE;
368 this.el.label = "Do not create Branch";
371 // user defined functions
374 public class Xcls_Button11 : Object
376 public Gtk.Button el;
377 private NewBranch _this;
383 public Xcls_Button11(NewBranch _owner )
386 this.el = new Gtk.Button();
390 // set gobject values
391 this.el.label = "Create Branch";
394 // user defined functions