Originally Posted by
weblordpepe
Hi there fellow Ubuntu soldiers!
I have a need in my scripts I am currently working on. I need a way to display the correct icon for a given file.
Does anyone know of a way (any way) which I could be told the icon used by gnome (eg, /usr/share/icons/something/something.png) for a particular file? There are ways to get details about a file using the 'file' utility, but how to get the icon for that type of file etc is unknown. Personally I don't think Gnome even touches the 'file' utility since it can't tell anything without the correct extensions.
I have tried all kinds of things, investigating MIME & stuff and GTK themes but I can't seem to come to any proper conclusion since I'm a bit of a noob.
I understand I could possibly need to hook into Gnome APIs some how. Can anybody help me with this? I have two chocolate bars and a girlfriend for trade.
Pretty much all of the instructions/How-to's on Gnome icons stated that the icon filename, in a theme, needed to be set up like this:
Code:
gnome-mime-video-x-msvideo.png
(this example is using the mimetype for files with an .AVI extension)
where "gnome" is your desktop manager, "mime" refers to a mimetype, "video" tells us the type of mime and "msvideo" is the specific mime type that the icon will be applied to.
Now, what I've found is that gnome (gnome 2.16, at least) automaticaly points all the icons at "gnome-mime", when you add a new icon theme, or revise one, as was my case. So to get my icons to display with the appropriate filetype, they had to be named as follows:
Code:
video-x-msvideo.png (the "gnome-mime" is no longer necessary)
Also, it might be usefull to know that you can get a list of mimetypes from your file. Also, if you want to know a specific files mime type, you can right click the file, select properties, and the mimetype will be displayed, for that file, under the basic tab.
Taken from
http://mandrivausers.org/index.php?/...-gnome-solved/
Bookmarks