From 48f4485e50c79bf7c1db5f11f3631ac9e730251a Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 21 Mar 2019 12:39:10 +0800 Subject: [PATCH] NewBranch.bjs NewBranch.vala --- NewBranch.bjs | 40 +++++---- NewBranch.vala | 218 ++++++++++++++++++++++++------------------------- 2 files changed, 128 insertions(+), 130 deletions(-) diff --git a/NewBranch.bjs b/NewBranch.bjs index d37d1a9f..b78ded86 100644 --- a/NewBranch.bjs +++ b/NewBranch.bjs @@ -28,27 +28,7 @@ "xtype" : "Box", "$ pack" : "get_content_area().add", "$ xns" : "Gtk", - "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", - "items" : [ - { - "int height_request" : 500, - "id" : "scrolled_window", - "* init" : "{\n\tthis.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n", - "* pack" : "add", - "xtype" : "ScrolledWindow", - "$ xns" : "Gtk", - "bool vexpand" : true, - "items" : [ - { - "id" : "view", - "* pack" : "add", - "xtype" : "WebView", - "$ xns" : "WebKit", - "| void loadTicket" : "(string tid) {\n\tint h,w;\n\t_this.el.get_size(out w, out h);\n\t\n\tif (tid == \"\") {\n\t\t_this.scrolled_window.el.hide();\n\t\t_this.el.resize(w, 150);\n\t} else {\n\t\t_this.scrolled_window.el.show();\n\t\t_this.el.resize(w, 800);\n\t}\n\t\n\tvar rs = RooTicket.singleton();\t\t\n\tvar uri = new WebKit.URIRequest(\"https://roojs.com/admin.php/MTrack/View/\" + tid);\n\tvar hd = uri.get_http_headers();\n\tvar authCode = Base64.encode (\"%s:%s\".printf(rs.username, rs.password).data);\n\thd.append(\"Authorization\", \"Basic %s\".printf(authCode));\n\t\n\t this.el.load_request(uri);\n}\n" - } - ] - } - ] + "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL" }, { "* pack" : "add", @@ -255,6 +235,24 @@ ] } ] + }, + { + "int height_request" : 500, + "id" : "scrolled_window", + "* init" : "{\n\tthis.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n", + "* pack" : "add", + "xtype" : "ScrolledWindow", + "$ xns" : "Gtk", + "bool vexpand" : true, + "items" : [ + { + "id" : "view", + "* pack" : "add", + "xtype" : "WebView", + "$ xns" : "WebKit", + "| void loadTicket" : "(string tid) {\n\tint h,w;\n\t_this.el.get_size(out w, out h);\n\t\n\tif (tid == \"\") {\n\t\t_this.scrolled_window.el.hide();\n\t\t_this.el.resize(w, 150);\n\t} else {\n\t\t_this.scrolled_window.el.show();\n\t\t_this.el.resize(w, 800);\n\t}\n\t\n\tvar rs = RooTicket.singleton();\t\t\n\tvar uri = new WebKit.URIRequest(\"https://roojs.com/admin.php/MTrack/View/\" + tid);\n\tvar hd = uri.get_http_headers();\n\tvar authCode = Base64.encode (\"%s:%s\".printf(rs.username, rs.password).data);\n\thd.append(\"Authorization\", \"Basic %s\".printf(authCode));\n\t\n\t this.el.load_request(uri);\n}\n" + } + ] } ] }, diff --git a/NewBranch.vala b/NewBranch.vala index 78356ba5..8a3bfe72 100644 --- a/NewBranch.vala +++ b/NewBranch.vala @@ -12,8 +12,6 @@ public class NewBranch : Object } return _NewBranch; } - public Xcls_scrolled_window scrolled_window; - public Xcls_view view; public Xcls_label_select_ticket label_select_ticket; public Xcls_label_create_ticket label_create_ticket; public Xcls_label_quick_commit label_quick_commit; @@ -27,6 +25,8 @@ public class NewBranch : Object public Xcls_createbtn createbtn; public Xcls_btn_not_me btn_not_me; public Xcls_btn_closed btn_closed; + public Xcls_scrolled_window scrolled_window; + public Xcls_view view; // my vars (def) public GitRepo? repo; @@ -53,7 +53,7 @@ public class NewBranch : Object var child_0 = new Xcls_Box2( _this ); child_0.ref(); this.el.get_content_area().add ( child_0.el ); - var child_1 = new Xcls_Notebook5( _this ); + var child_1 = new Xcls_Notebook3( _this ); child_1.ref(); this.el.add ( child_1.el ); @@ -171,92 +171,12 @@ public class NewBranch : Object // my vars (dec) // set gobject values - var child_0 = new Xcls_scrolled_window( _this ); - child_0.ref(); - this.el.add ( child_0.el ); } // user defined functions } - public class Xcls_scrolled_window : Object - { - public Gtk.ScrolledWindow el; - private NewBranch _this; - - - // my vars (def) - - // ctor - public Xcls_scrolled_window(NewBranch _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 NewBranch _this; - - - // my vars (def) - - // ctor - public Xcls_view(NewBranch _owner ) - { - _this = _owner; - _this.view = this; - this.el = new WebKit.WebView(); - - // my vars (dec) - - // set gobject values - } - - // 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_Notebook5 : Object + public class Xcls_Notebook3 : Object { public Gtk.Notebook el; private NewBranch _this; @@ -265,7 +185,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Notebook5(NewBranch _owner ) + public Xcls_Notebook3(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Notebook(); @@ -280,7 +200,7 @@ public class NewBranch : Object child_1.ref(); var child_2 = new Xcls_label_quick_commit( _this ); child_2.ref(); - var child_3 = new Xcls_Box9( _this ); + var child_3 = new Xcls_Box7( _this ); child_3.ref(); this.el.append_page ( child_3.el , _this.label_select_ticket.el ); var child_4 = new Xcls_Box27( _this ); @@ -362,7 +282,7 @@ public class NewBranch : Object // user defined functions } - public class Xcls_Box9 : Object + public class Xcls_Box7 : Object { public Gtk.Box el; private NewBranch _this; @@ -371,7 +291,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Box9(NewBranch _owner ) + public Xcls_Box7(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 ); @@ -380,14 +300,17 @@ public class NewBranch : Object // set gobject values this.el.homogeneous = false; - var child_0 = new Xcls_Table10( _this ); + var child_0 = new Xcls_Table8( _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 } - public class Xcls_Table10 : Object + public class Xcls_Table8 : Object { public Gtk.Table el; private NewBranch _this; @@ -396,7 +319,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Table10(NewBranch _owner ) + public Xcls_Table8(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Table( 5, 5, true ); @@ -408,10 +331,10 @@ public class NewBranch : Object this.el.margin = 2; this.el.column_spacing = 4; this.el.vexpand = false; - var child_0 = new Xcls_Label11( _this ); + var child_0 = new Xcls_Label9( _this ); child_0.ref(); this.el.attach_defaults ( child_0.el , 0,1,0,1 ); - var child_1 = new Xcls_Label12( _this ); + var child_1 = new Xcls_Label10( _this ); child_1.ref(); this.el.attach_defaults ( child_1.el , 1,2,0,1 ); var child_2 = new Xcls_projectsel( _this ); @@ -420,10 +343,10 @@ public class NewBranch : Object var child_3 = new Xcls_ticketsel( _this ); child_3.ref(); this.el.attach_defaults ( child_3.el , 1,4,1,2 ); - var child_4 = new Xcls_Button19( _this ); + var child_4 = new Xcls_Button17( _this ); child_4.ref(); this.el.attach_defaults ( child_4.el , 4,5,1,2 ); - var child_5 = new Xcls_Label20( _this ); + var child_5 = new Xcls_Label18( _this ); child_5.ref(); this.el.attach_defaults ( child_5.el , 0,1,3,4 ); var child_6 = new Xcls_name( _this ); @@ -432,14 +355,14 @@ public class NewBranch : Object 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_Box23( _this ); + var child_8 = new Xcls_Box21( _this ); child_8.ref(); this.el.attach_defaults ( child_8.el , 0,5,2,3 ); } // user defined functions } - public class Xcls_Label11 : Object + public class Xcls_Label9 : Object { public Gtk.Label el; private NewBranch _this; @@ -448,7 +371,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Label11(NewBranch _owner ) + public Xcls_Label9(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Label( "Project" ); @@ -464,7 +387,7 @@ public class NewBranch : Object // user defined functions } - public class Xcls_Label12 : Object + public class Xcls_Label10 : Object { public Gtk.Label el; private NewBranch _this; @@ -473,7 +396,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Label12(NewBranch _owner ) + public Xcls_Label10(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Label( "Ticket" ); @@ -825,7 +748,7 @@ public class NewBranch : Object } - public class Xcls_Button19 : Object + public class Xcls_Button17 : Object { public Gtk.Button el; private NewBranch _this; @@ -834,7 +757,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Button19(NewBranch _owner ) + public Xcls_Button17(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Button(); @@ -856,7 +779,7 @@ public class NewBranch : Object // user defined functions } - public class Xcls_Label20 : Object + public class Xcls_Label18 : Object { public Gtk.Label el; private NewBranch _this; @@ -865,7 +788,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Label20(NewBranch _owner ) + public Xcls_Label18(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Label( "Use this as branch name" ); @@ -962,7 +885,7 @@ public class NewBranch : Object } } - public class Xcls_Box23 : Object + public class Xcls_Box21 : Object { public Gtk.Box el; private NewBranch _this; @@ -971,7 +894,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Box23(NewBranch _owner ) + public Xcls_Box21(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 ); @@ -985,7 +908,7 @@ public class NewBranch : Object var child_1 = new Xcls_btn_closed( _this ); child_1.ref(); this.el.add ( child_1.el ); - var child_2 = new Xcls_Label26( _this ); + var child_2 = new Xcls_Label24( _this ); child_2.ref(); this.el.add ( child_2.el ); } @@ -1053,7 +976,7 @@ public class NewBranch : Object // user defined functions } - public class Xcls_Label26 : Object + public class Xcls_Label24 : Object { public Gtk.Label el; private NewBranch _this; @@ -1062,7 +985,7 @@ public class NewBranch : Object // my vars (def) // ctor - public Xcls_Label26(NewBranch _owner ) + public Xcls_Label24(NewBranch _owner ) { _this = _owner; this.el = new Gtk.Label( "Refresh Ticket list" ); @@ -1092,6 +1015,83 @@ public class NewBranch : Object + public class Xcls_scrolled_window : Object + { + public Gtk.ScrolledWindow el; + private NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_scrolled_window(NewBranch _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 NewBranch _this; + + + // my vars (def) + + // ctor + public Xcls_view(NewBranch _owner ) + { + _this = _owner; + _this.view = this; + this.el = new WebKit.WebView(); + + // my vars (dec) + + // set gobject values + } + + // 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_Box27 : Object { -- 2.39.2