geany/geany — pull request #179 by b4n (2013-10-15 01:20:39+00:00)
Title: Read filetype's mime type from the configuration files

This allows custom filetypes to define a mime type, hence the icon displayed for this filetype; as well as moving ones for built-in filetypes out of the code to the configuration files.

This replaces PRs #178 and #173 (yet to have an actual header icon one has to add the header filtypes).

---

This maybe is considered to break the plugin API because now `file_type->icon` maybe be `NULL`, so should be accessed using `filetype_get_icon()`, but this field isn't documented so we advertize it's not part of the API. In practice, from GP, only GeanyPy "uses" it, and properly checks for NULL, so I don't know.

BTW, `filetype_get_icon()` seems needed because now the mime-type is loaded dynamically in `filetypes_load_config()`, which unfortunately can be called before GTK is initialized when generating tag files, so we can't call `ui_get_mime_icon()` from there.

Also, a small bug I don't know how to fix: when reloading a configuration that changed the `mime_type` setting the icons aren't updated in the sidebar until the documents in question changes (so it calls `sidebar_openfiles_add()`).