clean up _binding_label_get to just return the correct value, fix potential garbage return

SVN revision: 55730
This commit is contained in:
Mike Blumenkrantz 2010-12-23 00:51:49 +00:00
parent 5020fd62b0
commit 0e31d51ba6
1 changed files with 27 additions and 31 deletions

View File

@ -341,43 +341,39 @@ _selected_action_get(E_Config_Dialog_Data *cfdata)
static const char * static const char *
_binding_label_get(E_Config_Binding_Acpi *bind) _binding_label_get(E_Config_Binding_Acpi *bind)
{ {
char *ret;
if (bind->type == E_ACPI_TYPE_UNKNOWN) return NULL; if (bind->type == E_ACPI_TYPE_UNKNOWN) return NULL;
else if (bind->type == E_ACPI_TYPE_AC_ADAPTER) if (bind->type == E_ACPI_TYPE_AC_ADAPTER)
{ {
ret = _("Ac Adapter"); if (bind->status == 0) return _("AC Adapter Unplugged");
if (bind->status == 0) ret = _("AC Adapter Unplugged"); if (bind->status == 1) return _("AC Adapter Plugged");
else if (bind->status == 1) return _("Ac Adapter");
ret = _("AC Adapter Plugged");
} }
else if (bind->type == E_ACPI_TYPE_BATTERY) if (bind->type == E_ACPI_TYPE_BATTERY)
ret = _("Battery"); return _("Battery");
else if (bind->type == E_ACPI_TYPE_BUTTON) if (bind->type == E_ACPI_TYPE_BUTTON)
ret = _("Button"); return _("Button");
else if (bind->type == E_ACPI_TYPE_FAN) if (bind->type == E_ACPI_TYPE_FAN)
ret = _("Fan"); return _("Fan");
else if (bind->type == E_ACPI_TYPE_LID) if (bind->type == E_ACPI_TYPE_LID)
{ {
ret = _("Lid"); if (bind->status == 0) return _("Lid Closed");
if (bind->status == 0) ret = _("Lid Closed"); if (bind->status == 1) return _("Lid Opened");
else if (bind->status == 1) return _("Lid");
ret = _("Lid Opened");
} }
else if (bind->type == E_ACPI_TYPE_POWER) if (bind->type == E_ACPI_TYPE_POWER)
ret = _("Power Button"); return _("Power Button");
else if (bind->type == E_ACPI_TYPE_PROCESSOR) if (bind->type == E_ACPI_TYPE_PROCESSOR)
ret = _("Processor"); return _("Processor");
else if (bind->type == E_ACPI_TYPE_SLEEP) if (bind->type == E_ACPI_TYPE_SLEEP)
ret = _("Sleep Button"); return _("Sleep Button");
else if (bind->type == E_ACPI_TYPE_THERMAL) if (bind->type == E_ACPI_TYPE_THERMAL)
ret = _("Thermal"); return _("Thermal");
else if (bind->type == E_ACPI_TYPE_VIDEO) if (bind->type == E_ACPI_TYPE_VIDEO)
ret = _("Video"); return _("Video");
else if (bind->type == E_ACPI_TYPE_WIFI) if (bind->type == E_ACPI_TYPE_WIFI)
ret = _("Wifi"); return _("Wifi");
return ret; return NULL;
} }
static void static void