[epiphany] downloads: Ensure we always fallback to package icon



commit 3e66bc83d562502d4a1c43e5699f135ddfc58ac4
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Tue Mar 1 08:17:21 2016 +0100

    downloads: Ensure we always fallback to package icon
    
    If the icon for the given content type and its fallbacks are not found
    in the theme, GtkImage uses the missing icon. We want to always fallback
    to package icon instead, so ensure it be appending it to the list of
    icons names used.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762825

 lib/widgets/ephy-download-widget.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/lib/widgets/ephy-download-widget.c b/lib/widgets/ephy-download-widget.c
index 8e16bda..ed11528 100644
--- a/lib/widgets/ephy-download-widget.c
+++ b/lib/widgets/ephy-download-widget.c
@@ -137,9 +137,18 @@ update_download_icon (EphyDownloadWidget *widget)
   const char *content_type;
 
   content_type = ephy_download_get_content_type (widget->download);
-  if (content_type)
+  if (content_type) {
     icon = g_content_type_get_symbolic_icon (content_type);
-  else
+    /* g_content_type_get_symbolic_icon() always creates a GThemedIcon, but we check it
+     * here just in case that changes in GLib eventually.
+     */
+    if (G_IS_THEMED_ICON (icon)) {
+      /* Ensure we always fallback to package-x-generic-symbolic if all other icons are
+       * missing in the theme.
+       */
+      g_themed_icon_append_name (G_THEMED_ICON (icon), "package-x-generic-symbolic");
+    }
+  } else
     icon = g_icon_new_for_string ("package-x-generic-symbolic", NULL);
 
   gtk_image_set_from_gicon (GTK_IMAGE (widget->icon), icon, GTK_ICON_SIZE_MENU);


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