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-4.2.5 sample/idle.rb
glib2-4.2.4 sample/idle.rb
glib2-4.2.3 sample/idle.rb
glib2-4.2.2 sample/idle.rb
glib2-4.2.1 sample/idle.rb
glib2-4.2.0 sample/idle.rb
glib2-4.1.9 sample/idle.rb
glib2-4.1.8 sample/idle.rb
glib2-4.1.7 sample/idle.rb
glib2-4.1.6 sample/idle.rb
glib2-4.1.5 sample/idle.rb
glib2-4.1.4 sample/idle.rb
glib2-4.1.3 sample/idle.rb
glib2-4.1.2 sample/idle.rb
glib2-4.1.1 sample/idle.rb
glib2-4.1.0 sample/idle.rb
glib2-4.0.9 sample/idle.rb
glib2-4.0.8 sample/idle.rb
glib2-4.0.7 sample/idle.rb
glib2-4.0.6 sample/idle.rb