Skip to content

Unresponsive UI on icons tab

Submitted by Steve Dodier-Lazaro

Assigned to Nick Schermer

Link to original bug (#12740)

Description

Just writing this down so there's a record and someone gets around to doing it some day

Context: the devs implemented previews for icon themes and GTK+ themes

Problem: bitmaps for themes must be generated before the UI actually switches to the tab and shows the list of themes. It's slow, especially for icon themes with a multiple-second delay

Solution 1: multithreading. create a GThread that will generate pixmaps and emit a signal as they become available, and connect the object that handles the list to that signal so it updates individual list items as the pixmap becomes available

Solution 2: caching. once you have a bitmap, check the mtime of the theme's directory (which you used to generate the pixmaps), and save the mtime and the pixmap in $XDG_USER_CACHE/xfce/appearance-settings/. When loading themes, first identify the corresponding folder, and check if there's an entry in the cache with an identical mtime. If so, reload that pixmap instead.

Solution 1 is better as it avoids unresponsiveness on the first use (and that's, for quite a bunch of users, nearly the only time they will use the dialog). It's also easier to implement. Solution 2 would provide faster loading of previews on subsequent loads. Both can be combined.

This qualifies as an easy bug fix for newcomers.

Version: 4.12.0