From 0f7434373f5226a7bf2c3e9f2e1344fd2fc8f466 Mon Sep 17 00:00:00 2001 From: Ondrej Čerman Date: Sat, 12 Dec 2020 14:33:25 +0100 Subject: devices/storage: S.M.A.R.T.: Used monotype font and changed printf format so the values are aligned to the cols --- modules/devices/storage.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/devices/storage.c b/modules/devices/storage.c index ff1c24de..82f633d3 100644 --- a/modules/devices/storage.c +++ b/modules/devices/storage.c @@ -317,7 +317,7 @@ gboolean __scan_udisks2_devices(void) { if (disk->smart_attributes != NULL) { moreinfo = h_strdup_cprintf(_("[S.M.A.R.T. Attributes]\n" - "Attribute=Value / Normalized / Worst / Threshold\n"), + "Attribute=Value / Normalized / Worst / Threshold\n"), moreinfo); attrib = disk->smart_attributes; @@ -347,20 +347,24 @@ gboolean __scan_udisks2_devices(void) { break; } + // pad spaces to next col + j = g_utf8_strlen(tmp, -1); + if (j < 13) tmp = h_strdup_cprintf("%*c", tmp, 13 - j, ' '); + if (attrib->value != -1) - tmp = h_strdup_cprintf(" / %3d", tmp, attrib->value); + tmp = h_strdup_cprintf("%-13d", tmp, attrib->value); else - tmp = h_strdup_cprintf(" / ???", tmp); + tmp = h_strdup_cprintf("%-13s", tmp, "???"); if (attrib->worst != -1) - tmp = h_strdup_cprintf(" / %3d", tmp, attrib->worst); + tmp = h_strdup_cprintf("%-8d", tmp, attrib->worst); else - tmp = h_strdup_cprintf(" / ???", tmp); + tmp = h_strdup_cprintf("%-8s", tmp, "???"); if (attrib->threshold != -1) - tmp = h_strdup_cprintf(" / %3d", tmp, attrib->threshold); + tmp = h_strdup_cprintf("%d", tmp, attrib->threshold); else - tmp = h_strdup_cprintf(" / ???", tmp); + tmp = h_strdup_cprintf("???", tmp); alabel = attrib->identifier; @@ -371,7 +375,7 @@ gboolean __scan_udisks2_devices(void) { } } - moreinfo = h_strdup_cprintf(_("(%d) %s=%s\n"), + moreinfo = h_strdup_cprintf(_("(%d) %s=%s\n"), moreinfo, attrib->id, alabel, tmp); g_free(tmp); -- cgit v1.2.3