# Mounting a samba share?

**URL:** <https://www.ruby-forum.com/t/mounting-a-samba-share/211675>\
**Category:** Ruby-Gnome 2\
**Created:** [September 10, 2011, 5:31pm UTC](https://www.ruby-forum.com/t/mounting-a-samba-share/211675 "2011-09-10T17:31:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [September 10, 2011, 5:31pm UTC](https://www.ruby-forum.com/t/mounting-a-samba-share/211675/1 "2011-09-10T17:31:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Michal\_S](https://www.ruby-forum.com/u/Michal_S)\
**Post date:** [September 10, 2011, 7:18pm UTC](https://www.ruby-forum.com/t/mounting-a-samba-share/211675/2 "2011-09-10T19:18:37Z")

</div>

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

I still need Gtk to mount, though.

Thanks

Michal

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Michal\_S](https://www.ruby-forum.com/u/Michal_S)\
**Post date:** [September 11, 2011, 11:35am UTC](https://www.ruby-forum.com/t/mounting-a-samba-share/211675/3 "2011-09-11T11:35:23Z")

</div>

On Sat, Sep 10, 2011 at 17:30, Michal S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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.

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Michal\_S](https://www.ruby-forum.com/u/Michal_S)\
**Post date:** [September 11, 2011, 12:05pm UTC](https://www.ruby-forum.com/t/mounting-a-samba-share/211675/4 "2011-09-11T12:05:03Z")

</div>

On 11 September 2011 11:34, Nikolai W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Sat, Sep 10, 2011 at 17:30, Michal S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Michal\_S](https://www.ruby-forum.com/u/Michal_S)\
**Post date:** [September 11, 2011, 12:13pm UTC](https://www.ruby-forum.com/t/mounting-a-samba-share/211675/5 "2011-09-11T12:13:43Z")

</div>

Hi,

In [CAOMqctQ84j25XyH60JRmmP38Fhojq=removed\_email\_address@domain.invalid](mailto:CAOMqctQ84j25XyH60JRmmP38Fhojq=removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] Mounting a samba share?” on Sun, 11 Sep  
2011 12:03:58 +0200,  
Michal S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Michal\_S](https://www.ruby-forum.com/u/Michal_S)\
**Post date:** [September 12, 2011, 12:28am UTC](https://www.ruby-forum.com/t/mounting-a-samba-share/211675/6 "2011-09-12T00:28:26Z")

</div>

On 11 September 2011 12:12, Kouhei S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](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
