Hi,
I realized that in the "documents" sidebar each and every files have an icon, but they all have the same, no matter what. I had a little time and I decided to play a bit with the idea of having file-type based icons.
Such icons could be displayed at a few places:
1) In the Documents sidebar: there is already icons and it would probably ease to find a particular item (if different filetypes are mixed, of course). Anyway I think it's better to have the "right" icons rather than always using the same. (capture joined)
2) In the document notebook popup. This will perhaps ease finding the item, but perhaps adds clutter. Not sure. (capture joined)
3) In the tab title, like GEdit does. I think this one is a bad idea since it is probably useless and only use a little more space.
Before any deeper thoughts, I want to add a few technical details: I added MIME type for every built-in filetypes [1] (see below why). I think that anyway it's a good thing to have the MIME type since it may allow to e.g. filter file selection by MIME type rather that extension only [2], etc. So this might be interesting to keep even without filetype icons.
I use g_content_type_get_icon() (GLib/GIO 2.14 AFAIK, but not sure) and g_content_type_from_mime_type() (ouch, GLib/GIO 2.18). The first is obviously useful, and the second is there because I didn't wanted to use g_content_type_guess() because I think it'd be slow, and because we already know the filetype. I have a fallback if not available, but it doesn't provide different icons for different file types (currently only file/directory icons).
So, the problem is mainly the GLib version in use, 2.18, that is probably not really acceptable... but it isn't a real "feature" but rather a UI candy, so the fallback is perhaps fine.
And finally, the current points that are problematic: When sidebar_openfiles_add() is called, it's very likely that the document's filetype isn't set yet, so no icon (or a default one). It only appears when an opened file is renamed, since it updates the entry and the filetype is set at this time. Not sure how to fix this, but I haven't investigated yet. Same applies for notebook tabs, but since I'm really not sure it's a good idea to add them, I didn't tried yet.
So, before going further and fixing the things that don't work, what do you think of this? Would it be better with or without it?
Regards, Colomban
[1] Patch joined, 0001-Add-MIME-type-to-GeanyFiletype.patch. I have set the MIME type to text/plain when I didn't find the right one, but perhaps NULL would be better to denote that it isn't reliable. [2] Patch 0001-Add-MIME-type-filtering-in-file-chooser-dialog.patch