[glib] Don't look for icons called "(null)" if no xdg mime icon



commit 936254c386b57ee61ccbba3fac659fc631a9cc9a
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Nov 30 09:39:13 2012 +0100

    Don't look for icons called "(null)" if no xdg mime icon

 gio/gcontenttype.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c
index 2de6957..6cc805c 100644
--- a/gio/gcontenttype.c
+++ b/gio/gcontenttype.c
@@ -401,13 +401,14 @@ g_content_type_get_icon_internal (const gchar *type,
   char *mimetype_icon;
   char *generic_mimetype_icon = NULL;
   char *q;
-  char *xdg_mimetype_icon;
+  char *xdg_mimetype_icon = NULL;
   char *legacy_mimetype_icon;
   char *xdg_mimetype_generic_icon;
   char *icon_names[5];
   int n = 0;
   GIcon *themed_icon;
   const char *file_template;
+  const char  *xdg_icon;
 
   g_return_val_if_fail (type != NULL, NULL);
 
@@ -421,8 +422,10 @@ g_content_type_get_icon_internal (const gchar *type,
     }
 
   G_LOCK (gio_xdgmime);
-  xdg_mimetype_icon = g_strdup_printf (file_template, xdg_mime_get_icon (type));
+  xdg_icon = xdg_mime_get_icon (type);
   G_UNLOCK (gio_xdgmime);
+  if (xdg_icon != NULL)
+    xdg_mimetype_icon = g_strdup_printf (file_template, xdg_icon);
   xdg_mimetype_generic_icon = g_content_type_get_generic_icon_name (type);
 
   mimetype_icon = g_strdup_printf (file_template, type);



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