diff options
| author | Burt P <pburt0@gmail.com> | 2017-08-15 16:10:54 -0500 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2017-08-27 08:21:05 -0700 | 
| commit | 6fe6030a0b1d4534c2983b9bddee48f23af8e9af (patch) | |
| tree | 0a56812354c12627ce68366b5f718adef3b1a2a3 /modules | |
| parent | b908a4d67bf37ea35d698b48e68e6d0083943d94 (diff) | |
devices: tweak get_motherboard() to only use one translated string
Also, simplify now that an empty DMI string is returned as null.
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/devices.c | 18 | 
1 files changed, 10 insertions, 8 deletions
| diff --git a/modules/devices.c b/modules/devices.c index 16c68c1b..793df998 100644 --- a/modules/devices.c +++ b/modules/devices.c @@ -366,23 +366,25 @@ gchar *get_motherboard(void)      scan_dmi(FALSE);      board_name = dmi_get_str("baseboard-product-name"); -    if (board_name == NULL || !strlen(board_name) ) +    if (board_name == NULL)          board_name = dmi_get_str("system-product-name"); -    if (board_name == NULL || !strlen(board_name) ) -        board_name = strdup(_(" (model unknown)"));      board_vendor = dmi_get_str("baseboard-manufacturer"); -    if (board_vendor == NULL || !strlen(board_vendor) ) +    if (board_vendor == NULL)          board_vendor = dmi_get_str("system-manufacturer"); -    if (board_vendor == NULL || !strlen(board_vendor) ) -        board_vendor = strdup(_(" (vendor unknown)"));      product_version = dmi_get_str("system-product-version"); -    if (product_version && strlen(product_version) ) +    if (board_name && board_vendor && product_version)          ret = g_strdup_printf("%s / %s (%s)", product_version, board_name, board_vendor); -    else +    else if (board_name && board_vendor)          ret = g_strconcat(board_vendor, " ", board_name, NULL); +    else if (board_name) +        ret = g_strdup(board_name); +    else if (board_vendor) +        ret = g_strdup(board_vendor); +    else +        ret = g_strdup(_("(Unknown)"));      free(board_name);      free(board_vendor); | 
