Sha256: b88fcf71f0ae213b231a3caa916bd16597bacdf4e93d66174385e82af87d1dd6

Contents?: true

Size: 432 Bytes

Versions: 11

Compression:

Stored size: 432 Bytes

Contents

require 'gir_ffi-gtk3'

GirFFI.setup :WebKit2, '4.0'

Gtk.init

win = Gtk::OffscreenWindow.new
web_view = WebKit2::WebView.new
win.add(web_view)

web_view.signal_connect "load-changed" do |_, event, _|
  case event
  when :finished
    pixbuf = win.get_pixbuf
    pixbuf.savev("google.png", "png", nil, nil)
    puts web_view.get_title
    Gtk.main_quit
  end
end

web_view.load_uri('http://www.google.com/')
win.show_all

Gtk.main

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gir_ffi-gtk-0.15.0 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.14.1 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.14.0 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.13.1 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.13.0 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.12.1 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.12.0 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.11.0 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.10.0 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.9.0 examples/09_webkit2_headless.rb
gir_ffi-gtk-0.8.1 examples/09_webkit2_headless.rb