Skip to content

Commit 4da1b5d

Browse files
sidt4ximion
authored andcommitted
pkcon: Add 'download-size' to 'get-details' command
1 parent 8953cf4 commit 4da1b5d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

client/pk-console.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,15 @@ pk_console_details_cb (PkDetails *item, gpointer data)
449449
{
450450
PkGroupEnum group;
451451
guint64 size;
452+
guint64 download_size;
452453
g_autofree gchar *description = NULL;
453454
g_autofree gchar *license = NULL;
454455
g_autofree gchar *package_id = NULL;
455456
g_autofree gchar *package = NULL;
456457
g_autofree gchar *summary = NULL;
457458
g_autofree gchar *url = NULL;
458459
g_autofree gchar *size_str = NULL;
460+
g_autofree gchar *download_size_str = NULL;
459461

460462
/* get data */
461463
g_object_get (item,
@@ -466,6 +468,7 @@ pk_console_details_cb (PkDetails *item, gpointer data)
466468
"summary", &summary,
467469
"group", &group,
468470
"size", &size,
471+
"download-size", &download_size,
469472
NULL);
470473

471474
/* create printable */
@@ -476,12 +479,18 @@ pk_console_details_cb (PkDetails *item, gpointer data)
476479
else
477480
size_str = g_format_size_full (size, G_FORMAT_SIZE_LONG_FORMAT);
478481

482+
if (download_size == G_MAXUINT64)
483+
download_size_str = g_strdup ("unknown");
484+
else
485+
download_size_str = g_format_size_full (download_size, G_FORMAT_SIZE_LONG_FORMAT);
486+
479487
/* TRANSLATORS: This a list of details about the package */
480488
g_print ("%s\n", _("Package description"));
481489
g_print (" package: %s\n", package);
482490
g_print (" summary: %s\n", summary);
483491
g_print (" license: %s\n", license);
484492
g_print (" group: %s\n", pk_group_enum_to_string (group));
493+
g_print (" download size: %s\n", download_size_str);
485494
g_print (" size: %s\n", size_str);
486495
g_print (" url: %s\n", url);
487496
g_print (" description: %s\n", description);

0 commit comments

Comments
 (0)