This Google School of Code, I decided to work with Bilal Elmoussaoui as a mentor, the goal being updating some GNOME design tools to GTK 4, specifically Icon Library and App Icon Preview. Both apps are written in Rust and make use of the gtk-rs bindings for gtk.
Icon Library is an app to preview symbolic icons in icon-development-kit. It allows to export and search icons. The process of porting Icon Library !16 was quite straightforward. The clipboard had to be adapted to the new api and the search provider had to be tweaked.
The most interesting bit was the search feature. Because of the better support for subclassing in gtk4-rs, it was natural to use list models for displaying lists, which in turn made using a filter on the model an obvious choice. But applying a filter on the list model resulted that each icon had to be redrawn on each search query, which is quite slow. The solution was to go back to setting the filter directly on the list widget.
App Icon Preview
App Icon Preview is an app for designing icons that target the GNOME environment. One complex part of porting this is app is its dependence on librsvg, which was recently updated for the latest gtk-rs. Another friction point is that widgets have moved away from using Cairo as their render and the Paintable api is not very friendly with the Clipboard or saving widgets as images. Clipboards consume
gdk::Texture which contain metainfo, and Paintables have no methods to construct such.
After some investigation, we found a way to free the node from the render and paint it into the Cairo context used to drawn the texture.
The port !62 still has some rough edges, but it is looking promising.