[gnome-software] Move the filename cache setting from the appstream plugin to icons
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Move the filename cache setting from the appstream plugin to icons
- Date: Tue, 26 Jul 2016 08:22:51 +0000 (UTC)
commit d8ce0625ae9807934d8f6973e2103fbd29bb2c32
Author: Richard Hughes <richard hughsie com>
Date: Tue Jul 26 09:09:05 2016 +0100
Move the filename cache setting from the appstream plugin to icons
This allows us to use the same cache logic for flatpak sources too.
src/plugins/gs-appstream.c | 14 +-------------
src/plugins/gs-plugin-icons.c | 12 ++++++++++--
2 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index f5f29da..4825092 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -100,20 +100,8 @@ gs_refine_item_icon (GsPlugin *plugin, GsApp *app, AsApp *item)
/* remote as a last resort */
icon = gs_appstream_get_icon_by_kind (item, AS_ICON_KIND_REMOTE);
- if (icon != NULL) {
- if (as_icon_get_filename (icon) == NULL) {
- g_autofree gchar *fn = NULL;
- g_autofree gchar *cachedir = NULL;
- fn = gs_utils_get_cache_filename ("icons",
- as_icon_get_name (icon),
- GS_UTILS_CACHE_FLAG_WRITEABLE,
- NULL);
- as_icon_set_filename (icon, fn);
- cachedir = g_path_get_basename (fn);
- as_icon_set_prefix (icon, cachedir);
- }
+ if (icon != NULL)
gs_app_add_icon (app, icon);
- }
}
static void
diff --git a/src/plugins/gs-plugin-icons.c b/src/plugins/gs-plugin-icons.c
index 8c1fe4c..3490039 100644
--- a/src/plugins/gs-plugin-icons.c
+++ b/src/plugins/gs-plugin-icons.c
@@ -144,9 +144,17 @@ gs_plugin_icons_load_remote (GsPlugin *plugin, AsIcon *icon, GError **error)
"icon has no URL");
return NULL;
}
+
+ /* set cache filename if not already set */
if (as_icon_get_filename (icon) == NULL) {
- g_error ("MOO");
- return NULL;
+ g_autofree gchar *fn_cache = NULL;
+ fn_cache = gs_utils_get_cache_filename ("icons",
+ as_icon_get_name (icon),
+ GS_UTILS_CACHE_FLAG_WRITEABLE,
+ error);
+ if (fn_cache == NULL)
+ return NULL;
+ as_icon_set_filename (icon, fn_cache);
}
/* a REMOTE that's really LOCAL */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]