appIndicator: Refactor named icons lookup and loading by 3v1n0 · Pull Request #415 · ubuntu/gnome-shell-extension-appindicator (original) (raw)
The gicon icon size is used only for loading the textures so it only matters for us when we pass a path to StTextureCache, and it's generally provided by the theme, however in case that's not the case we need to update it only when it changes, there's no need to do it more times.
We only can update the icons if we're ready and mapped, otherwise it does not make sense, so ensure this is the case, waiting in case.
…erences
St.Icon uses the loading size of the icon depending on the theme value for the icon size, so we should honor this, but also we want to be sure that the loaded icon will respect the user defined settings, so we override such value in case the values do not match.
We still prefer to see something than nothing
We used to always looking up for the icons ourself, somewhat duplicating the shell work, it allowed to prevent shell caching of some files, but still we can remove lots of deprecated code and handle things more smartly given that texture-caching can be good in case of well-known files.
In short:
- named-only icons are now loaded through a Gio.ThemedIcon (and so cached)
- icons with custom theme are searched in provided path and behave just like any other icon with full path as explained below.
- icons with a full icon path (provided by the theme or not) may be loaded
in different ways:
- Using a Gio.FileIcon if they are in non-writable areas (so we assume that there are only a limited number of them) and they are cashed.
- using a StTextureCacheSkippingFileIcon in newer gjs versions and so basically they're non-cachable Gio.FileIcon's
- using a GdkPixbuf, potentially loaded via the icon theme (for svgs) in older gjs versions, and so that's not cached.
It's better to a wait a bit more before emitting properties changes so that they can be grouped together, for example the icon-theme path and the icon name should go together
3v1n0 mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})