[gnome-software/1177-after-os-installation-a-software-updates-available-to-download-notification-is-shown] packagekit: Set download size to 0 after the package is downloaded



commit e3e1f8c19d347374e6e42cc10729ede38a91b29d
Author: Milan Crha <mcrha redhat com>
Date:   Wed Mar 17 19:22:55 2021 +0100

    packagekit: Set download size to 0 after the package is downloaded
    
    Once the package is downloaded there is no additional data to be downloaded,
    thus reset the download size to zero. This is also used to recognize whether
    the application is downloaded or not.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1177

 plugins/packagekit/gs-plugin-packagekit-refresh.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/plugins/packagekit/gs-plugin-packagekit-refresh.c 
b/plugins/packagekit/gs-plugin-packagekit-refresh.c
index b77827ff3..e3d282c1d 100644
--- a/plugins/packagekit/gs-plugin-packagekit-refresh.c
+++ b/plugins/packagekit/gs-plugin-packagekit-refresh.c
@@ -59,6 +59,7 @@ _download_only (GsPlugin *plugin, GsAppList *list,
        g_autoptr(PkPackageSack) sack = NULL;
        g_autoptr(PkResults) results2 = NULL;
        g_autoptr(PkResults) results = NULL;
+       guint i;
 
        /* get the list of packages to update */
        gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_WAITING);
@@ -83,7 +84,7 @@ _download_only (GsPlugin *plugin, GsAppList *list,
        if (pk_package_sack_get_size (sack) == 0)
                return TRUE;
        package_ids = pk_package_sack_get_ids (sack);
-       for (guint i = 0; i < gs_app_list_length (list); i++) {
+       for (i = 0; i < gs_app_list_length (list); i++) {
                GsApp *app = gs_app_list_index (list, i);
                gs_packagekit_helper_add_app (helper, app);
        }
@@ -102,6 +103,11 @@ _download_only (GsPlugin *plugin, GsAppList *list,
                gs_plugin_packagekit_error_convert (error);
                return FALSE;
        }
+       for (i = 0; i < gs_app_list_length (list); i++) {
+               GsApp *app = gs_app_list_index (list, i);
+               /* To indicate the app is already downloaded */
+               gs_app_set_size_download (app, 0);
+       }
        return TRUE;
 }
 


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