From 5a1fe292dd1529800ffc6a821b3ea99b8e9a90c3 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 20 Mar 2024 13:53:38 +0100 Subject: [PATCH 1/3] data: Bundle application-x-executable icon Just in case an icon theme won't provide it. --- data/icons/application-x-executable.svg | 37 +++++++++++++++++++++++++ src/gnome-software.gresource.xml | 1 + 2 files changed, 38 insertions(+) create mode 100644 data/icons/application-x-executable.svg diff --git a/data/icons/application-x-executable.svg b/data/icons/application-x-executable.svg new file mode 100644 index 000000000..a2f038e43 --- /dev/null +++ b/data/icons/application-x-executable.svg @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/gnome-software.gresource.xml b/src/gnome-software.gresource.xml index 97dd7ff31..107580dfe 100644 --- a/src/gnome-software.gresource.xml +++ b/src/gnome-software.gresource.xml @@ -110,5 +110,6 @@ ../data/icons/verified-checkmark-symbolic.svg ../data/icons/content-loading-symbolic.svg ../data/icons/info-symbolic.svg + ../data/icons/application-x-executable.svg -- GitLab From 54240da7d75bb6573665b0639e99e24cfd2319f9 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 20 Mar 2024 13:54:34 +0100 Subject: [PATCH 2/3] gs-app: Verify existence of every icon size before using it Even the icon should be available, it not always is, thus always verify the icon existence, to not return a non-existent icon. --- lib/gs-app.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/gs-app.c b/lib/gs-app.c index 5d507e1b5..fa266cdc1 100644 --- a/lib/gs-app.c +++ b/lib/gs-app.c @@ -1976,17 +1976,14 @@ gs_app_get_icon_for_size (GsApp *app, GIcon *icon = priv->icons->pdata[i]; g_autofree gchar *icon_str = g_icon_to_string (icon); guint icon_width = gs_icon_get_width (icon); - guint icon_height = gs_icon_get_height (icon); guint icon_scale = gs_icon_get_scale (icon); g_debug ("\tConsidering icon of type %s (%s), width %u×%u", G_OBJECT_TYPE_NAME (icon), icon_str, icon_width, icon_scale); /* To avoid excessive I/O, the loading of AppStream data does - * not verify the existence of cached icons, which we do now. - * Since AppStream only guarantees that the 64x64@1 cached icon - * is present, ignore other icons if they do not exist. */ - if (G_IS_FILE_ICON (icon) && !(icon_width == 64 && icon_height == 64 && icon_scale == 1)) { + * not verify the existence of cached icons, which we do now. */ + if (G_IS_FILE_ICON (icon)) { GFile *file = g_file_icon_get_file (G_FILE_ICON (icon)); if (!g_file_query_exists (file, NULL)) { continue; -- GitLab From 2b0120aaee99ce48e6837be12572cd43d7ec5ba4 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 20 Mar 2024 13:56:29 +0100 Subject: [PATCH 3/3] gui: Fallback to "application-x-executable" icon instead of "system-component-application" The "application-x-executable" seems to be more suitable as a fallback when the app's icon could not be found for some reason. Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/2353 --- src/gs-app-details-page.c | 2 +- src/gs-app-row.c | 2 +- src/gs-details-page.c | 2 +- src/gs-summary-tile.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gs-app-details-page.c b/src/gs-app-details-page.c index 65bb0000c..b63a96dae 100644 --- a/src/gs-app-details-page.c +++ b/src/gs-app-details-page.c @@ -263,7 +263,7 @@ set_updates_description_ui (GsAppDetailsPage *page, GsApp *app) icon = gs_app_get_icon_for_size (app, icon_size, gtk_widget_get_scale_factor (GTK_WIDGET (page)), - "system-component-application"); + "application-x-executable"); } display = gdk_display_get_default (); diff --git a/src/gs-app-row.c b/src/gs-app-row.c index a60c72cec..7a5a23afd 100644 --- a/src/gs-app-row.c +++ b/src/gs-app-row.c @@ -513,7 +513,7 @@ gs_app_row_actually_refresh (GsAppRow *app_row) icon = gs_app_get_icon_for_size (priv->app, gtk_image_get_pixel_size (GTK_IMAGE (priv->image)), gtk_widget_get_scale_factor (priv->image), - "system-component-application"); + "application-x-executable"); gtk_image_set_from_gicon (GTK_IMAGE (priv->image), icon); if (missing_search_result) diff --git a/src/gs-details-page.c b/src/gs-details-page.c index ff1c45198..41ea5e748 100644 --- a/src/gs-details-page.c +++ b/src/gs-details-page.c @@ -1363,7 +1363,7 @@ gs_details_page_refresh_all (GsDetailsPage *self) { 128, NULL }, { 96, NULL }, { 64, NULL }, - { 128, "system-component-application" }, + { 128, "application-x-executable" }, }; for (gsize i = 0; i < G_N_ELEMENTS (icon_fallbacks) && icon == NULL; i++) { diff --git a/src/gs-summary-tile.c b/src/gs-summary-tile.c index 04b6aec5d..80bc517cd 100644 --- a/src/gs-summary-tile.c +++ b/src/gs-summary-tile.c @@ -116,7 +116,7 @@ gs_summary_tile_refresh (GsAppTile *self) icon = gs_app_get_icon_for_size (app, gtk_image_get_pixel_size (GTK_IMAGE (tile->image)), gtk_widget_get_scale_factor (tile->image), - "system-component-application"); + "application-x-executable"); gtk_image_set_from_gicon (GTK_IMAGE (tile->image), icon); gtk_stack_set_visible_child_name (GTK_STACK (tile->image_stack), "image"); break; -- GitLab