[gnome-software] appstream: fallback to .svg icon if .png is not found



commit a43bb2b7e2fbb7f7cd4087dc6245f62d9472991c
Author: Dominique Leuenberger <dimstar opensuse org>
Date:   Mon Sep 23 20:26:54 2013 +0200

    appstream: fallback to .svg icon if .png is not found

 src/plugins/gs-plugin-appstream.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 81857a1..010f618 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -242,7 +242,17 @@ gs_plugin_refine_item_pixbuf (GsPlugin *plugin, GsApp *app, AppstreamApp *item)
                                                           &error);
                if (pixbuf == NULL) {
                        g_warning ("failed to load cached icon %s", icon_path);
-                       g_error_free (error);
+                       g_clear_error (&error);
+                       /* Maybe the icon exists as .svg */
+                       icon_path = g_strdup_printf ("%s/%s.svg", icon_dir, icon);
+                       pixbuf = gdk_pixbuf_new_from_file_at_size (icon_path,
+                                                                  plugin->pixbuf_size,
+                                                                  plugin->pixbuf_size,
+                                                                  &error);
+                       if (pixbuf == NULL) {
+                               g_warning ("failed to load cached icon %s", icon_path);
+                               g_error_free (error);
+                       }
                }
                break;
        default:


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