X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=NewBranch.vala;h=e65ba333437f03a15e921e9d2482ad731eb78543;hb=a0ec8a45c3f658481ca0862e52c737efbc6bd79f;hp=2c63d36308f4fa6c6e1c1feb500244c45a8659b4;hpb=1628ba8434d43f38e970a9b5228909559a1c9da4;p=gitlive diff --git a/NewBranch.vala b/NewBranch.vala index 2c63d363..e65ba333 100644 --- a/NewBranch.vala +++ b/NewBranch.vala @@ -51,7 +51,26 @@ public class NewBranch : Object }); this.el.response.connect( (self, response_id) => { - GLib.debug("got %d", (int) response_id); + GLib.debug("got %d", (int) response_id); + if (response_id == 0) { + _this.el.hide(); + return; + } + // have they selected a ticket.. + // make that the current active ticket? + // we really need to store locally what ticket is being worked on.. + // in theory we could be working on multiple project and not merging.. + // -- each repo would have their active ticket (only one per repo) + // -- so we could just store that in there + // -- initial load can check the contents of the ticket files on first scan. + + + + + + + + }); this.el.show.connect( (self) => { @@ -64,7 +83,15 @@ public class NewBranch : Object public void show ( ) { // this.el.set_gravity(Gdk.Gravity.NORTH); - + + this.el.move((Gdk.Screen.width() / 2)- 250 ,0); + GLib.debug("Loading tickets"); + _this.dbmodel.loadTickets(); + + this.el.show_all(); + + + } @@ -104,11 +131,13 @@ public class NewBranch : Object public Xcls_Table3(NewBranch _owner ) { _this = _owner; - this.el = new Gtk.Table( 2, 2, true ); + this.el = new Gtk.Table( 2, 2, false ); // my vars (dec) // set gobject values + this.el.margin = 2; + this.el.column_spacing = 2; var child_0 = new Xcls_Label4( _this ); child_0.ref(); this.el.attach_defaults ( child_0.el , 0,1,0,1 ); @@ -178,6 +207,34 @@ public class NewBranch : Object // init method this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 ); + + //listeners + this.el.changed.connect( () => { + Gtk.TreeIter iter; + Value val1; + Value val2; + + this.el.get_active_iter (out iter); + _this.dbmodel.el.get_value (iter, 0, out val1); + _this.dbmodel.el.get_value (iter, 1, out val2); + + var ticket_id = (string) val1; + + var name = RooTicket.singleton().usernameLocal(); + + if (ticket_id == "") { + + var dt = new DateTime.now_local(); + _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d"))); + return; + } + + var ticket = RooTicket.singleton().getById(ticket_id); + + _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName())); + + //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2); + }); } // user defined functions @@ -250,7 +307,7 @@ public class NewBranch : Object el.append(out iter); el.set_value(iter, 0, ticket.id); - el.set_value(iter, 1, "#%s %s %s".printf( ticket.id, ticket.project_id_name , ticket.summary)); + el.set_value(iter, 1, "#%s [%s] %s".printf( ticket.id, ticket.project_id_name , ticket.summary)); //if (data.get(i) == cur) { // _this.build_module.el.set_active_iter(iter);