diff options
Diffstat (limited to 'apps/status.c')
-rw-r--r-- | apps/status.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/apps/status.c b/apps/status.c index a7f37a9f9f..09f777725e 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -260,12 +260,29 @@ static char stored_caption3[8]; | |||
260 | 260 | ||
261 | void buttonbar_set(char* caption1, char *caption2, char *caption3) | 261 | void buttonbar_set(char* caption1, char *caption2, char *caption3) |
262 | { | 262 | { |
263 | strncpy(stored_caption1, caption1, 7); | 263 | buttonbar_unset(); |
264 | stored_caption1[7] = 0; | 264 | if(caption1) |
265 | strncpy(stored_caption2, caption2, 7); | 265 | { |
266 | stored_caption2[7] = 0; | 266 | strncpy(stored_caption1, caption1, 7); |
267 | strncpy(stored_caption3, caption3, 7); | 267 | stored_caption1[7] = 0; |
268 | stored_caption3[7] = 0; | 268 | } |
269 | if(caption2) | ||
270 | { | ||
271 | strncpy(stored_caption2, caption2, 7); | ||
272 | stored_caption2[7] = 0; | ||
273 | } | ||
274 | if(caption3) | ||
275 | { | ||
276 | strncpy(stored_caption3, caption3, 7); | ||
277 | stored_caption3[7] = 0; | ||
278 | } | ||
279 | } | ||
280 | |||
281 | void buttonbar_unset(void) | ||
282 | { | ||
283 | stored_caption1[0] = 0; | ||
284 | stored_caption2[0] = 0; | ||
285 | stored_caption3[0] = 0; | ||
269 | } | 286 | } |
270 | 287 | ||
271 | void buttonbar_draw(void) | 288 | void buttonbar_draw(void) |
@@ -275,4 +292,14 @@ void buttonbar_draw(void) | |||
275 | draw_buttonbar_btn(1, stored_caption2); | 292 | draw_buttonbar_btn(1, stored_caption2); |
276 | draw_buttonbar_btn(2, stored_caption3); | 293 | draw_buttonbar_btn(2, stored_caption3); |
277 | } | 294 | } |
295 | |||
296 | bool buttonbar_isset(void) | ||
297 | { | ||
298 | /* If all buttons are unset, the button bar is considered disabled */ | ||
299 | return (global_settings.buttonbar && | ||
300 | ((stored_caption1[0] != 0) || | ||
301 | (stored_caption2[0] != 0) || | ||
302 | (stored_caption3[0] != 0))); | ||
303 | } | ||
304 | |||
278 | #endif | 305 | #endif |