summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-07-21 06:40:01 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-07-21 06:40:01 +0000
commita7c37ea2d04c35628fc1ca9d353df637612303d0 (patch)
tree89df13b75ed199e4d284928cd016d0187706514e
parent2f620b8af336d65a7f48f131b1a78ecb0487de36 (diff)
downloadrockbox-a7c37ea2d04c35628fc1ca9d353df637612303d0.tar.gz
rockbox-a7c37ea2d04c35628fc1ca9d353df637612303d0.zip
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
-rw-r--r--apps/gui/yesno.c14
-rw-r--r--apps/gui/yesno.h4
-rw-r--r--apps/radio/presets.c2
-rw-r--r--apps/radio/radio.c13
4 files changed, 18 insertions, 15 deletions
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,
233 } 233 }
234 return(result); 234 return(result);
235} 235}
236
237
238/* Function to manipulate all yesno dialogues.
239 This function needs the output text as an argument. */
240bool yesno_pop(const char* text)
241{
242 int i;
243 const char *lines[]={text};
244 const struct text_message message={lines, 1};
245 bool ret = (gui_syncyesno_run(&message,NULL,NULL)== YESNO_YES);
246 FOR_NB_SCREENS(i)
247 screens[i].clear_viewport();
248 return ret;
249}
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 @@
21 21
22#ifndef _GUI_YESNO_H_ 22#ifndef _GUI_YESNO_H_
23#define _GUI_YESNO_H_ 23#define _GUI_YESNO_H_
24#include <stdbool.h>
24 25
25enum yesno_res 26enum yesno_res
26{ 27{
@@ -47,4 +48,7 @@ extern enum yesno_res gui_syncyesno_run(
47 const struct text_message * main_message, 48 const struct text_message * main_message,
48 const struct text_message * yes_message, 49 const struct text_message * yes_message,
49 const struct text_message * no_message); 50 const struct text_message * no_message);
51
52bool yesno_pop(const char* text);
53
50#endif /* _GUI_YESNO_H_ */ 54#endif /* _GUI_YESNO_H_ */
diff --git a/apps/radio/presets.c b/apps/radio/presets.c
index 77b13f2ed7..26a607ad4b 100644
--- a/apps/radio/presets.c
+++ b/apps/radio/presets.c
@@ -59,8 +59,6 @@ static char filepreset[MAX_PATH]; /* preset filename variable */
59 59
60static int num_presets = 0; /* The number of presets in the preset list */ 60static int num_presets = 0; /* The number of presets in the preset list */
61 61
62bool yesno_pop(const char* text); /* radio.c */
63
64int radio_current_preset(void) 62int radio_current_preset(void)
65{ 63{
66 return curr_preset; 64 return curr_preset;
diff --git a/apps/radio/radio.c b/apps/radio/radio.c
index e4b14c843e..f88a63382d 100644
--- a/apps/radio/radio.c
+++ b/apps/radio/radio.c
@@ -154,19 +154,6 @@ int radio_current_frequency(void)
154 return curr_freq; 154 return curr_freq;
155} 155}
156 156
157/* Function to manipulate all yesno dialogues.
158 This function needs the output text as an argument. */
159bool yesno_pop(const char* text)
160{
161 int i;
162 const char *lines[]={text};
163 const struct text_message message={lines, 1};
164 bool ret = (gui_syncyesno_run(&message,NULL,NULL)== YESNO_YES);
165 FOR_NB_SCREENS(i)
166 screens[i].clear_viewport();
167 return ret;
168}
169
170void radio_init(void) 157void radio_init(void)
171{ 158{
172 tuner_init(); 159 tuner_init();