[gnome-control-center] shell: Icon name helper returns symbolic name
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] shell: Icon name helper returns symbolic name
- Date: Wed, 11 Apr 2018 12:33:25 +0000 (UTC)
commit 2889ab03b23446f45a9ba0d4befdd47553b7a083
Author: Christian Kellner <christian kellner me>
Date: Tue Apr 10 09:47:48 2018 +0200
shell: Icon name helper returns symbolic name
The helper function to get the icon name from a GIcon directly
returns the symbolic icon now. This makes it in turn possible
to also directly check if the theme has the icon with the symbolic
name instead of checking of for the full colored one and then
deriving the symbolic name from that. The latter (old) practice
will fail if there is a symbolic icon in the theme that has no
full color icon (like e.g. thunderbolt).
shell/cc-window.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/shell/cc-window.c b/shell/cc-window.c
index 22c7b546b..c0fc19446 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -91,8 +91,8 @@ enum
};
/* Auxiliary methods */
-static const gchar *
-get_icon_name_from_g_icon (GIcon *gicon)
+static gchar *
+get_symbolic_icon_name_from_g_icon (GIcon *gicon)
{
const gchar * const *names;
GtkIconTheme *icon_theme;
@@ -106,8 +106,11 @@ get_icon_name_from_g_icon (GIcon *gicon)
for (i = 0; names[i] != NULL; i++)
{
- if (gtk_icon_theme_has_icon (icon_theme, names[i]))
- return names[i];
+ g_autofree gchar *name = NULL;
+ name = g_strdup_printf ("%s-symbolic", names[i]);
+
+ if (gtk_icon_theme_has_icon (icon_theme, name))
+ return g_steal_pointer (&name);
}
return NULL;
@@ -265,9 +268,8 @@ setup_model (CcWindow *shell)
g_autofree gchar *name = NULL;
g_autofree gchar *description = NULL;
g_autofree gchar *id = NULL;
- g_autofree gchar *symbolic_icon = NULL;
+ g_autofree gchar *icon_name = NULL;
g_autofree GStrv keywords = NULL;
- const gchar *icon_name;
gtk_tree_model_get (model, &iter,
COL_CATEGORY, &category,
@@ -278,8 +280,7 @@ setup_model (CcWindow *shell)
COL_KEYWORDS, &keywords,
-1);
- icon_name = get_icon_name_from_g_icon (icon);
- symbolic_icon = g_strdup_printf ("%s-symbolic", icon_name);
+ icon_name = get_symbolic_icon_name_from_g_icon (icon);
cc_panel_list_add_panel (CC_PANEL_LIST (shell->panel_list),
category,
@@ -287,7 +288,7 @@ setup_model (CcWindow *shell)
name,
description,
keywords,
- symbolic_icon);
+ icon_name);
valid = gtk_tree_model_iter_next (model, &iter);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]