X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=MergeBranch.vala;h=90a65b36deb482ff822d3eedafcb7f8430e3015d;hp=737dab4e8b0141a06b2f8fa6946db8e44d455b82;hb=01e7beaf18d9aca3c2c2ad6f60c4b183aa177888;hpb=40164da7a92a6e13d048decbd397988c04e37c42 diff --git a/MergeBranch.vala b/MergeBranch.vala index 737dab4e..90a65b36 100644 --- a/MergeBranch.vala +++ b/MergeBranch.vala @@ -19,6 +19,8 @@ public class MergeBranch : Object public Xcls_dbcellrenderer dbcellrenderer; public Xcls_dbmodel dbmodel; public Xcls_name name; + public Xcls_scrolled_window scrolled_window; + public Xcls_view view; // my vars (def) public GitRepo repo; @@ -41,13 +43,13 @@ public class MergeBranch : Object this.el.default_width = 500; this.el.deletable = true; this.el.modal = true; - var child_0 = new Xcls_VBox2( _this ); + var child_0 = new Xcls_Box2( _this ); child_0.ref(); this.el.get_content_area().add ( child_0.el ); - var child_1 = new Xcls_Button14( _this ); + var child_1 = new Xcls_Button16( _this ); child_1.ref(); this.el.add_action_widget ( child_1.el , 0 ); - var child_2 = new Xcls_Button15( _this ); + var child_2 = new Xcls_Button17( _this ); child_2.ref(); this.el.add_action_widget ( child_2.el , 1 ); @@ -134,22 +136,22 @@ public class MergeBranch : Object this.el.show_all(); _this.dbmodel.loadTickets(); _this.actionmodel.loadActions(); - + _this.view.loadTicket(ticket.id); } - public class Xcls_VBox2 : Object + public class Xcls_Box2 : Object { - public Gtk.VBox el; + public Gtk.Box el; private MergeBranch _this; // my vars (def) // ctor - public Xcls_VBox2(MergeBranch _owner ) + public Xcls_Box2(MergeBranch _owner ) { _this = _owner; - this.el = new Gtk.VBox( true, 0 ); + this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 ); // my vars (dec) @@ -157,6 +159,9 @@ public class MergeBranch : Object var child_0 = new Xcls_Table3( _this ); child_0.ref(); this.el.pack_start ( child_0.el , false,false,0 ); + var child_1 = new Xcls_scrolled_window( _this ); + child_1.ref(); + this.el.add ( child_1.el ); } // user defined functions @@ -180,6 +185,7 @@ public class MergeBranch : Object // set gobject values this.el.margin = 2; this.el.column_spacing = 2; + this.el.vexpand = false; var child_0 = new Xcls_Label4( _this ); child_0.ref(); this.el.attach_defaults ( child_0.el , 0,1,0,1 ); @@ -409,7 +415,7 @@ public class MergeBranch : Object this.el = new Gtk.ComboBox(); // my vars (dec) - this.loading = false; + this.loading = true; // set gobject values var child_0 = new Xcls_dbcellrenderer( _this ); @@ -428,7 +434,7 @@ public class MergeBranch : Object if (this.loading) { return; } - + _this.view.loadTicket(this.selectedTicketId()); _this.name.updateText(); //_this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName())); @@ -622,8 +628,83 @@ public class MergeBranch : Object } + public class Xcls_scrolled_window : Object + { + public Gtk.ScrolledWindow el; + private MergeBranch _this; + + + // my vars (def) + + // ctor + public Xcls_scrolled_window(MergeBranch _owner ) + { + _this = _owner; + _this.scrolled_window = this; + this.el = new Gtk.ScrolledWindow( null, null ); + + // my vars (dec) + + // set gobject values + this.el.height_request = 500; + this.el.vexpand = true; + var child_0 = new Xcls_view( _this ); + child_0.ref(); + this.el.add ( child_0.el ); + + // init method + + { + this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC); + } + } + + // user defined functions + } + public class Xcls_view : Object + { + public WebKit.WebView el; + private MergeBranch _this; + + + // my vars (def) + + // ctor + public Xcls_view(MergeBranch _owner ) + { + _this = _owner; + _this.view = this; + this.el = new WebKit.WebView(); + + // my vars (dec) + } + + // user defined functions + public void loadTicket (string tid) { + int h,w; + _this.el.get_size(out w, out h); + + if (tid == "") { + _this.scrolled_window.el.hide(); + _this.el.resize(w, 150); + } else { + _this.scrolled_window.el.show(); + _this.el.resize(w, 800); + } + + var rs = RooTicket.singleton(); + var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid); + var hd = uri.get_http_headers(); + var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data); + hd.append("Authorization", "Basic %s".printf(authCode)); + + this.el.load_request(uri); + } + } + + - public class Xcls_Button14 : Object + public class Xcls_Button16 : Object { public Gtk.Button el; private MergeBranch _this; @@ -632,7 +713,7 @@ public class MergeBranch : Object // my vars (def) // ctor - public Xcls_Button14(MergeBranch _owner ) + public Xcls_Button16(MergeBranch _owner ) { _this = _owner; this.el = new Gtk.Button(); @@ -647,7 +728,7 @@ public class MergeBranch : Object // user defined functions } - public class Xcls_Button15 : Object + public class Xcls_Button17 : Object { public Gtk.Button el; private MergeBranch _this; @@ -656,7 +737,7 @@ public class MergeBranch : Object // my vars (def) // ctor - public Xcls_Button15(MergeBranch _owner ) + public Xcls_Button17(MergeBranch _owner ) { _this = _owner; this.el = new Gtk.Button();