[network-manager-applet: 4/6] applet: also cache absent icon in nma_icon_check_and_load()
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet: 4/6] applet: also cache absent icon in nma_icon_check_and_load()
- Date: Sun, 13 Mar 2016 11:44:45 +0000 (UTC)
commit 1ee27445f75dc65cd05cceb2743787ab4f7712a9
Author: Thomas Haller <thaller redhat com>
Date: Sun Mar 13 10:56:42 2016 +0100
applet: also cache absent icon in nma_icon_check_and_load()
This way, we only log a warning about a missing icon once.
src/applet.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 39c6345..24fd213 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2943,16 +2943,14 @@ nma_icon_check_and_load (const char *name, NMApplet *applet)
g_assert (applet != NULL);
/* icon already loaded successfully */
- if ((icon = g_hash_table_lookup (applet->icon_cache, name)))
+ if (g_hash_table_lookup_extended (applet->icon_cache, name, NULL, (gpointer) &icon))
return icon;
/* Try to load the icon; if the load fails, log the problem, and set
* the icon to the fallback icon if requested.
*/
if (!(icon = gtk_icon_theme_load_icon (applet->icon_theme, name, applet->icon_size,
GTK_ICON_LOOKUP_FORCE_SIZE, &error))) {
- g_warning ("Icon %s missing: %s",
- name,
- error->message);
+ g_warning ("failed to load icon \"%s\": %s", name, error->message);
g_clear_error (&error);
if (applet->fallback_icon)
@@ -3252,7 +3250,7 @@ applet_startup (GApplication *app, gpointer user_data)
applet->icon_cache = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
- g_object_unref);
+ nm_g_object_unref);
nma_icons_init (applet);
if (!notify_is_initted ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]