Sha256: 931cc58055f62779d06de885fddcdefb4668f9079bc7c2ded46a3b27132468e9

Contents?: true

Size: 617 Bytes

Versions: 4

Compression:

Stored size: 617 Bytes

Contents

#
# Based on the 'Hello world' Gtk+ tutorial example at
# http://library.gnome.org/devel/gtk-tutorial/2.90/c39.html#SEC-HELLOWORLD
#
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'gir_ffi'

GirFFI.setup :GObject
GirFFI.setup :Gtk

Gtk.init

win = Gtk::Window.new(:toplevel)
GObject.signal_connect win, "delete-event" do
  puts "delete event occured"
  true
end

GObject.signal_connect(win, "destroy") { Gtk.main_quit }
win.set_border_width 10

but = Gtk::Button.new_with_label("Hello World")
GObject.signal_connect(but, "clicked") { win.destroy }

win.add but

but.show
win.show

Gtk.main

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gir_ffi-0.0.7 examples/02_hello_world.rb
gir_ffi-0.0.6 examples/02_hello_world.rb
gir_ffi-0.0.5 examples/02_hello_world.rb
gir_ffi-0.0.4 examples/02_hello_world.rb