Mounting a samba share?

Hello,

I can’t get mounts working with gio.

I guess the problem is that I don’t have the main loop and ruby-gio2
implements only asynchronous mount.

I don’t have and don’t want gtk but there’s not GLib.main.

Also I really want only mounting the share and then continue running
in Ruby, not in GLib loop.

Any ideas how this can be done?

I guess running GTK without any windows is also an option if there is
no main loop in ruby-glib2.

Thanks

Michal

OK, so I got the gio mounts working thanks to Nikolai’s patch.

I still need Gtk to mount, though.

Thanks

Michal

On Sat, Sep 10, 2011 at 17:30, Michal S. [email protected]
wrote:

I guess the problem is that I don’t have the main loop and ruby-gio2
implements only asynchronous mount.

There is no synchronous mount.

I don’t have and don’t want gtk but there’s not GLib.main.

I suppose you can look at GLib::MainLoop.

On 11 September 2011 11:34, Nikolai W. [email protected] wrote:

On Sat, Sep 10, 2011 at 17:30, Michal S. [email protected] wrote:

I guess the problem is that I don’t have the main loop and ruby-gio2
implements only asynchronous mount.

There is no synchronous mount.

I don’t have and don’t want gtk but there’s not GLib.main.

I suppose you can look at GLib::MainLoop.

How do I tell that class even exists?

Can’t find anything like that in the docs.

Thanks

Michal

Hi,

In [email protected]lid
“Re: [ruby-gnome2-devel-en] Mounting a samba share?” on Sun, 11 Sep
2011 12:03:58 +0200,
Michal S. [email protected] wrote:

I suppose you can look at GLib::MainLoop.

How do I tell that class even exists?

Can’t find anything like that in the docs.

Try the following patch:
— dgvfselect.rb.orig 2011-09-11 19:07:45.181204351 +0900
+++ dgvfselect.rb 2011-09-11 19:11:07.599924161 +0900
@@ -104,15 +104,16 @@
mop.username, mop.password, mop.domain = (answer.lines.to_a.mapm
:chomp)
mop.reply ((result == 0) ? GLib::MountOperation::Result::HANDLED
: GLib::MountOperation::Result::ABORTED)
}

  • main_loop = GLib::MainLoop.new
    res = file.mount_enclosing_volume(0, mop){|res|
    begin
    file.mount_enclosing_volume_finish res
    rescue
    STDERR.puts $!.to_s
    end
  •  Gtk.main_quit
    
  •  main_loop.quit
    
    }
  • Gtk.main
  • main_loop.run
    end

sample/ directoy in glib2 gem has some sample scripts. They
will help you.

Thanks,

kou

On 11 September 2011 12:12, Kouhei S. [email protected] wrote:

implements only asynchronous mount.

  file.mount_enclosing_volume_finish res
  rescue
     STDERR.puts $!.to_s
  end
  •  Gtk.main_quit
    
  •  main_loop.quit
    
    }
  • Gtk.main
  • main_loop.run
    end

Yes, it’s quite obvious once I know there is a GLib::MainLoop. The
problem is that the docs at
http://ruby-gnome2.sourceforge.jp/hiki.cgi?Ruby%2FGLib don’t say
anything about it anywhere I could find so how do I find out about it?

Are there some other docs I am missing?

Thanks

Michal