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:

<pre><code>std::string GetIdentifier() const
  {  
    glib::String label(g_volume_get_identifier(volume_, 
G_VOLUME_IDENTIFIER_KIND_LABEL));
    glib::String uuid(g_volume_get_identifier(volume_, 
G_VOLUME_IDENTIFIER_KIND_UUID));
    
    if (!uuid.Value() && !label.Value())
    {
      glib::String udi(g_volume_get_identifier(volume_, 
G_VOLUME_IDENTIFIER_KIND_HAL_UDI));
      glib::String nfsmount(g_volume_get_identifier(volume_, 
G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT));
      glib::String unix(g_volume_get_identifier(volume_, 
G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE));
      glib::String cls(g_volume_get_identifier(volume_, 
G_VOLUME_IDENTIFIER_KIND_CLASS));
      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.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1103593

Title:
  Unity always shows all devices in launcher when CD is inserted

To manage notifications about this bug go to:
https://bugs.launchpad.net/unity/+bug/1103593/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to