diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-31 14:55:13 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-31 14:55:13 +0000 |
commit | 28aef1f96ac06cdd094f46d4e47c148be17bc438 (patch) | |
tree | 145d12375bcbe08a0be8d44cc75718a88e41c6ac /apps | |
parent | 48960bfe292c823ad0b63e4938aec6e5df758158 (diff) |
Consolidate code duplication in WPS volume changing handling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23436 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/wps.c | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 8d1a0b9bf9..e449644502 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -707,6 +707,7 @@ long gui_wps_show(void) bool exit = false; bool bookmark = false; bool update = false; + bool vol_changed = false; int i; long last_left = 0, last_right = 0; @@ -867,40 +868,12 @@ long gui_wps_show(void) break; case ACTION_WPS_VOLUP: - { - FOR_NB_SCREENS(i) - gui_wps[i].data->button_time_volume = current_tick; global_settings.volume++; - bool res = false; - setvol(); - FOR_NB_SCREENS(i) - { - if(update_onvol_change(&gui_wps[i])) - res = true; - } - if (res) { - restore = true; - restoretimer = RESTORE_WPS_NEXT_SECOND; - } - } - break; + vol_changed = true; + break; case ACTION_WPS_VOLDOWN: - { - FOR_NB_SCREENS(i) - gui_wps[i].data->button_time_volume = current_tick; global_settings.volume--; - setvol(); - bool res = false; - FOR_NB_SCREENS(i) - { - if(update_onvol_change(&gui_wps[i])) - res = true; - } - if (res) { - restore = true; - restoretimer = RESTORE_WPS_NEXT_SECOND; - } - } + vol_changed = true; break; /* fast forward OR next dir if this is straight after ACTION_WPS_SKIPNEXT */ @@ -1155,6 +1128,23 @@ long gui_wps_show(void) break; } + if (vol_changed) + { + FOR_NB_SCREENS(i) + gui_wps[i].data->button_time_volume = current_tick; + bool res = false; + setvol(); + FOR_NB_SCREENS(i) + { + if(update_onvol_change(&gui_wps[i])) + res = true; + } + if (res) { + restore = true; + restoretimer = RESTORE_WPS_NEXT_SECOND; + } + } + if (wps_sync_data.do_full_update || update) { #if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) |