aboutsummaryrefslogtreecommitdiff
path: root/modules/computer.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-08-15 17:43:30 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2017-08-27 08:21:05 -0700
commit875b0e2aab4e9a80fd75996d1cf28281a4e5e341 (patch)
treeb0660d5001d427959597a370f08f95e27a55a3cf /modules/computer.c
parentaceb905d3750a438e9c6c08c65f97eda2166c56a (diff)
DMI: dmi_chassis_type_str() maps chassis-type to string
dmi_chassis_type_str() is moved from code in computer.c:detect_machine_type(). It makes sense to keep it with dmi, as it maps a dmi-defined value to a string. This way it can be used in both dmi.c and computer.c. Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/computer.c')
-rw-r--r--modules/computer.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/modules/computer.c b/modules/computer.c
index 42adf196..05d27ba6 100644
--- a/modules/computer.c
+++ b/modules/computer.c
@@ -307,41 +307,9 @@ static gchar *detect_machine_type(void)
GDir *dir;
gchar *chassis;
- chassis = dmi_get_str("chassis-type");
- if (chassis != NULL) {
- static const char *types[] = {
- N_("Invalid chassis type (0)"),
- N_("Unknown chassis type"), /* 1 is "Other", but not helpful in HardInfo */
- N_("Unknown chassis type"),
- N_("Desktop"),
- N_("Low-profile Desktop"),
- N_("Pizza Box"),
- N_("Mini Tower"),
- N_("Tower"),
- N_("Portable"),
- N_("Laptop"),
- N_("Notebook"),
- N_("Handheld"),
- N_("Docking Station"),
- N_("All-in-one"),
- N_("Subnotebook"),
- N_("Space-saving"),
- N_("Lunch Box"),
- N_("Main Server Chassis"),
- N_("Expansion Chassis"),
- N_("Sub Chassis"),
- N_("Bus Expansion Chassis"),
- N_("Peripheral Chassis"),
- N_("RAID Chassis"),
- N_("Rack Mount Chassis"),
- N_("Sealed-case PC"),
- };
- int chassis_type = atoi(chassis);
- g_free(chassis);
-
- if (chassis_type >= 0 && chassis_type < G_N_ELEMENTS(types))
- return g_strdup(_(types[chassis_type]));
- }
+ chassis = dmi_chassis_type_str(0);
+ if (chassis != NULL)
+ return chassis;
chassis = dtr_get_string("/model", 0);
if (chassis) {