From 40de2612a78f82e800fd19f8daaa665479cbd8d4 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Thu, 15 Oct 2015 14:02:01 +0200 Subject: [PATCH] Backport a patch to fix icons in gnome-software for apps without AppData --- ...al-with-icons-that-have-extension-or.patch | 46 +++++++++++++++++++ libappstream-glib.spec | 8 +++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 0001-Try-harder-to-deal-with-icons-that-have-extension-or.patch diff --git a/0001-Try-harder-to-deal-with-icons-that-have-extension-or.patch b/0001-Try-harder-to-deal-with-icons-that-have-extension-or.patch new file mode 100644 index 0000000..b7c02d2 --- /dev/null +++ b/0001-Try-harder-to-deal-with-icons-that-have-extension-or.patch @@ -0,0 +1,46 @@ +From 01e48c3cd5f4d06e8aec0d33cffdff9fb5bc9d3d Mon Sep 17 00:00:00 2001 +From: Kalev Lember +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 + diff --git a/libappstream-glib.spec b/libappstream-glib.spec index 252c8a4..b158b58 100644 --- a/libappstream-glib.spec +++ b/libappstream-glib.spec @@ -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 0.5.1-2 +- Backport a patch to fix icons in gnome-software for apps without AppData + * Tue Sep 15 2015 Richard Hughes 0.5.1-1 - New upstream release - Add a few applications that have changed desktop ID