summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2010-01-18 15:41:07 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2010-01-18 15:41:07 +0100
commit7df92f7654662d95959c4f1e43610be2f2d67fd1 (patch)
tree7cd0ad65f45ed914d52700b82406884deac665e7 /src/main.c
parent83e056f390c4804f9d283c7083a76dfa957ee054 (diff)
downloadpianobar-7df92f7654662d95959c4f1e43610be2f2d67fd1.tar.gz
pianobar-7df92f7654662d95959c4f1e43610be2f2d67fd1.tar.bz2
pianobar-7df92f7654662d95959c4f1e43610be2f2d67fd1.zip
Shortcut refactoring
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 426d566..fd43c40 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,6 +52,7 @@ THE SOFTWARE.
#include "terminal.h"
#include "config.h"
#include "ui.h"
+#include "ui_act.h"
#include "ui_readline.h"
int main (int argc, char **argv) {
@@ -74,7 +75,6 @@ int main (int argc, char **argv) {
struct pollfd polls[2];
nfds_t pollsLen = 0;
char buf = '\0';
- BarKeyShortcut_t *curShortcut = NULL;
/* terminal attributes _before_ we started messing around with ~ECHO */
struct termios termOrig;
@@ -301,15 +301,25 @@ int main (int argc, char **argv) {
curFd = ctlFd;
}
buf = fgetc (curFd);
- curShortcut = settings.keys;
- while (curShortcut != NULL) {
- if (curShortcut->key == buf) {
- curShortcut->cmd (&ph, &player, &settings, &playlist,
+ size_t i;
+ for (i = 0; i < BAR_KS_COUNT; i++) {
+ if (settings.keys[i] == buf) {
+ BarKeyShortcutFunc_t idToF[] = {BarUiActHelp,
+ BarUiActLoveSong, BarUiActBanSong,
+ BarUiActAddMusic, BarUiActCreateStation,
+ BarUiActDeleteStation, BarUiActExplain,
+ BarUiActStationFromGenre, BarUiActHistory,
+ BarUiActSongInfo, BarUiActAddSharedStation,
+ BarUiActMoveSong, BarUiActSkipSong, BarUiActPause,
+ BarUiActQuit, BarUiActRenameStation,
+ BarUiActSelectStation, BarUiActTempBanSong,
+ BarUiActPrintUpcoming, BarUiActSelectQuickMix,
+ BarUiActDebug};
+ idToF[i] (&ph, &player, &settings, &playlist,
&curStation, &songHistory, &doQuit, curFd);
break;
}
- curShortcut = curShortcut->next;
}
}