Gio volume changed signal

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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs