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");
208 var ticket = RooTicket.singleton().getById(ticket_id);
210 _this.name.el.set_text("wip_NAME_T%s_%s".printf(ticket.id, ticket.summaryToBranchName());
212 //GLib.debug ("Selection: %s, %s\n", (string) val1, (string) val2);
216 // user defined functions
218 public class Xcls_dbcellrenderer : Object
220 public Gtk.CellRendererText el;
221 private NewBranch _this;
227 public Xcls_dbcellrenderer(NewBranch _owner )
230 _this.dbcellrenderer = this;
231 this.el = new Gtk.CellRendererText();
235 // set gobject values
238 // user defined functions
241 public class Xcls_dbmodel : Object
243 public Gtk.ListStore el;
244 private NewBranch _this;
250 public Xcls_dbmodel(NewBranch _owner )
253 _this.dbmodel = this;
254 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
258 // set gobject values
261 // user defined functions
262 public void loadTickets () {
264 RooTicket.singleton().loadTickets();
275 el.set_value(iter, 0, "");
276 el.set_value(iter, 1, "-- select a ticket --");
278 _this.build_module.el.set_active_iter(iter);
279 var tickets = RooTicket.singleton().tickets;
280 foreach(var ticket in tickets) {
285 el.set_value(iter, 0, ticket.id);
286 el.set_value(iter, 1, "#%s [%s] %s".printf( ticket.id, ticket.project_id_name , ticket.summary));
288 //if (data.get(i) == cur) {
289 // _this.build_module.el.set_active_iter(iter);
293 //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);
299 public class Xcls_Label8 : Object
302 private NewBranch _this;
308 public Xcls_Label8(NewBranch _owner )
311 this.el = new Gtk.Label( "or use this as branch name" );
315 // set gobject values
316 this.el.justify = Gtk.Justification.RIGHT;
317 this.el.xalign = 0.900000f;
320 // user defined functions
323 public class Xcls_name : Object
326 private NewBranch _this;
332 public Xcls_name(NewBranch _owner )
336 this.el = new Gtk.Entry();
340 // set gobject values
341 this.el.visible = true;
344 // user defined functions
349 public class Xcls_Button10 : Object
351 public Gtk.Button el;
352 private NewBranch _this;
358 public Xcls_Button10(NewBranch _owner )
361 this.el = new Gtk.Button();
365 // set gobject values
366 this.el.relief = Gtk.ReliefStyle.NONE;
367 this.el.label = "Do not create Branch";
370 // user defined functions
373 public class Xcls_Button11 : Object
375 public Gtk.Button el;
376 private NewBranch _this;
382 public Xcls_Button11(NewBranch _owner )
385 this.el = new Gtk.Button();
389 // set gobject values
390 this.el.label = "Create Branch";
393 // user defined functions