Closed AngelTomkins closed 1 year ago
I have re implemented the system to work with GdkPixbufs instead of icon names. The function to get the given Pixbuf is Gtk.IconTheme.choose_icon
and Gtk.IconTheme.load_icon
. This implementation also has a fail-safe in the case that a Pixbuf was not able to be created for the given file type to revert to the previous text-x-generic-symbolic
.
It is notable that the size of the pixbuf is hard-coded and there needs to be implementation for getting the current icon size in the case that icon sizes will be able to change in the future(zoom/scaling feature) If someone is able to point me in the right direction to get that working please let me know.
Also note that icon sizing is now properly represented as 50px instead of my previous implementation which seemed to be a smaller representation. It might be beneficial to add some padding between the text and the image since the pixbuf fills the image completely.
I believe I have proper implementation now. Please review the implementation. And thank you for your comments and review Exalm!
Yep, much better. One thing I'd do is handle it async because it will be slow for network drives and such, but I don't know if the app already does the rest of the file handling async or not - if not, don't bother
Thanks @AngelTomkins for working on this, and @Exalm for the kind review :) l'll give it a try ASAP.
Please take a look now and let me know what you think!
In terms of the potential of saving memory by keeping same type thumbnails in memory, should do to this with a dictionary?
A default icon preview/thumbnail will be displayed from the system's icon theme
Screenshot: