Skip to content

Instantly share code, notes, and snippets.

@cosmo0920
Last active August 29, 2015 14:06
Show Gist options
  • Save cosmo0920/0d7c4cd6c68f9633afbd to your computer and use it in GitHub Desktop.
Save cosmo0920/0d7c4cd6c68f9633afbd to your computer and use it in GitHub Desktop.
# ruby-gnome2/gtk3/sample/tmp/sample-headerbar.rb
ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..", "..")
ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
glib_base = File.join(ruby_gnome2_base, "glib2")
atk_base = File.join(ruby_gnome2_base, "atk")
cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
pango_base = File.join(ruby_gnome2_base, "pango")
gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
gdk3_base = File.join(ruby_gnome2_base, "gdk3")
gtk3_base = File.join(ruby_gnome2_base, "gtk3")
[
[glib_base, "glib2"],
[atk_base, "atk"],
[cairo_gobject_base, "cairo-gobject"],
[pango_base, "pango"],
[gdk_pixbuf_base, "gdk_pixbuf2"],
[gobject_introspection_base, "gobject-introspection"],
[gdk3_base, "gdk3"],
[gtk3_base, "gtk3"]
].each do |target, module_name|
if File.exist?(File.join(target, "Makefile"))
if system("which make > /dev/null")
`make -C #{target.dump} > /dev/null` or exit(false)
end
$LOAD_PATH.unshift(File.join(target, "ext", module_name))
end
$LOAD_PATH.unshift(File.join(target, "lib"))
end
require "gtk3"
class Belen < Gtk::Window
def initialize
window
end
def window
win = Gtk::Window.new(:toplevel)
win.border_width = 10
win.set_default_size(200,200)
hb = Gtk::HeaderBar.new()
hb.set_title('HeaderBarTest')
hb.set_show_close_button(true)
win.set_titlebar(hb)
win.show_all
end
end
Gtk.init
app = Belen.new
Gtk.main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment