[gnome-font-viewer] Fix fallback icon loading



commit a7b27a472f79be866a3d11c582e4a625438ed362
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 19 14:31:41 2018 +0100

    Fix fallback icon loading
    
    It seems that the official mime type for ttf fonts is now
    font/ttf, and the alias does not work right for loading icons.
    
    Also, add a warning if loading the icon fails.

 src/font-model.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/font-model.c b/src/font-model.c
index 9d7edf6..99b1f0e 100644
--- a/src/font-model.c
+++ b/src/font-model.c
@@ -357,20 +357,23 @@ ensure_fallback_icon (FontViewModel *self)
 {
     GtkIconTheme *icon_theme;
     GtkIconInfo *icon_info;
+    const char *mimetype = "font/ttf";
     GIcon *icon = NULL;
 
     if (self->priv->fallback_icon != NULL)
         return;
 
     icon_theme = gtk_icon_theme_get_default ();
-    icon = g_content_type_get_icon ("application/x-font-ttf");
+    icon = g_content_type_get_icon (mimetype);
     icon_info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme, icon,
                                                           128, self->priv->scale_factor,
                                                           GTK_ICON_LOOKUP_FORCE_SIZE);
     g_object_unref (icon);
 
-    if (!icon_info)
+    if (!icon_info) {
+        g_warning ("Fallback icon for %s not found", mimetype);
         return;
+    }
 
     self->priv->fallback_icon = gtk_icon_info_load_surface (icon_info, NULL, NULL);
     g_object_unref (icon_info);


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