libnmt-newt: use cleanup macro in nmt_newt_button_build_component()

This commit is contained in:
Thomas Haller 2021-05-06 21:39:30 +02:00
parent 853f411567
commit 61029d4064
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -108,18 +108,17 @@ nmt_newt_button_build_component(NmtNewtComponent *component, gboolean sensitive)
{
NmtNewtButtonPrivate *priv = NMT_NEWT_BUTTON_GET_PRIVATE(component);
newtComponent co;
gs_free char * label = NULL;
char * label_lc;
gs_free char * label_lc = NULL;
if (sensitive) {
label_lc = nmt_newt_locale_from_utf8(priv->label);
co = newtCompactButton(-1, -1, label_lc);
g_free(label_lc);
} else {
gs_free char *label = NULL;
label = g_strdup_printf(" <%s>", priv->label);
label_lc = nmt_newt_locale_from_utf8(label);
co = newtLabel(-1, -1, label_lc);
g_free(label_lc);
newtLabelSetColors(co, NMT_NEWT_COLORSET_DISABLED_BUTTON);
}