GnomeVFS::Monitor

Does anyone know some tricks to make GnomeVFS::Monitor work? Here is a
sample app (a port of gnomevfs-monitor to Ruby) that I’ve been trying;
any
guess on where it’s wrong?

(This is on FreeBSD 6.2-RC2 using ruby-gnomevfs 0.16.)

#!/usr/local/bin/ruby

require ‘gnomevfs’

if GnomeVFS.init

Signal.trap(‘INT’) { GnomeVFS.shutdown; exit }

GnomeVFS::Monitor.new(ARGV[0], GnomeVFS::Monitor::DIRECTORY) do |*a|
puts a.inspect
end

loop {}
end


Mike B. [email protected] http://mike-burns.com


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Hi,

In [email protected]
“[ruby-gnome2-devel-en] GnomeVFS::Monitor” on Sun, 17 Jun 2007
14:13:09 -0400,
Mike B. [email protected] wrote:

Does anyone know some tricks to make GnomeVFS::Monitor work? Here is a
sample app (a port of gnomevfs-monitor to Ruby) that I’ve been trying; any
guess on where it’s wrong?

You need to use GLib::MainLoop not loop.

end

loop {}
end

#!/usr/local/bin/ruby

require ‘gnomevfs’

if GnomeVFS.init
mainloop = GLib::MainLoop.new(nil, false)

Signal.trap('INT') {mainloop.quit}

GnomeVFS::Monitor.new(ARGV[0], GnomeVFS::Monitor::DIRECTORY) do |*a|
  p a
end

mainloop.run

GnomeVFS.shutdown

end

But 0.16 has a bug for GnomeVFS::Monitor.new callback. So
the script will cause segmentation fault. I’ve fixed the bug
in HEAD.

Thanks,

kou


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs