Problem with using GLib::File

Hello

I tried to put together a test application that opens a file.

Unfortunately, the line with GLib::File.read returns:

fdialog.rb:16:in `filechooserbutton1_file_set_cb’: uninitialized
constant GLib::File

I use

require ‘libglade2’
require ‘glib2’

what do I need to read a file?

Where can I find the required library for an object like GLib::File?

The page http://ruby-gnome2.sourceforge.jp/hiki.cgi?GLib%3A%3AFile
does not state requirements.

Thanks

Michal

Subject: [ruby-gnome2-devel-en] problem with using GLib::File
Date: lun 06 giu 11 07:20:12 +0200

Quoting Michal S. ([email protected]):

require ‘glib2’

what do I need to read a file?

The File class is included in the default Ruby library, not in Glib.

You must use File in place of GLib::File if you want your program to
access files.

Carlo

  •     Se la Strada e la sua Virtu' non fossero state messe da 
    

parte,

  • K * Carlo E. Prelz - [email protected] che bisogno ci
    sarebbe
    •           di parlare tanto di amore e di rettitudine? 
      

(Chuang-Tzu)

On 6 June 2011 20:29, Carlo E. Prelz [email protected] wrote:

constant GLib::File
You must use File in place of GLib::File if you want your program to
access files.

Carlo

Then my program won’t be able to access my files because they are only
reachable through gvfs.

Thanks

Michal

Michal S. wrote in post #1003626:

Then my program won’t be able to access my files because they are only
reachable through gvfs.

have you tried ruby/gnomevfs? never used it myself, but looks like it
could work for you…

http://ruby-gnome2.sourceforge.jp/hiki.cgi?Ruby/GnomeVFS

cheers,

  • j

On 7 June 2011 09:07, Michal S. [email protected] wrote:

fdialog.rb:16:in `filechooserbutton1_file_set_cb’: uninitialized

You must use File in place of GLib::File if you want your program to
access files.

Carlo

Then my program won’t be able to access my files because they are only
reachable through gvfs.

Also, what does
http://ruby-gnome2.sourceforge.jp/hiki.cgi?GLib%3A%3AFile describe?

A non-existent module?

Thanks

Michal

On Mon, Jun 6, 2011 at 19:20, Michal S. [email protected]
wrote:

what do I need to read a file?

require ‘gio2’

Hello

On 12 June 2011 22:08, Nikolai W. [email protected] wrote:

On Mon, Jun 6, 2011 at 19:20, Michal S. [email protected] wrote:

what do I need to read a file?

require ‘gio2’

with recent ruby-gnome2 I get gio2 which provides the GLib::File module.

(GLib::File.new_for_uri uri).read.close returns true so I guess I can
read files.

Thanks

Michal