summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-04-27 12:58:55 +0200
committerAlexander Larsson <alexl@redhat.com>2016-04-27 12:58:55 +0200
commit5789c5c99d3ffeadb9c7ee69e80145fdcb199e53 (patch)
treed1bb23b99cd64b92bbf8dbb75622b2eb6803f071 /app
parentffb66703328d11527cf15eb5426ef03544bdf927 (diff)
downloadxdg-app-5789c5c99d3ffeadb9c7ee69e80145fdcb199e53.tar.gz
list: Use deploy data to avoid lots of seeks
Diffstat (limited to 'app')
-rw-r--r--app/xdg-app-builtins-list.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/app/xdg-app-builtins-list.c b/app/xdg-app-builtins-list.c
index d6b582a..0e5c1d1 100644
--- a/app/xdg-app-builtins-list.c
+++ b/app/xdg-app-builtins-list.c
@@ -119,9 +119,10 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo
{
char *ref, *partial_ref;
g_auto(GStrv) parts = NULL;
- g_autofree char *repo = NULL;
+ const char *repo = NULL;
gboolean is_user;
XdgAppDir *dir = NULL;
+ g_autoptr(GVariant) deploy_data = NULL;
if (system[s] == NULL)
is_user = TRUE;
@@ -146,7 +147,11 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo
parts = g_strsplit (ref, "/", -1);
partial_ref = strchr(ref, '/') + 1;
- repo = xdg_app_dir_get_origin (dir, ref, NULL, NULL);
+ deploy_data = xdg_app_dir_get_deploy_data (dir, ref, cancellable, error);
+ if (deploy_data == NULL)
+ return FALSE;
+
+ repo = xdg_app_deploy_data_get_origin (deploy_data);
if (opt_show_details)
{
@@ -154,7 +159,7 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo
g_autofree char *latest = NULL;
g_autofree char *size_s = NULL;
guint64 size = 0;
- g_auto(GStrv) subpaths = NULL;
+ g_autofree const char **subpaths = NULL;
latest = xdg_app_dir_read_latest (dir, repo, ref, NULL, NULL);
if (latest)
@@ -177,13 +182,10 @@ 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 ("?");
+ size = xdg_app_deploy_data_get_installed_size (deploy_data);
+ size_s = g_format_size (size);
xdg_app_table_printer_add_column (printer, size_s);
-
xdg_app_table_printer_add_column (printer, ""); /* Options */
if (print_user && print_system)
@@ -203,8 +205,8 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo
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)
+ subpaths = xdg_app_deploy_data_get_subpaths (deploy_data);
+ if (subpaths[0] == NULL)
xdg_app_table_printer_add_column (printer, "");
else
{