From a79a0c3fb812efac3370c6ed73d37bb8fd1d318e Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 4 Dec 2010 15:25:15 +0100 Subject: Rewrite input processing --- src/main.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 412faed..3104898 100644 --- a/src/main.c +++ b/src/main.c @@ -50,11 +50,9 @@ THE SOFTWARE. #include "terminal.h" #include "config.h" #include "ui.h" -#include "ui_act.h" +#include "ui_dispatch.h" #include "ui_readline.h" -typedef void (*BarKeyShortcutFunc_t) (BarApp_t *app); - /* copy proxy settings to waitress handle */ static void BarMainLoadProxy (const BarSettings_t *settings, @@ -154,26 +152,9 @@ static void BarMainHandleUserInput (BarApp_t *app) { char buf[2]; if (BarReadline (buf, sizeof (buf), NULL, &app->input, BAR_RL_FULLRETURN | BAR_RL_NOECHO, 1) > 0) { - for (size_t i = 0; i < BAR_KS_COUNT; i++) { - if (app->settings.keys[i] != BAR_KS_DISABLED && - app->settings.keys[i] == buf[0]) { - static const BarKeyShortcutFunc_t idToF[] = {BarUiActHelp, - BarUiActLoveSong, BarUiActBanSong, - BarUiActAddMusic, BarUiActCreateStation, - BarUiActDeleteStation, BarUiActExplain, - BarUiActStationFromGenre, BarUiActHistory, - BarUiActSongInfo, BarUiActAddSharedStation, - BarUiActMoveSong, BarUiActSkipSong, BarUiActPause, - BarUiActQuit, BarUiActRenameStation, - BarUiActSelectStation, BarUiActTempBanSong, - BarUiActPrintUpcoming, BarUiActSelectQuickMix, - BarUiActDebug, BarUiActBookmark, BarUiActVolDown, - BarUiActVolUp}; - idToF[i] (app); - break; - } - } /* end for */ - } /* end if */ + BarUiDispatch (app, buf[0], app->curStation, app->playlist, true, + BAR_DC_GLOBAL); + } } /* append current song to history list and move to the next song -- cgit v1.2.3