Forum: Ruby-Gnome 2 Mounting a samba share?

Posted by Michal Suchanek (Guest)
on 2011-09-10 17:31
(Received via mailing list)
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
Posted by Michal Suchanek (Guest)
on 2011-09-10 19:18
Attachment: dgvfselect.rb (4,52 KB)
(Received via mailing list)
OK, so I got the gio mounts working thanks to Nikolai's patch.

I still need Gtk to mount, though.

Thanks

Michal
Posted by Nikolai Weibull (Guest)
on 2011-09-11 11:35
(Received via mailing list)
On Sat, Sep 10, 2011 at 17:30, Michal Suchanek <hramrach@centrum.cz> 
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.
Posted by Michal Suchanek (Guest)
on 2011-09-11 12:05
(Received via mailing list)
On 11 September 2011 11:34, Nikolai Weibull <now@bitwi.se> wrote:
> On Sat, Sep 10, 2011 at 17:30, Michal Suchanek <hramrach@centrum.cz> 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
Posted by Kouhei Sutou (Guest)
on 2011-09-11 12:13
(Received via mailing list)
Hi,

In <CAOMqctQ84j25XyH60JRmmP38Fhojq=oSepd1USvzXkt90ES86w@mail.gmail.com>
  "Re: [ruby-gnome2-devel-en] Mounting a samba share?" on Sun, 11 Sep 
2011 12:03:58 +0200,
  Michal Suchanek <hramrach@centrum.cz> 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
Posted by Michal Suchanek (Guest)
on 2011-09-12 00:28
(Received via mailing list)
On 11 September 2011 12:12, Kouhei Sutou <kou@cozmixng.org> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.