GNOME Bugzilla – Bug 705166
g_mount_get_icon() does not always return correct icon
Last modified: 2018-05-24 15:34:03 UTC
I've consulted with the folks at xdg@lists.freedesktop.org and determined that apparently there is a way to provide a custom icon on mounted volumes in a fd.o friendly way. Mikkel on unity-devel informed me that most desktop environments are probably using glib's g_mount_get_icon() to retrieve this icon. However, I haven't really found a desktop environment that this works properly on so far. This may be because g_mount_get_icon() is used correctly, but not actually returning the correct icon when a custom one was provided. Using a custom icon on a mounted volume can apparently be done in a fd.o friendly manner by providing a ".directory" file (note only an extension and no leading file name) in the root of the mounted volume. This is a standard Desktop Entry file with the Icon field set to some icon and probably with Type=Directory set. If the problem is just with g_mount_get_icon(), then theoretically patching this GIO function should enable all desktop environments dependent on it to use the custom icon (e.g. Unity, Gnome, Xfce, etc.).
A quick look at the gvfs code seemed to point at two ways for adding custom icons for a mounted volume: 1) https://bugzilla.gnome.org/show_bug.cgi?id=551403 explains .xdg-volume-info 2) https://git.gnome.org/browse/gvfs/tree/monitor/udisks2/what-is-shown.txt?id=bb4e7ed0236855d2ced7cfd4445877822da8fe7b for information about mount options and udev properties to set icons
Hey Matthias. Thanks for sharing. I took a look at both links and I am still confused. I still don't really understand what the .xdg-volume-info file is for. Is this a replacement for the .directory method? As for the latter link, I still don't understand how a removable media can specify its own custom icon.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/738.