tchx84 / Portfolio

A minimalist file manager for those who want to use Linux mobile devices.
GNU General Public License v3.0
93 stars 23 forks source link

Added icon thumbnails #273

Closed AngelTomkins closed 1 year ago

AngelTomkins commented 1 year ago

A default icon preview/thumbnail will be displayed from the system's icon theme

Screenshot: image

AngelTomkins commented 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. image

AngelTomkins commented 1 year ago

I believe I have proper implementation now. Please review the implementation. And thank you for your comments and review Exalm!

alice-mkh commented 1 year ago

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

tchx84 commented 1 year ago

Thanks @AngelTomkins for working on this, and @Exalm for the kind review :) l'll give it a try ASAP.

AngelTomkins commented 1 year ago

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?