[gnome-software] epiphany: Do not download the webapp icon very time Refine() is called



commit 4fa2807f15c6e077d42d16754cb2876bdd9c1bbc
Author: Richard Hughes <richard hughsie com>
Date:   Fri Oct 18 15:28:23 2013 +0100

    epiphany: Do not download the webapp icon very time Refine() is called

 src/plugins/gs-plugin-epiphany.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index 3e8e6e1..52da747 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -543,20 +543,22 @@ gs_plugin_refine_app (GsPlugin *plugin, GsApp *app, GError **error)
        hash = g_compute_checksum_for_string (G_CHECKSUM_SHA1, gs_app_get_name (app), -1);
        gs_app_set_metadata (app, "Epiphany::hash", hash);
 
-       /* download icon */
+       /* download icon if it does not exist */
        filename_icon = g_strdup_printf ("%s/epiphany/app-%s-%s/app-icon.png",
                                         g_get_user_config_dir (),
                                         gs_app_get_id (app),
                                         hash);
-       ret = gs_mkdir_parent (filename_icon, error);
-       if (!ret)
-               goto out;
-       ret = gs_plugin_epiphany_download (plugin,
-                                          gs_app_get_icon (app),
-                                          filename_icon,
-                                          error);
-       if (!ret)
-               goto out;
+       if (!g_file_test (filename_icon, G_FILE_TEST_EXISTS)) {
+               ret = gs_mkdir_parent (filename_icon, error);
+               if (!ret)
+                       goto out;
+               ret = gs_plugin_epiphany_download (plugin,
+                                                  gs_app_get_icon (app),
+                                                  filename_icon,
+                                                  error);
+               if (!ret)
+                       goto out;
+       }
 
        /* set local icon name */
        ret = gs_app_set_icon (app, filename_icon, error);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]