From e4d3a7da5a2d5fa4aef4904721b0339baf850c51 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 27 Apr 2016 10:23:04 +0200 Subject: list: Show installed size and subpaths --- app/xdg-app-builtins-list.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'app') diff --git a/app/xdg-app-builtins-list.c b/app/xdg-app-builtins-list.c index 9c8423c..d6b582a 100644 --- a/app/xdg-app-builtins-list.c +++ b/app/xdg-app-builtins-list.c @@ -152,6 +152,9 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo { g_autofree char *active = xdg_app_dir_read_active (dir, ref, NULL); g_autofree char *latest = NULL; + g_autofree char *size_s = NULL; + guint64 size = 0; + g_auto(GStrv) subpaths = NULL; latest = xdg_app_dir_read_latest (dir, repo, ref, NULL, NULL); if (latest) @@ -174,6 +177,13 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo xdg_app_table_printer_add_column (printer, active); xdg_app_table_printer_add_column (printer, latest); + if (xdg_app_dir_get_installed_size (dir, active, &size, cancellable, NULL)) + size_s = g_format_size (size); + else + size_s = g_strdup ("?"); + xdg_app_table_printer_add_column (printer, size_s); + + xdg_app_table_printer_add_column (printer, ""); /* Options */ if (print_user && print_system) @@ -192,6 +202,17 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo if (app) xdg_app_table_printer_append_with_comma (printer, "runtime"); } + + subpaths = xdg_app_dir_get_subpaths (dir, ref, cancellable, NULL); + if (subpaths == NULL || subpaths[0] == NULL) + xdg_app_table_printer_add_column (printer, ""); + else + { + int i; + xdg_app_table_printer_add_column (printer, ""); /* subpaths */ + for (i = 0; subpaths[i] != NULL; i++) + xdg_app_table_printer_append_with_comma (printer, subpaths[i]); + } } else { -- cgit v1.2.1