# Gtk-webkit-ruby gem

**URL:** <https://www.ruby-forum.com/t/gtk-webkit-ruby-gem/225705>\
**Category:** Ruby-Gnome 2\
**Created:** [January 24, 2013, 4:12pm UTC](https://www.ruby-forum.com/t/gtk-webkit-ruby-gem/225705 "2013-01-24T16:12:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [January 24, 2013, 4:12pm UTC](https://www.ruby-forum.com/t/gtk-webkit-ruby-gem/225705/1 "2013-01-24T16:12:02Z")

</div>

Hi,

Some of you may have come across it already, but I don’t think I’ve  
ever officially announced the gtk-webkit-ruby gem.

It’s on github: [GitHub - geoffyoungs/gtk-webkit-ruby: Ruby-GNOME2 compatible bindings for Gtk Webkit](http://github.com/geoffyoungs/gtk-webkit-ruby)

I threw some bindings together for a project at work, but haven’t  
really had the time to properly release it or complete the API  
coverage (it wraps some of the more useful stuff from the webkit  
widget and has some JavaScriptCore bindings for direct Ruby\<=\>JS  
calls).

Would anyone like to see it fixed up and added to the ruby-gnome2  
project, or would it make more strategic sense to leave it out and  
focus on gobject introspection as a more sustainable way to support  
such libraries in future? Any thoughts?

TTFN,

## Geoff.

Random Musing - [http://www.frafferz.com/](http://www.frafferz.com/)  
Geek Blog - [http://geoffyoungs.github.com/](http://geoffyoungs.github.com/)

---

<div class="post-metadata">

**Author:** ![Geoff\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ac91a4/32.png) [@Geoff\_Y](https://www.ruby-forum.com/u/Geoff_Y)\
**Post date:** [January 26, 2013, 1:41am UTC](https://www.ruby-forum.com/t/gtk-webkit-ruby-gem/225705/2 "2013-01-26T01:41:04Z")

</div>

Hi,

In [CAPuFfEen+XFDbOtE+YOAW3vDRF+F5T+fAuWcLkoQ+K7Dt=removed\_email\_address@domain.invalid](mailto:CAPuFfEen+XFDbOtE+YOAW3vDRF+F5T+fAuWcLkoQ+K7Dt=removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] gtk-webkit-ruby gem” on Thu, 24 Jan 2013  
15:11:15 +0000,  
Geoff Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Some of you may have come across it already, but I don’t think I’ve  
> ever officially announced the gtk-webkit-ruby gem.
> 
> It’s on github: [GitHub - geoffyoungs/gtk-webkit-ruby: Ruby-GNOME2 compatible bindings for Gtk Webkit · GitHub](http://github.com/geoffyoungs/gtk-webkit-ruby)  
> …  
> Would anyone like to see it fixed up and added to the ruby-gnome2  
> project, or would it make more strategic sense to leave it out and  
> focus on gobject introspection as a more sustainable way to support  
> such libraries in future? Any thoughts?

If it is added to the Ruby-GNOME2 project, we want to use  
GObject Introspection.

I created WebKitGTK+ bindings by Ruby/GObjectInstropection  
to show the concept:  
[ruby-gnome/webkit-gtk at main · ruby-gnome/ruby-gnome · GitHub](https://github.com/ruby-gnome2/ruby-gnome2/tree/master/webkit-gtk)

We can show WebKitGTK+ site by the following codes:

webkit-gtk.rb:

> <https://github.com/ruby-gnome/ruby-gnome/blob/main/webkit-gtk/lib/webkit-gtk.rb>

require “gobject-introspection”  
require “gtk3”

module WebKitGtk  
class \<\< self  
@initialized = false  
def init  
return if @initialized  
@initialized = true  
loader = Loader.new(self)  
loader.load(“WebKit”)  
end  
end

```
class Loader < GObjectIntrospection::Loader
end

```

end

browser.rb:  
[https://github.com/ruby-gnome2/ruby-gnome2/blob/master/webkit-gtk/sample/brower.rb](https://github.com/ruby-gnome2/ruby-gnome2/blob/master/webkit-gtk/sample/brower.rb)

require “webkit-gtk”

WebKitGtk.init

window = Gtk::Window.new  
window.signal\_connect(“destroy”) do  
Gtk.main\_quit  
end

view = WebKitGtk::WebView.new  
view.load\_uri(“[http://webkitgtk.org/](http://webkitgtk.org/)”)

window.add(view)  
window.show\_all

Gtk.main

## Thanks,

kou
