Eliminate debug warnings when using WebGadget in Linux

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Eliminate debug warnings when using WebGadget in Linux

Post by Shardik »

When using the WebGadget in Linux, these annoying debug warnings are always displayed in the error log several times in succession and one of them even in the status line:
PB error log wrote:[18:28:05] [WARNING] Zeile: 5
[18:28:05] [WARNING] DEBUG: NP_initialize
[18:28:05] [WARNING] Zeile: 5
[18:28:05] [WARNING] DEBUG: NP_initialize succeeded
[18:28:05] [WARNING] Zeile: 5
This simple example code demonstrates it:

Code: Select all

OpenWindow(0, 200, 100, 600, 300, "WebGadget")
WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com")

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
In this thread I already posted the following possible solution which disables the embedding of scripts in WebKit thus eliminating the annoying warnings.

Code: Select all

#G_TYPE_INT = 6 << 2

ImportC "-lwebkitgtk-1.0"
  webkit_web_settings_new()
  webkit_web_view_set_settings(*WebkitWebView, *WebkitSettings)
EndImport

Define Value.GValue

OpenWindow(0, 200, 100, 600, 300, "WebGadget")
WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com")

; ----- Get current webkit settings
WebkitSettings = webkit_web_settings_new()

; ----- Disable embedding of scripting languages
Value\g_type = #G_TYPE_INT
g_value_set_int_(Value, 0)
g_object_set_property_(WebkitSettings, "enable-scripts", @Value)

; ----- Store changed settings
webkit_web_view_set_settings(GadgetID(0), WebkitSettings)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Therefore it would be nice to have this or a similar solution been implemented in PureBasic natively.
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Eliminate debug warnings when using WebGadget in Linux

Post by Little John »

Eliminate debug warnings when using WebGadget in Linux
+1
Post Reply