X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=NewBranch.vala;fp=NewBranch.vala;h=fbf036ddfc3c091b0f61f3ccf22dc2860518676a;hp=bd6fedd2a5612630f0148228833eb03ac34d83fe;hb=62bcbeee7e77f9f8774f13569dc9fb5cc25666d6;hpb=3ca10752a9d585c7d1f731322f9e1174493cc9e0 diff --git a/NewBranch.vala b/NewBranch.vala index bd6fedd2..fbf036dd 100644 --- a/NewBranch.vala +++ b/NewBranch.vala @@ -19,6 +19,7 @@ public class NewBranch : Object public Xcls_dbcellrenderer dbcellrenderer; public Xcls_dbmodel dbmodel; public Xcls_name name; + public Xcls_createbtn createbtn; public Xcls_btn_not_me btn_not_me; public Xcls_btn_closed btn_closed; public Xcls_scrolled_window scrolled_window; @@ -133,6 +134,8 @@ public class NewBranch : Object _this.prmodel.loadProjects(curproj == null ? "" : curproj.id); _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid); + _this.createbtn.updateState(); + _this.ticketsel.el.get_child().get_style_context().remove_class("warning"); if (tid != "") { var name = RooTicket.singleton().usernameLocal(); @@ -214,7 +217,7 @@ public class NewBranch : Object var child_6 = new Xcls_name( _this ); child_6.ref(); this.el.attach_defaults ( child_6.el , 0,4,4,5 ); - var child_7 = new Xcls_Button15( _this ); + var child_7 = new Xcls_createbtn( _this ); child_7.ref(); this.el.attach_defaults ( child_7.el , 4,5,4,5 ); var child_8 = new Xcls_Box16( _this ); @@ -486,7 +489,7 @@ public class NewBranch : Object _this.view.loadTicket(""); this.el.get_child().get_style_context().add_class("warning"); - + _this.createbtn.updateState(); return; } @@ -497,6 +500,8 @@ public class NewBranch : Object _this.scrolled_window.el.show(); _this.view.loadTicket(ticket.id); + _this.createbtn.updateState(); + //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2); }); } @@ -688,7 +693,7 @@ public class NewBranch : Object // user defined functions } - public class Xcls_Button15 : Object + public class Xcls_createbtn : Object { public Gtk.Button el; private NewBranch _this; @@ -697,9 +702,10 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Button15(NewBranch _owner ) + public Xcls_createbtn(NewBranch _owner ) { _this = _owner; + _this.createbtn = this; this.el = new Gtk.Button(); // my vars (dec) @@ -730,6 +736,18 @@ public class NewBranch : Object } // user defined functions + public void updateState () { + + var ticket_id = _this.ticketsel.selectedTicketId(); + + if (ticket_id == "") { + this.el.set_sensitive(false); + return; + } + + this.el.set_sensitive(true); + + } } public class Xcls_Box16 : Object