Sha256: d6a280155a61bbbf2e8bfdfcf72fefcb461e4f99453c26ca523f22638dcbaa06

Contents?: true

Size: 647 Bytes

Versions: 11

Compression:

Stored size: 647 Bytes

Contents

#!/usr/bin/env ruby

require 'gir_ffi-gtk3'

myapp = Gtk::Application.new('org.gtk.example', :handles_command_line)

myapp.signal_connect 'command-line' do |app, _command_line|
  app.activate
  0
end

myapp.signal_connect 'activate' do |app|
  win = Gtk::ApplicationWindow.new(app)
  win.set_title('Gtk Application example')
  win.set_default_size(200, 200)

  button_box = Gtk::ButtonBox.new(:horizontal)
  win.add(button_box)

  button = Gtk::Button.new_with_label('Hello world')
  button.signal_connect 'clicked' do
    puts 'Hello World'
    app.quit
  end

  button_box.add(button)
  win.show_all
end

exit(myapp.run([$PROGRAM_NAME] + ARGV))

Version data entries

11 entries across 11 versions & 1 rubygems

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