<commit_before>/*
 
 Example use Glade and WebKit 
 Easy Navigator from Harbour
 (c)2016 <NAME>
 
*/
memvar gtk, WebKit

init procedure my_init()
public gtk := hbgi_import("Gtk")
public WebKit := hbgi_import("WebKit")
return

function Main()
  local win, glade, scroll, Web, imgmenu_quit, entry_url , btn1,btn2

  gtk:init( hb_aParams() )

  glade := gtk:Builder():New( )
  glade:add_from_file( "./navigator.ui" )

  win := glade:get_object("window1")
  win:connect('delete-event', {|| gtk:main_quit() })

  scroll := glade:get_object("scrolledwindow1")

  web := Webkit:WebView:New()
  // Put the web app into the webview
  web:load_uri("https://harbour.github.io/" )
  web:connect( "onload-event", {|| entry_url:Set_Text( web:get_uri() )} )
  scroll:add( web )

  imgmenu_quit := glade:get_object("imagemenuitem1" )
  imgmenu_quit:connect('activate', {|| gtk:main_quit() })
 
  entry_url := glade:get_object("entry1" )
  entry_url:connect('activate', {|| web:load_uri( entry_url:get_Buffer():get_text() ) } )
  
  btn1 := glade:get_object("button1" )
  btn1:connect( "clicked", {|| web:go_back() } )
  
  btn2 := glade:get_object("button2" )
  btn2:connect( "clicked", {|| web:go_forward() } )
  
  win:show_all()
  gtk:main()

return 0



<commit_msg>Reformatted navigator sample<commit_after>/*
 * Example of Glade and WebKit usage
 * Easy Navigator from Harbour
 * (c) 2016 <NAME>
*/

MEMVAR Gtk, WebKit

INIT PROCEDURE my_init()

   PUBLIC Gtk := hbgi_import( "Gtk" )
   PUBLIC WebKit := hbgi_import( "WebKit" )

   RETURN


FUNCTION Main()

   LOCAL win, glade, scroll, web, imgmenu_quit, entry_url, btn1, btn2

   Gtk:init( hb_AParams() )

   glade := Gtk:Builder:new()
   glade:add_from_file( "./navigator.ui" )

   win := glade:get_object( "window1" )
   win:connect( 'delete-event', {|| Gtk:main_quit() } )

   scroll := glade:get_object( "scrolledwindow1" )

   web := WebKit:WebView:new()

   /* Put a web app into the webview */
   web:load_uri( "https://harbour.github.io/" )
   web:connect( "onload-event", {|| entry_url:set_text( web:get_uri() ) } )
   scroll:add( web )

   imgmenu_quit := glade:get_object( "imagemenuitem1" )
   imgmenu_quit:connect( 'activate', {|| Gtk:main_quit() } )

   entry_url := glade:get_object("entry1" )
   entry_url:connect( 'activate', {|| web:load_uri( entry_url:get_buffer():get_text() ) } )

   btn1 := glade:get_object( "button1" )
   btn1:connect( "clicked", {|| web:go_back() } )

   btn2 := glade:get_object( "button2" )
   btn2:connect( "clicked", {|| web:go_forward() } )

   win:show_all()
   Gtk:main()

   RETURN 0
{'fraction_non_alphanumeric': 0.16815533980582525, 'fraction_numerical': 0.01320388349514563, 'mean_word_length': 4.389121338912134, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2925609', 'n_tokens_mistral': 1042, 'n_tokens_neox': 984, 'n_words': 188}