From 20e9d56ba5507021bdde898f4b0a0eb14f2af861 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 20 May 2010 17:41:28 +0000 Subject: 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 --- apps/plugins/alarmclock.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'apps/plugins/alarmclock.c') 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 @@ PLUGIN_HEADER -const struct button_mapping *plugin_contexts[] = {generic_directions, - generic_actions}; +const struct button_mapping *plugin_contexts[] = { pla_main_ctx }; static int current = 0; static bool tomorrow = false; @@ -33,7 +32,8 @@ static int alarm[2] = {0, 0}, maxval[2] = {24, 60}, prev_tick = 3600 * 24; static bool quit = false, usb = false, waiting = false, done = false; static inline int get_button(void) { - return pluginlib_getaction(HZ/2, plugin_contexts, 2); + return pluginlib_getaction(HZ/2, plugin_contexts, + ARRAYLEN(plugin_contexts)); } int rem_seconds(void) { @@ -125,7 +125,7 @@ enum plugin_status plugin_start(const void* parameter) while(!quit) { button = get_button(); - if (button == PLA_QUIT) + if (button == PLA_EXIT || PLA_CANCEL) quit = true; FOR_NB_SCREENS(i) { @@ -157,7 +157,8 @@ enum plugin_status plugin_start(const void* parameter) current = (current + 1) % 2; break; - case PLA_FIRE: { + case PLA_SELECT: + case PLA_SELECT_REPEAT: { if (rem_seconds() < 0) tomorrow = true; -- cgit v1.2.3