This has been bothering me too, so I thought I'd take a look. I'm no C++ person, but playing around a bit with the Unity sources I seem to have found at least part of the problem.
Here's what I found:
1. The VolumeImp::GetIdentifier() function returns "-" when GVolume devices in the launcher don't return values for G_VOLUME_IDENTIFIER_KIND_LABEL and G_VOLUME_IDENTIFIER_KIND_UUID.
2. In my case, my phone (USB) and NFS shares both fall into this category and are all blacklisted/whitelisted together as a single item.
3. Connecting or disconnecting my phone can cause the "-" to become whitelisted again, which puts them all back on the launcher.
4. Changing this function to look like this:
changes the behaviour. The network devices are now blacklisted as "---network" (which suggests that CLASS is the only identifier type they respond to) and they don't return to the whitelist when I connect/disconnect my phone.
I think the correct solution to this (from someone who knows Gtk/GIO/C++ better than me) is to find a good unique identifier for these devices so they can be blacklisted independently, because it seems like their GVolume identifiers are not unique enough for this task.
This has been bothering me too, so I thought I'd take a look. I'm no C++ person, but playing around a bit with the Unity sources I seem to have found at least part of the problem.
Here's what I found:
1. The VolumeImp: :GetIdentifier( ) function returns "-" when GVolume devices in the launcher don't return values for G_VOLUME_ IDENTIFIER_ KIND_LABEL and G_VOLUME_ IDENTIFIER_ KIND_UUID. whitelisted together as a single item.
2. In my case, my phone (USB) and NFS shares both fall into this category and are all blacklisted/
3. Connecting or disconnecting my phone can cause the "-" to become whitelisted again, which puts them all back on the launcher.
4. Changing this function to look like this:
<pre><code> std::string GetIdentifier() const volume_ get_identifier( volume_ , G_VOLUME_ IDENTIFIER_ KIND_LABEL) ); volume_ get_identifier( volume_ , G_VOLUME_ IDENTIFIER_ KIND_UUID) );
{
glib::String label(g_
glib::String uuid(g_
if (!uuid.Value() && !label.Value()) get_identifier( volume_ , G_VOLUME_ IDENTIFIER_ KIND_HAL_ UDI)); g_volume_ get_identifier( volume_ , G_VOLUME_ IDENTIFIER_ KIND_NFS_ MOUNT)) ; volume_ get_identifier( volume_ , G_VOLUME_ IDENTIFIER_ KIND_UNIX_ DEVICE) ); get_identifier( volume_ , G_VOLUME_ IDENTIFIER_ KIND_CLASS) );
{
glib::String udi(g_volume_
glib::String nfsmount(
glib::String unix(g_
glib::String cls(g_volume_
return udi.Str() + "-" + nfsmount.Str() + "-" + unix.Str() + "-" + cls.Str();
}
return uuid.Str() + "-" + label.Str();
}
</code></pre>
changes the behaviour. The network devices are now blacklisted as "---network" (which suggests that CLASS is the only identifier type they respond to) and they don't return to the whitelist when I connect/disconnect my phone.
I think the correct solution to this (from someone who knows Gtk/GIO/C++ better than me) is to find a good unique identifier for these devices so they can be blacklisted independently, because it seems like their GVolume identifiers are not unique enough for this task.