[gnome-software: 13/18] gs-overview-page: Hide apps with low-res icons from featured carousel
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 13/18] gs-overview-page: Hide apps with low-res icons from featured carousel
- Date: Wed, 10 Mar 2021 15:03:49 +0000 (UTC)
commit 8fecc6edc85e22dad511769e98e7e901edc64b4f
Author: Philip Withnall <pwithnall endlessos org>
Date: Fri Mar 5 12:00:23 2021 +0000
gs-overview-page: Hide apps with low-res icons from featured carousel
Otherwise the carousel will render them without an icon, which looks
weird.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1147
src/gs-overview-page.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
index c5bf3c843..32bc14a77 100644
--- a/src/gs-overview-page.c
+++ b/src/gs-overview-page.c
@@ -354,6 +354,22 @@ out:
gs_overview_page_decrement_action_cnt (self);
}
+static gboolean
+filter_hi_res_icon (GsApp *app, gpointer user_data)
+{
+ g_autoptr(GIcon) icon = NULL;
+ GtkWidget *overview_page = GTK_WIDGET (user_data);
+
+ /* This is the minimum icon size needed by `GsFeatureTile`. */
+ icon = gs_app_get_icon_for_size (app,
+ 128,
+ gtk_widget_get_scale_factor (overview_page),
+ NULL);
+
+ /* Returning TRUE means to keep the app in the list */
+ return (icon != NULL);
+}
+
static void
gs_overview_page_get_featured_cb (GObject *source_object,
GAsyncResult *res,
@@ -383,6 +399,9 @@ gs_overview_page_get_featured_cb (GObject *source_object,
gs_app_list_randomize (list);
}
+ /* Filter out apps which don’t have a suitable hi-res icon. */
+ gs_app_list_filter (list, filter_hi_res_icon, self);
+
gtk_widget_set_visible (priv->featured_carousel, gs_app_list_length (list) > 0);
gs_featured_carousel_set_apps (GS_FEATURED_CAROUSEL (priv->featured_carousel), list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]