[gnome-software] trivial: Allow using app tiles if no pixbuf has been set



commit 8327e980b2a70a3e50038488aa1686dce2db7245
Author: Richard Hughes <richard hughsie com>
Date:   Mon May 8 11:06:03 2017 +0100

    trivial: Allow using app tiles if no pixbuf has been set

 src/gs-popular-tile.c |    8 +++++++-
 src/gs-summary-tile.c |    7 ++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-popular-tile.c b/src/gs-popular-tile.c
index eddc456..534546a 100644
--- a/src/gs-popular-tile.c
+++ b/src/gs-popular-tile.c
@@ -128,7 +128,13 @@ gs_popular_tile_set_app (GsAppTile *app_tile, GsApp *app)
        gs_utils_widget_set_css_app (app, GTK_WIDGET (tile),
                                     "GnomeSoftware::PopularTile-css");
 
-       gs_image_set_from_pixbuf (GTK_IMAGE (tile->image), gs_app_get_pixbuf (tile->app));
+       if (gs_app_get_pixbuf (tile->app) != NULL) {
+               gs_image_set_from_pixbuf (GTK_IMAGE (tile->image), gs_app_get_pixbuf (tile->app));
+       } else {
+               gtk_image_set_from_icon_name (GTK_IMAGE (tile->image),
+                                             "application-x-executable",
+                                             GTK_ICON_SIZE_DIALOG);
+       }
 
        gtk_label_set_label (GTK_LABEL (tile->label), gs_app_get_name (app));
 }
diff --git a/src/gs-summary-tile.c b/src/gs-summary-tile.c
index 6011aeb..720a438 100644
--- a/src/gs-summary-tile.c
+++ b/src/gs-summary-tile.c
@@ -136,8 +136,13 @@ gs_summary_tile_set_app (GsAppTile *app_tile, GsApp *app)
        app_state_changed (tile->app, NULL, tile);
 
        pixbuf = gs_app_get_pixbuf (app);
-       if (pixbuf != NULL)
+       if (pixbuf != NULL) {
                gs_image_set_from_pixbuf (GTK_IMAGE (tile->image), pixbuf);
+       } else {
+               gtk_image_set_from_icon_name (GTK_IMAGE (tile->image),
+                                             "application-x-executable",
+                                             GTK_ICON_SIZE_DIALOG);
+       }
        gtk_label_set_label (GTK_LABEL (tile->name), gs_app_get_name (app));
 
        /* perhaps set custom css */


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