[gnome-software/1435-storage-tile-better-label-for-the-case-that-there-s-no-data-or-cache] gs-app-context-bar: Do not show '0 bytes' in the app cache/data sizes



commit ef5653e647a261c0d7f31869c1f0c81a7ccb352f
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 1 12:22:16 2021 +0100

    gs-app-context-bar: Do not show '0 bytes' in the app cache/data sizes
    
    Treat `0` user data or cache as `unknown`, to not show '0 bytes' in the text.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1435

 src/gs-app-context-bar.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/gs-app-context-bar.c b/src/gs-app-context-bar.c
index 466c1747c..3acc8fe7a 100644
--- a/src/gs-app-context-bar.c
+++ b/src/gs-app-context-bar.c
@@ -129,6 +129,12 @@ update_storage_tile (GsAppContextBar *self)
                g_autofree gchar *size_user_data_str = NULL;
                g_autofree gchar *size_cache_data_str = NULL;
 
+               /* Treat `0` sizes as `unknown`, to not show `0 bytes` in the text. */
+               if (size_user_data == 0)
+                       size_user_data = GS_APP_SIZE_UNKNOWABLE;
+               if (size_cache_data == 0)
+                       size_cache_data = GS_APP_SIZE_UNKNOWABLE;
+
                /* If any installed sizes are unknowable, ignore them. This
                 * means the stated installed size is a lower bound on the
                 * actual installed size.


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