Blame SOURCES/0002-shell-Icon-name-helper-returns-symbolic-name.patch

9b746a
From b24a8e9aa82b64de970d8137181bf8a03b6f724a Mon Sep 17 00:00:00 2001
9b746a
From: Christian Kellner <christian@kellner.me>
9b746a
Date: Tue, 10 Apr 2018 09:47:48 +0200
9b746a
Subject: [PATCH 2/4] shell: Icon name helper returns symbolic name
9b746a
9b746a
The helper function to get the icon name from a GIcon directly
9b746a
returns the symbolic icon now. This makes it in turn possible
9b746a
to also directly check if the theme has the icon with the symbolic
9b746a
name instead of checking of for the full colored one and then
9b746a
deriving the symbolic name from that. The latter (old) practice
9b746a
will fail if there is a symbolic icon in the theme that has no
9b746a
full color icon (like e.g. thunderbolt).
9b746a
---
9b746a
 shell/cc-window.c | 19 ++++++++++---------
9b746a
 1 file changed, 10 insertions(+), 9 deletions(-)
9b746a
9b746a
diff --git a/shell/cc-window.c b/shell/cc-window.c
9b746a
index 33f1ddcad511..3af9cf0bd9fc 100644
9b746a
--- a/shell/cc-window.c
9b746a
+++ b/shell/cc-window.c
9b746a
@@ -88,8 +88,8 @@ enum
9b746a
 };
9b746a
 
9b746a
 /* Auxiliary methods */
9b746a
-static const gchar *
9b746a
-get_icon_name_from_g_icon (GIcon *gicon)
9b746a
+static gchar *
9b746a
+get_symbolic_icon_name_from_g_icon (GIcon *gicon)
9b746a
 {
9b746a
   const gchar * const *names;
9b746a
   GtkIconTheme *icon_theme;
9b746a
@@ -103,8 +103,11 @@ get_icon_name_from_g_icon (GIcon *gicon)
9b746a
 
9b746a
   for (i = 0; names[i] != NULL; i++)
9b746a
     {
9b746a
-      if (gtk_icon_theme_has_icon (icon_theme, names[i]))
9b746a
-        return names[i];
9b746a
+      g_autofree gchar *name = NULL;
9b746a
+      name = g_strdup_printf ("%s-symbolic", names[i]);
9b746a
+
9b746a
+      if (gtk_icon_theme_has_icon (icon_theme, name))
9b746a
+        return g_steal_pointer (&name);
9b746a
     }
9b746a
 
9b746a
   return NULL;
9b746a
@@ -248,9 +251,8 @@ setup_model (CcWindow *shell)
9b746a
       g_autofree gchar *name = NULL;
9b746a
       g_autofree gchar *description = NULL;
9b746a
       g_autofree gchar *id = NULL;
9b746a
-      g_autofree gchar *symbolic_icon = NULL;
9b746a
+      g_autofree gchar *icon_name = NULL;
9b746a
       g_autofree GStrv keywords = NULL;
9b746a
-      const gchar *icon_name;
9b746a
 
9b746a
       gtk_tree_model_get (model, &iter,
9b746a
                           COL_CATEGORY, &category,
9b746a
@@ -261,8 +263,7 @@ setup_model (CcWindow *shell)
9b746a
                           COL_KEYWORDS, &keywords,
9b746a
                           -1);
9b746a
 
9b746a
-      icon_name = get_icon_name_from_g_icon (icon);
9b746a
-      symbolic_icon = g_strdup_printf ("%s-symbolic", icon_name);
9b746a
+      icon_name = get_symbolic_icon_name_from_g_icon (icon);
9b746a
 
9b746a
       cc_panel_list_add_panel (CC_PANEL_LIST (shell->panel_list),
9b746a
                                category,
9b746a
@@ -270,7 +271,7 @@ setup_model (CcWindow *shell)
9b746a
                                name,
9b746a
                                description,
9b746a
                                keywords,
9b746a
-                               symbolic_icon);
9b746a
+                               icon_name);
9b746a
 
9b746a
       valid = gtk_tree_model_iter_next (model, &iter);
9b746a
     }
9b746a
-- 
9b746a
2.17.0
9b746a