summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2010-01-19 08:45:02 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2010-01-19 08:45:02 +0100
commitc8f55e392b8cb387a9476a922dea4f390f39f28c (patch)
tree9f6c55d134d7c27732cc9f51cf6624257f858217 /src
parent7df92f7654662d95959c4f1e43610be2f2d67fd1 (diff)
downloadpianobar-c8f55e392b8cb387a9476a922dea4f390f39f28c.tar.gz
pianobar-c8f55e392b8cb387a9476a922dea4f390f39f28c.tar.bz2
pianobar-c8f55e392b8cb387a9476a922dea4f390f39f28c.zip
Use user-defined shortcuts (history menu)
Diffstat (limited to 'src')
-rw-r--r--src/ui_act.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/src/ui_act.c b/src/ui_act.c
index 518dc80..fe93cda 100644
--- a/src/ui_act.c
+++ b/src/ui_act.c
@@ -411,16 +411,24 @@ void BarUiActQuit (BAR_KS_ARGS) {
/* song history
*/
void BarUiActHistory (BAR_KS_ARGS) {
- char selectBuf[2];
+ char selectBuf[2], allowedBuf[3];
PianoSong_t *selectedSong;
if (*songHistory != NULL) {
selectedSong = BarUiSelectSong (*songHistory, curFd);
if (selectedSong != NULL) {
- BarUiMsg (MSG_QUESTION, "%s - %s: [l]ove or [b]an? ",
- selectedSong->artist, selectedSong->title);
- BarReadline (selectBuf, sizeof (selectBuf), "lbs", 1, 0, curFd);
- if (selectBuf[0] == 'l' || selectBuf[0] == 'b') {
+ /* use user-defined keybindings */
+ allowedBuf[0] = settings->keys[BAR_KS_LOVE];
+ allowedBuf[1] = settings->keys[BAR_KS_BAN];
+ allowedBuf[2] = '\0';
+
+ BarUiMsg (MSG_QUESTION, "%s - %s: love[%c] or ban[%c]? ",
+ selectedSong->artist, selectedSong->title,
+ settings->keys[BAR_KS_LOVE], settings->keys[BAR_KS_BAN]);
+ BarReadline (selectBuf, sizeof (selectBuf), allowedBuf, 1, 0, curFd);
+
+ if (selectBuf[0] == settings->keys[BAR_KS_LOVE] ||
+ selectBuf[0] == settings->keys[BAR_KS_BAN]) {
PianoReturn_t pRet = PIANO_RET_ERR;
/* make sure we're transforming the _original_ station (not
* curStation) */
@@ -437,26 +445,20 @@ void BarUiActHistory (BAR_KS_ARGS) {
return;
}
- switch (selectBuf[0]) {
- case 'l':
- /* love */
- /* FIXME: copy&waste */
- BarUiMsg (MSG_INFO, "Loving song... ");
- pRet = BarUiPrintPianoStatus (PianoRateTrack (ph,
- selectedSong, PIANO_RATE_LOVE));
- BarUiStartEventCmd (settings, "songlove", songStation,
- selectedSong, pRet);
- break;
-
- case 'b':
- /* ban */
- BarUiMsg (MSG_INFO, "Banning song... ");
- pRet = BarUiPrintPianoStatus (PianoRateTrack (ph,
- selectedSong, PIANO_RATE_BAN));
- BarUiStartEventCmd (settings, "songban", songStation,
- selectedSong, pRet);
- break;
- } /* end switch */
+ if (selectBuf[0] == settings->keys[BAR_KS_LOVE]) {
+ /* FIXME: copy&waste */
+ BarUiMsg (MSG_INFO, "Loving song... ");
+ pRet = BarUiPrintPianoStatus (PianoRateTrack (ph,
+ selectedSong, PIANO_RATE_LOVE));
+ BarUiStartEventCmd (settings, "songlove", songStation,
+ selectedSong, pRet);
+ } else if (selectBuf[0] == settings->keys[BAR_KS_BAN]) {
+ BarUiMsg (MSG_INFO, "Banning song... ");
+ pRet = BarUiPrintPianoStatus (PianoRateTrack (ph,
+ selectedSong, PIANO_RATE_BAN));
+ BarUiStartEventCmd (settings, "songban", songStation,
+ selectedSong, pRet);
+ } /* end if */
} /* end if selectBuf[0] */
} /* end if selectedSong != NULL */
} else {