app: Don't print "< 0 bytes"

Don't imply a download or install uses a negative number of bytes.
This commit is contained in:
Matthew Leeds
2020-01-27 11:49:54 -08:00
committed by Alexander Larsson
parent 5a94edaef3
commit bbd4ee68b4
2 changed files with 9 additions and 3 deletions

View File

@@ -499,7 +499,7 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
size = flatpak_deploy_data_get_installed_size (ext_deploy_data);
formatted = g_format_size (size);
subpaths = flatpak_deploy_data_get_subpaths (ext_deploy_data);
if (subpaths && subpaths[0])
if (subpaths && subpaths[0] && size > 0)
formatted_size = g_strconcat ("<", formatted, NULL);
else
formatted_size = g_steal_pointer (&formatted);

View File

@@ -1018,15 +1018,21 @@ transaction_ready (FlatpakTransaction *transaction)
guint64 download_size;
g_autofree char *formatted = NULL;
g_autofree char *text = NULL;
const char *prefix;
download_size = flatpak_transaction_operation_get_download_size (op);
formatted = g_format_size (download_size);
if (download_size > 0)
prefix = "< ";
else
prefix = "";
flatpak_table_printer_add_column (printer, remote);
if (g_str_has_suffix (flatpak_ref_get_name (rref), ".Locale"))
text = g_strdup_printf ("< %s (%s)", formatted, _("partial"));
text = g_strdup_printf ("%s%s (%s)", prefix, formatted, _("partial"));
else
text = g_strdup_printf ("< %s", formatted);
text = g_strdup_printf ("%s%s", prefix, formatted);
flatpak_table_printer_add_decimal_column (printer, text);
}