diff options
Diffstat (limited to 'textscreen')
-rw-r--r-- | textscreen/txt_separator.c | 24 | ||||
-rw-r--r-- | textscreen/txt_separator.h | 10 |
2 files changed, 25 insertions, 9 deletions
diff --git a/textscreen/txt_separator.c b/textscreen/txt_separator.c index 6b779626..563d0c62 100644 --- a/textscreen/txt_separator.c +++ b/textscreen/txt_separator.c @@ -80,6 +80,20 @@ static void TXT_SeparatorDestructor(TXT_UNCAST_ARG(separator)) free(separator->label); } +void TXT_SetSeparatorLabel(txt_separator_t *separator, char *label) +{ + free(separator->label); + + if (label != NULL) + { + separator->label = strdup(label); + } + else + { + separator->label = NULL; + } +} + txt_widget_class_t txt_separator_class = { TXT_NeverSelectable, @@ -99,14 +113,8 @@ txt_separator_t *TXT_NewSeparator(char *label) TXT_InitWidget(separator, &txt_separator_class); - if (label != NULL) - { - separator->label = strdup(label); - } - else - { - separator->label = NULL; - } + separator->label = NULL; + TXT_SetSeparatorLabel(separator, label); return separator; } diff --git a/textscreen/txt_separator.h b/textscreen/txt_separator.h index 2f2331da..f693d70e 100644 --- a/textscreen/txt_separator.h +++ b/textscreen/txt_separator.h @@ -59,6 +59,14 @@ extern txt_widget_class_t txt_separator_class; txt_separator_t *TXT_NewSeparator(char *label); -#endif /* #ifndef TXT_SEPARATOR_H */ +/** + * Change the label on a separator. + * + * @param separator The separator. + * @param label The new label. + */ + +void TXT_SetSeparatorLabel(txt_separator_t *separator, char *label); +#endif /* #ifndef TXT_SEPARATOR_H */ |