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

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