Sha256: bd83ff8417218caddbcecf7605fa9e57a24bbf4931d27e60092bb7c88f7023a3

Contents?: true

Size: 663 Bytes

Versions: 235

Compression:

Stored size: 663 Bytes

Contents

=begin
  idle.rb - Sample for GLib::Idle, GLib::MainLoop.

  Copyright (C) 2005 Ruby-GNOME2 Project Team
  This program is licenced under the same licence as Ruby-GNOME2.

  $Date: 2005/03/13 14:39:58 $
  $Id: idle.rb,v 1.1 2005/03/13 14:39:58 mutoh Exp $
=end

require 'glib2'

mainloop = GLib::MainLoop.new(nil, true)

i = 0
GLib::Idle.add {
  i += 1
  p "timeout1-#{i}"
  if i > 9
    mainloop.quit 
    false # the source is removed.
  else
    true  # continue ...
  end
}

j = 0
GLib::Idle.add {
  j += 1
  p "timeout2-#{i}"
  if j > 9
    mainloop.quit 
    false # the source is removed.
  else
    true  # continue ...
  end
}

mainloop.run

p "quit..."

Version data entries

235 entries across 227 versions & 2 rubygems

Version Path
glib2-0.90.8-x86-mingw32 sample/idle.rb
glib2-0.90.8 sample/idle.rb
glib2-0.90.7-x86-mingw32 sample/idle.rb
glib2-0.90.7 sample/idle.rb
glib2-0.90.6 sample/idle.rb
glib2-0.90.6-x86-mingw32 sample/idle.rb
glib2-0.90.5 sample/idle.rb
glib2-0.90.5-x86-mingw32 sample/idle.rb
glib2-0.90.4 sample/idle.rb
glib2-0.90.4-x86-mingw32 sample/idle.rb
glib2-0.90.3 sample/idle.rb
glib2-0.90.3-x86-mingw32 sample/idle.rb
glib2-0.90.2 sample/idle.rb
glib2-0.90.2-x86-mingw32 sample/idle.rb
glib2-0.20.0 sample/idle.rb