[gnome-control-center] network: Fix wifi icon loading



commit 079bf51086c32da859aacdcbe778bdfe39ebb565
Author: Christopher Davis <christopherdavis gnome org>
Date:   Thu Jan 6 12:42:34 2022 -0800

    network: Fix wifi icon loading
    
    GTK4 changes how icons are loaded - only icons that are
    set up to follow icon theme paths are recolored. The way
    the network panel loaded icons wasn't compatible with this,
    causing icons to stay dark in dark mode.
    
    This commit adjusts the gresource so that icons are
    in `$RESOURCE_BASE_PATH/icons/scalable/actions`. Since
    GTK knows how to handle that automatically, we can
    simply use `icon-name` instead of loading a full
    icon path.

 panels/network/cc-wifi-connection-row.c | 10 +++-------
 panels/network/network.gresource.xml    |  3 +++
 2 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/panels/network/cc-wifi-connection-row.c b/panels/network/cc-wifi-connection-row.c
index 30011c1cc..da377ccd6 100644
--- a/panels/network/cc-wifi-connection-row.c
+++ b/panels/network/cc-wifi-connection-row.c
@@ -252,36 +252,32 @@ update_ui (CcWifiConnectionRow *self)
 
   if (security != NM_AP_SEC_UNKNOWN && security != NM_AP_SEC_NONE && security != NM_AP_SEC_OWE)
     {
-      const gchar *icon_path;
+      const gchar *icon_name = "lock-small-symbolic";
 
       gtk_widget_set_child_visible (GTK_WIDGET (self->encrypted_icon), TRUE);
       if (security == NM_AP_SEC_WEP)
        {
-          icon_path = "/org/gnome/control-center/network/warning-small-symbolic.svg";
+          icon_name = "warning-small-symbolic";
          gtk_widget_set_tooltip_text (GTK_WIDGET (self->encrypted_icon), _("Insecure network (WEP)"));
        }
       else if (security == NM_AP_SEC_WPA)
        {
-          icon_path = "/org/gnome/control-center/network/lock-small-symbolic.svg";
           gtk_widget_set_tooltip_text (GTK_WIDGET (self->encrypted_icon), _("Secure network (WPA)"));
        }
       else if (security == NM_AP_SEC_WPA2)
        {
-          icon_path = "/org/gnome/control-center/network/lock-small-symbolic.svg";
           gtk_widget_set_tooltip_text (GTK_WIDGET (self->encrypted_icon), _("Secure network (WPA2)"));
        }
          else if (security == NM_AP_SEC_SAE)
        {
-          icon_path = "/org/gnome/control-center/network/lock-small-symbolic.svg";
           gtk_widget_set_tooltip_text (GTK_WIDGET (self->encrypted_icon), _("Secure network (WPA3)"));
        }
       else
        {
-          icon_path = "/org/gnome/control-center/network/lock-small-symbolic.svg";
           gtk_widget_set_tooltip_text (GTK_WIDGET (self->encrypted_icon), _("Secure network"));
        }
 
-      gtk_image_set_from_resource (self->encrypted_icon, icon_path);
+      gtk_image_set_from_icon_name (self->encrypted_icon, icon_name);
     }
   else
     {
diff --git a/panels/network/network.gresource.xml b/panels/network/network.gresource.xml
index b056d4b59..a67ab60de 100644
--- a/panels/network/network.gresource.xml
+++ b/panels/network/network.gresource.xml
@@ -14,6 +14,9 @@
 
     <!-- Wi-Fi panel -->
     <file preprocess="xml-stripblanks">cc-wifi-panel.ui</file>
+  </gresource>
+  <gresource prefix="/org/gnome/ControlCenter/icons/scalable/actions">
+    <!-- Wi-Fi panel icons -->
     <file preprocess="xml-stripblanks">lock-small-symbolic.svg</file>
     <file preprocess="xml-stripblanks">warning-small-symbolic.svg</file>
   </gresource>


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