From 875b0e2aab4e9a80fd75996d1cf28281a4e5e341 Mon Sep 17 00:00:00 2001 From: Burt P Date: Tue, 15 Aug 2017 17:43:30 -0500 Subject: 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 --- modules/computer.c | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'modules/computer.c') 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) { -- cgit v1.2.3