Re: [Vala] Question on Documentation and tutorials.



Il giorno ven, 22/08/2008 alle 14.42 +0200, Clément DAVID ha scritto:

Example: you want to eject a specific volume

    2. Then look at the corresponding vapi file to find the Vala
classes and fonctions names (Usually C class name without the first
'G' and C function name without class prefix).
               // in Vala
               VolumeMonitor myVolumeMonitor = VolumeMonitor.get ();
               List myDrives = myVolumeMonitor.get_connected_drives ();
               ...
               foreach ( Drive drv in myDrives )
                      stdout.printf (drv.get_name ());

Woahhh!! I had been looking for those 4 lines of code for weeks! :)

I was looking for dbus, udev, hal, etc, and didn't think to check the
"usual" GLib... :/

But now I have a problem.
I tried a little script (including just a little bit more than those 4
lines) but it doesn't show all my drives. :(

I have 2 DVDs, a 4-slot card reader, and plugged in a USB stick to try,
but the list returned by get_connected_drives() is empty.

I also tried get_volumes() and it only recognized the 2 DVDs and the
floppy because they were in /etc/fstab. Once removed, they disappeared
from get_volumes() list.

How can I get a list of all "hot-pluggable" devices (DVD, flash cards,
etc)?

I found get_mounts() to have a list of mounted devices.

Just to be clear: I would like to code something like
gnome-volume-manager, that gets signaled when a new device gets
hot-plugged and can mount/umount it.

A link to proper documentation7example/tutorial would be more than
enough.

Thank you very much.

Bye.

-- 
Alessandro Pellizzari





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]