From a7c37ea2d04c35628fc1ca9d353df637612303d0 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Thu, 21 Jul 2011 06:40:01 +0000 Subject: Pull yesno_pop out of the radio code as it is a nice simple resuasble yesno api worth reusing git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30183 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/yesno.c | 14 ++++++++++++++ apps/gui/yesno.h | 4 ++++ 2 files changed, 18 insertions(+) (limited to 'apps/gui') diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index 6c87c8784c..5354aa526b 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c @@ -233,3 +233,17 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, } return(result); } + + +/* Function to manipulate all yesno dialogues. + This function needs the output text as an argument. */ +bool yesno_pop(const char* text) +{ + int i; + const char *lines[]={text}; + const struct text_message message={lines, 1}; + bool ret = (gui_syncyesno_run(&message,NULL,NULL)== YESNO_YES); + FOR_NB_SCREENS(i) + screens[i].clear_viewport(); + return ret; +} diff --git a/apps/gui/yesno.h b/apps/gui/yesno.h index 2c146e4853..61bcf8d3c0 100644 --- a/apps/gui/yesno.h +++ b/apps/gui/yesno.h @@ -21,6 +21,7 @@ #ifndef _GUI_YESNO_H_ #define _GUI_YESNO_H_ +#include enum yesno_res { @@ -47,4 +48,7 @@ extern enum yesno_res gui_syncyesno_run( const struct text_message * main_message, const struct text_message * yes_message, const struct text_message * no_message); + +bool yesno_pop(const char* text); + #endif /* _GUI_YESNO_H_ */ -- cgit v1.2.3