X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=NewBranch.vala;h=7ae10955ef74c7d52f93abec8cda2de69814f6a7;hb=a8eba3b5da2fd762cfaddf95ba0da1d6a5375816;hp=9183007d95db9aaf6b0aa7bc05aa389bfbee4d76;hpb=4879313d9a4fffaa84198dc31c5aba384614bc15;p=gitlive diff --git a/NewBranch.vala b/NewBranch.vala index 9183007d..7ae10955 100644 --- a/NewBranch.vala +++ b/NewBranch.vala @@ -59,11 +59,9 @@ public class NewBranch : Object this.el.response.connect( (self, response_id) => { GLib.debug("got %d", (int) response_id); - if (response_id < 1) { - _this.el.hide(); - this.running = false; - return; - } + + + // have they selected a ticket.. // make that the current active ticket? @@ -72,6 +70,14 @@ public class NewBranch : Object // -- 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. + + + if (response_id < 1) { + _this.el.hide(); + this.running = false; + return; + } + var ticket_id = _this.ticketsel.selectedTicketId(); if (this.repo != null) { @@ -86,7 +92,7 @@ public class NewBranch : Object } } - + this.running = false; @@ -123,17 +129,19 @@ public class NewBranch : Object this.el.set_keep_above(true); - var curproj = RooTicket.singleton().getProjectByRepo(this.repo); + var curproj = RooProject.getProjectByRepo(this.repo); _this.prmodel.loadProjects(curproj == null ? "" : curproj.id); _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid); - - if (tid != "") { + _this.createbtn.updateState(); + + _this.ticketsel.el.get_child().get_style_context().remove_class("warning"); + if (tid != "") { var name = RooTicket.singleton().usernameLocal(); var ticket = RooTicket.singleton().getById(tid); _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName())); - - + } else { + _this.ticketsel.el.get_child().get_style_context().add_class("warning"); } _this.view.loadTicket(tid); this.el.run(); @@ -394,8 +402,7 @@ public class NewBranch : Object // user defined functions public void loadProjects (string id) { - var rt = RooTicket.singleton(); - rt.loadProjects(); + _this.projectsel.loading = true; @@ -411,8 +418,8 @@ public class NewBranch : Object if (id == "") { _this.projectsel.el.set_active_iter(iter); } - var projects = rt.projects; - foreach(var project in projects) { + + foreach(var project in RooProject.projects()) { el.append(out iter); @@ -462,6 +469,7 @@ public class NewBranch : Object //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 ); this.el.set_entry_text_column(1); + this.el.get_child().set_sensitive(false); //listeners this.el.changed.connect( () => { @@ -472,11 +480,15 @@ public class NewBranch : Object var name = RooTicket.singleton().usernameLocal(); + this.el.get_child().get_style_context().remove_class("warning"); if (ticket_id == "" || ticket_id == null) { var dt = new DateTime.now_local(); _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d"))); _this.view.loadTicket(""); + + this.el.get_child().get_style_context().add_class("warning"); + return; } @@ -583,7 +595,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".printf( ticket.id, ticket.summary)); if (ticket.id == tid) { _this.ticketsel.el.set_active_iter(iter); @@ -705,7 +717,16 @@ public class NewBranch : Object //listeners this.el.clicked.connect( () => { + GLib.debug("fire response = 1"); + + var ticket_id = _this.ticketsel.selectedTicketId(); + + if (ticket_id == "") { + _this.ticketsel.el.get_child().get_style_context().add_class("warning"); + return; + } + _this.el.response(1); }); } @@ -828,7 +849,8 @@ public class NewBranch : Object //listeners this.el.activate_link.connect( (uri) => { if (uri == "refresh") { - var curproj = RooTicket.singleton().getProjectByRepo(_this.repo); + RooProject.reload(); + var curproj = RooProject.getProjectByRepo(_this.repo); _this.prmodel.loadProjects(curproj == null ? "": curproj.id); _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);