Sha256: 76c93769c0c9b50639e69556358dbe1ec2a8ac3b535e1da73f1e7c2e64c30637

Contents?: true

Size: 1.39 KB

Versions: 184

Compression:

Stored size: 1.39 KB

Contents

#!/usr/bin/env ruby

=begin
  Sample script using Gtk::Socket and Gtk::Plug.

  $ ruby t-gtksocket.rb

  Written by Alex Boussinet <mailto:dbug@wanadoo.fr> for testing purpose only.

  Copyright (c) 2003-2006 Ruby-GNOME2 Project Team
  This program is licenced under the same licence as Ruby-GNOME2.

  $Id: t-gtkplug.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
=end

require 'gtk2'

class MyGtkPlug
  def initialize(xid, plug)
    plug = "Button" if plug.nil?
    if xid.nil?
      @window = Gtk::Window.new("Gtk::Plug Test")
      @window.set_default_size(250, 50)
    else
      @window = Gtk::Plug.new(xid.to_i)
    end
    @window.window_position = Gtk::Window::POS_CENTER
    @window.signal_connect("delete_event"){Gtk.main_quit}
    @vbox = Gtk::VBox.new(true, 5)
    @window.add(@vbox)
    @button1 = Gtk::Button.new(plug)
    @button1.signal_connect("clicked"){ $stderr.puts plug}
    @button2 = Gtk::Button.new("Exit")
    @button2.signal_connect("clicked"){Gtk.main_quit}
    # Exit button to test an unexpected end of child process by Gtk::Socket
    @vbox.add(@button1)
    @vbox.add(@button2)
    @window.show_all
  end
end

xid = nil
ARGV.each_index { |i|
  arg = ARGV.at(i)
  if arg == "-x"
    if arg.length > 2
      xid = arg[2..-1]
    else
      xid = ARGV.at(i + 1)
      ARGV.delete_at(i + 1)
    end
    xid = nil if xid.to_i <= 0
    ARGV.delete_at(i)
  end 
}

MyGtkPlug.new(xid, ARGV.shift)
Gtk.main

Version data entries

184 entries across 184 versions & 1 rubygems

Version Path
gtk2-3.4.3 sample/misc/t-gtkplug.rb
gtk2-3.4.2 sample/misc/t-gtkplug.rb
gtk2-3.4.1 sample/misc/t-gtkplug.rb
gtk2-3.4.0 sample/misc/t-gtkplug.rb
gtk2-3.3.9 sample/misc/t-gtkplug.rb
gtk2-3.3.8 sample/misc/t-gtkplug.rb
gtk2-3.3.7 sample/misc/t-gtkplug.rb
gtk2-3.3.6 sample/misc/t-gtkplug.rb
gtk2-3.3.5 sample/misc/t-gtkplug.rb
gtk2-3.3.4 sample/misc/t-gtkplug.rb
gtk2-3.3.3 sample/misc/t-gtkplug.rb
gtk2-3.3.2 sample/misc/t-gtkplug.rb
gtk2-3.3.1 sample/misc/t-gtkplug.rb
gtk2-3.3.0 sample/misc/t-gtkplug.rb
gtk2-3.2.9-x64-mingw32 sample/misc/t-gtkplug.rb
gtk2-3.2.9-x86-mingw32 sample/misc/t-gtkplug.rb
gtk2-3.2.9 sample/misc/t-gtkplug.rb
gtk2-3.2.8-x64-mingw32 sample/misc/t-gtkplug.rb
gtk2-3.2.8-x86-mingw32 sample/misc/t-gtkplug.rb
gtk2-3.2.8 sample/misc/t-gtkplug.rb