Backport a patch to fix icons in gnome-software for apps without AppData

This commit is contained in:
Kalev Lember 2015-10-15 14:02:01 +02:00
parent 42f0ba4d61
commit 40de2612a7
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From 01e48c3cd5f4d06e8aec0d33cffdff9fb5bc9d3d Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Wed, 14 Oct 2015 18:08:48 +0200
Subject: [PATCH] Try harder to deal with icons that have extension or full
path listed
It's a common mistake in desktop files to list icons with extension,
such as 'filename.png'. Try harder to handle them and special case
common extensions; also while at this, make sure to handle icons
with full path as well.
---
libappstream-glib/as-app-desktop.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/libappstream-glib/as-app-desktop.c b/libappstream-glib/as-app-desktop.c
index 05f2556..07602fa 100644
--- a/libappstream-glib/as-app-desktop.c
+++ b/libappstream-glib/as-app-desktop.c
@@ -166,10 +166,21 @@ as_app_parse_file_key (AsApp *app,
if (tmp != NULL && tmp[0] != '\0') {
g_autoptr(AsIcon) icon = NULL;
icon = as_icon_new ();
+
+ if (g_path_is_absolute (tmp)) {
+ as_icon_set_filename (icon, tmp);
+ } else {
+ /* Work around a common mistake in desktop files */
+ dot = g_strstr_len (tmp, -1, ".");
+ if (dot != NULL &&
+ (g_strcmp0 (dot, ".png") == 0 ||
+ g_strcmp0 (dot, ".xpm") == 0 ||
+ g_strcmp0 (dot, ".svg") == 0)) {
+ *dot = '\0';
+ }
+ }
as_icon_set_name (icon, tmp);
- dot = g_strstr_len (tmp, -1, ".");
- if (dot != NULL)
- *dot = '\0';
+
if (as_utils_is_stock_icon_name (tmp)) {
as_icon_set_name (icon, tmp);
as_icon_set_kind (icon, AS_ICON_KIND_STOCK);
--
2.5.0

View File

@ -1,10 +1,12 @@
Summary: Library for AppStream metadata
Name: libappstream-glib
Version: 0.5.1
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPLv2+
URL: http://people.freedesktop.org/~hughsient/appstream-glib/
Source0: http://people.freedesktop.org/~hughsient/appstream-glib/releases/appstream-glib-%{version}.tar.xz
# Backported from upstream
Patch0: 0001-Try-harder-to-deal-with-icons-that-have-extension-or.patch
BuildRequires: glib2-devel >= 2.45.8
BuildRequires: libtool
@ -68,6 +70,7 @@ GLib headers and libraries for appstream-builder.
%prep
%setup -q -n appstream-glib-%{version}
%patch0 -p1
%build
%configure \
@ -131,6 +134,9 @@ make install DESTDIR=$RPM_BUILD_ROOT
%{_datadir}/gir-1.0/AppStreamBuilder-1.0.gir
%changelog
* Thu Oct 15 2015 Kalev Lember <klember@redhat.com> 0.5.1-2
- Backport a patch to fix icons in gnome-software for apps without AppData
* Tue Sep 15 2015 Richard Hughes <richard@hughsie.com> 0.5.1-1
- New upstream release
- Add a few applications that have changed desktop ID