diff options
author | Ondrej Čerman <ondrej.cerman@gmail.com> | 2020-12-12 14:33:25 +0100 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2020-12-12 11:58:05 -0800 |
commit | 0f7434373f5226a7bf2c3e9f2e1344fd2fc8f466 (patch) | |
tree | 9964dc95bb11668fbf6489e75b683bb85387cf2d /modules/devices/storage.c | |
parent | 0893af788fb5b4ed05adb8efee0697eb6c63f866 (diff) |
devices/storage: S.M.A.R.T.: Used monotype font and changed printf format so the values are aligned to the cols
Diffstat (limited to 'modules/devices/storage.c')
-rw-r--r-- | modules/devices/storage.c | 20 |
1 files changed, 12 insertions, 8 deletions
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=<tt>Value / Normalized / Worst / Threshold</tt>\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=<tt>%s</tt>\n"), moreinfo, attrib->id, alabel, tmp); g_free(tmp); |