Re: [Vala] detect mounted volumes



On Sat, Aug 13, 2011 at 01:53:04PM +0200, rastersoft wrote:

Hi all:

I need to detect when a new USB disk has been mounted or unmounted.
Currently I use VolumeMonitor.get() to acquire a VolumeMonitor
instance and list the volumes (using get_root().get_path() to get the
mounting path), but I want to do it in a more dynamic fashion,
detecting when the user inserts or removes a media and automagically
refreshing the list then, instead of forcing the user to click a
button to refresh it.

The problem is that I don't know how to do it. Drive_changed and
volume_changed signals are triggered before the volume is mounted by
nautilus, and mount_changed never happens :? If I send the order to
mount a volume when I receive its volume_added signal, nautilus
returns an error when it tries to mount it, because the operation is
already being made.

So, how can I detect when a new volume has been mounted?

Try .connect_after()

-- 
http://www.debian.org - The Universal Operating System



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