I tried to create a custom mimetype (text/graphml+xml) by creating the file ~/.local/share/mime/packages/graphml+xml-mime.xml with this content:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-graphml+xml">
<comment>GraphML file</comment>
<acronym>GraphML</acronym>
<expanded-acronym>Graph Modelling Language</expanded-acronym>
<sub-class-of type="text/xml"/>
<glob pattern="*.graphml"/>
</mime-type>
</mime-info>
And installed an appropriate icon with:
xdg-icon-resource-resourse install --context mimetype --novendor --size ${size} --mode user text-x-graphml+xml.png
Then updated the database with
update-mime-database ~/.local/share/mime
But the icon for a my.graphml file is not displayed in nautilus (it's a debian minimal gnome system).
The icons in ~/.local/share/icon/hicolor/${size}x${size}/mimetype/text-x-graphml+xml.png does exist.
gio info my.graphml says:
...
standard::icon: text-x-graphml+xml, text-x-generic, text-x-graphml+xml-symbolic, text-x-generic-symbolic
standard::content-type: text/x-graphml+xml
standard::fast-content-type: text/x-graphml+xml
...
I can double click it and the file is opened with yed (as I want - did create the ~/.local/share/applicatons/yed.desktop file and the application does show in the applications pannel with the appropriate icon).
But no icon! :-(
EDIT:
It's a debian testing system, installed with debootstrap and grown from there (trying to keep it minimal). I'm afraid this might also mean some packages might be missing...
Nathaniel M. Beaver is right - this is the same question he already answered in Assign an icon to a custom mimetype - Unix & Linux