BrowserWindow.bjs
authorAlan Knowles <alan@roojs.com>
Thu, 25 Aug 2016 06:20:31 +0000 (14:20 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 25 Aug 2016 06:20:31 +0000 (14:20 +0800)
BrowserWindow.vala

BrowserWindow.bjs
BrowserWindow.vala

index baa1289..7ce55be 100644 (file)
@@ -10,7 +10,7 @@
   {
    "listeners" : {
     "destroy" : "() => {\n    Gtk.main_quit();\n}",
-    "show" : "() => {\n\t\n\tprint(\"resizing window\\n\");\n\tthis.el.resize(1200,500);\n\tprint(\"loading url\\n\");\n\tthis.view.el.load_uri(webkitpdf.opt_url);\n\t\n\t// if we have not finished in 25 seconds\n\t// call printit...\n\t  GLib.Timeout.add_seconds(25, () => { \n\t\t\t_this.view.printit();\n\t\t\treturn true;\n\t});\n\t\n\n}"
+    "show" : "() => {\n\t\n\tprint(\"resizing window\\n\");\n\tvar w = webkitpdf.opt_width > 0 ?  webkitpdf.opt_width  : 1200;\n\tvar h = webkitpdf.opt_height > 0 ?  webkitpdf.opt_height  :  500;\n\t\t\t\n\t\n\tthis.el.resize(w,h);\n\tprint(\"loading url\\n\");\n\tthis.view.el.load_uri(webkitpdf.opt_url);\n\t\n\t// if we have not finished in 25 seconds\n\t// call printit...\n\t  GLib.Timeout.add_seconds(25, () => { \n\t\t\t_this.view.printit();\n\t\t\treturn true;\n\t});\n\t\n\n}"
    },
    "xtype" : "Window",
    "$ xns" : "Gtk",
@@ -26,7 +26,7 @@
       {
        "listeners" : {
         "mime_type_policy_decision_requested" : "(p0, netreq, mimetype, pol ) => {\n //  print(\"resource response  %s, %s\\n\", \t webres.get_mime_type(), netres.uri);\n\tprint(\"mimetype:  %s\", mimetype);\n // netres.message.got_headers.connect(() => { \n //   print(\"GOT HEADERS?  [%s] : %s\\n\", \n\t//  netres.message.request_headers.get_content_type(null),netres.uri);\n\t//  });\n\t\n\treturn true; // default behaviour..\n  \n   \n}",
-        "resource_request_starting" : "(p0, webres, netreq ) => {\n  print(\"resource req. started %s\\n\", netreq.uri);\n   \n}",
+        "resource_request_starting" : "(p0, webres, netreq ) => {\n  print(\"resource req. started %s\\n\", netreq.uri);\n    \n}",
         "load_finished" : "( ) => {\n\t\t \n       this.printit();\n \n}"
        },
        "id" : "view",
index c44e6ec..a1ad730 100644 (file)
@@ -37,7 +37,11 @@ public class BrowserWindow : Object
         this.el.show.connect( () => {
                
                print("resizing window\n");
-               this.el.resize(1200,500);
+               var w = webkitpdf.opt_width > 0 ?  webkitpdf.opt_width  : 1200;
+               var h = webkitpdf.opt_height > 0 ?  webkitpdf.opt_height  :  500;
+                               
+               
+               this.el.resize(w,h);
                print("loading url\n");
                this.view.el.load_uri(webkitpdf.opt_url);
                
@@ -120,7 +124,7 @@ public class BrowserWindow : Object
             });
             this.el.resource_request_starting.connect( (p0, webres, netreq ) => {
               print("resource req. started %s\n", netreq.uri);
-               
+                
             });
             this.el.load_finished.connect( ( ) => {