summaryrefslogtreecommitdiff
path: root/apps/plugins/alarmclock.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-05-20 17:41:28 +0000
committerThomas Martitz <kugel@rockbox.org>2010-05-20 17:41:28 +0000
commit20e9d56ba5507021bdde898f4b0a0eb14f2af861 (patch)
tree20a1ff36d0cc0f530bc7c7648b1bca2f9127a5c8 /apps/plugins/alarmclock.c
parent97365803d390e44155fc41657bd03a7b121956aa (diff)
downloadrockbox-20e9d56ba5507021bdde898f4b0a0eb14f2af861.tar.gz
rockbox-20e9d56ba5507021bdde898f4b0a0eb14f2af861.zip
S#10387 - Rework pluginlib actions
It changes pluginlib actions to contain only a single and simple context (and other one for remote directional buttons), consisting of 7(9) buttons: up/down/left/right, select OR short select and long select, exit and cancel (plus 2 for scrollwheel targets). This ensures contexts don't clash with other contexts and simplifies them, at the expense of reduced versatility. However, the versatility made it largely unusable due to the great number of targets. This should allow for using pluginlib actions safely for the most simple plugins (e.g. almost all demos). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26202 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/alarmclock.c')
-rw-r--r--apps/plugins/alarmclock.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/plugins/alarmclock.c b/apps/plugins/alarmclock.c
index 88e3e858cb..23ad886f6c 100644
--- a/apps/plugins/alarmclock.c
+++ b/apps/plugins/alarmclock.c
@@ -24,8 +24,7 @@
24 24
25PLUGIN_HEADER 25PLUGIN_HEADER
26 26
27const struct button_mapping *plugin_contexts[] = {generic_directions, 27const struct button_mapping *plugin_contexts[] = { pla_main_ctx };
28 generic_actions};
29 28
30static int current = 0; 29static int current = 0;
31static bool tomorrow = false; 30static bool tomorrow = false;
@@ -33,7 +32,8 @@ static int alarm[2] = {0, 0}, maxval[2] = {24, 60}, prev_tick = 3600 * 24;
33static bool quit = false, usb = false, waiting = false, done = false; 32static bool quit = false, usb = false, waiting = false, done = false;
34 33
35static inline int get_button(void) { 34static inline int get_button(void) {
36 return pluginlib_getaction(HZ/2, plugin_contexts, 2); 35 return pluginlib_getaction(HZ/2, plugin_contexts,
36 ARRAYLEN(plugin_contexts));
37} 37}
38 38
39int rem_seconds(void) { 39int rem_seconds(void) {
@@ -125,7 +125,7 @@ enum plugin_status plugin_start(const void* parameter)
125 while(!quit) { 125 while(!quit) {
126 button = get_button(); 126 button = get_button();
127 127
128 if (button == PLA_QUIT) 128 if (button == PLA_EXIT || PLA_CANCEL)
129 quit = true; 129 quit = true;
130 130
131 FOR_NB_SCREENS(i) { 131 FOR_NB_SCREENS(i) {
@@ -157,7 +157,8 @@ enum plugin_status plugin_start(const void* parameter)
157 current = (current + 1) % 2; 157 current = (current + 1) % 2;
158 break; 158 break;
159 159
160 case PLA_FIRE: { 160 case PLA_SELECT:
161 case PLA_SELECT_REPEAT: {
161 if (rem_seconds() < 0) 162 if (rem_seconds() < 0)
162 tomorrow = true; 163 tomorrow = true;
163 164