# Gio volume changed signal

**URL:** <https://www.ruby-forum.com/t/gio-volume-changed-signal/239173>\
**Category:** Ruby-Gnome 2\
**Created:** [February 15, 2014, 5:40pm UTC](https://www.ruby-forum.com/t/gio-volume-changed-signal/239173 "2014-02-15T17:40:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [February 15, 2014, 5:40pm UTC](https://www.ruby-forum.com/t/gio-volume-changed-signal/239173/1 "2014-02-15T17:40:08Z")

</div>

Hi, I work on dynamic volume add-remove issue. I should detect which  
device added and which one removed. I add to a hash mounted devices. I  
do this:

# to add

@volume = Gio::VolumeMonitor.get  
all\_volumes = @volume.volumes  
v0 = all\_volumes.last.mount  
devices\_hash.store(v0.name, v0)

# to remove

@volume.signal\_connect(“volume-removed”) do |vol|  
index = devices\_hash.values.index(vol)  
…  
…  
.  
.  
end

I realized vol is not any v0. device\_hash values doesn’t include vol  
value. So How can I get correctly which device removed and added?
