[gnome-shell] power: Make sure we fall back to the correct icon



commit bd5162105e1365e12d69c408fad8d6c231af96c4
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jul 16 00:37:13 2019 +0200

    power: Make sure we fall back to the correct icon
    
    Commit bd18313d12 changed to a new naming scheme for battery icons,
    and used to old icon names as fallback-icon-name for compatibility
    with older/other icon themes.
    
    However that fallback code isn't working correctly, as GThemedIcon's
    default fallbacks will transform a name of `battery-level-90-symbolic`
    to a list of names:
     - `battery-level-90-symbolic`
     - `battery-level-symbolic`
     - `battery-symbolic`
    
    The last one frequently exists, so instead of the intended fallback,
    we end up with a generic battery icon.
    
    Address this by specifying the icon as GIcon instead of an icon-name,
    where we have more control over how the icon is resolved.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/1442

 js/ui/status/power.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index 8ffb0c631..54475d029 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -114,8 +114,15 @@ var Indicator = class extends PanelMenu.SystemIndicator {
             ? 'battery-level-100-charged-symbolic'
             : `battery-level-${fillLevel}${chargingState}-symbolic`;
 
-        this._indicator.icon_name = icon;
-        this._item.icon.icon_name = icon;
+        // Make sure we fall back to fallback-icon-name and not GThemedIcon's
+        // default fallbacks
+        let gicon = new Gio.ThemedIcon({
+            name: icon,
+            use_default_fallbacks: false
+        });
+
+        this._indicator.gicon = gicon;
+        this._item.icon.gicon = gicon;
 
         let fallbackIcon = this._proxy.IconName;
         this._indicator.fallback_icon_name = fallbackIcon;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]