diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2011-07-23 20:22:53 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2011-07-25 13:47:51 +0200 |
commit | 0728b6a89de607e211bbc075b34f08495ac0d22f (patch) | |
tree | 09a42ba0970af7ba463f4adf6936289a60fbfe94 /src/ui.c | |
parent | ba936d5092e5369188e74737f820427acf3bd145 (diff) | |
download | pianobar-0728b6a89de607e211bbc075b34f08495ac0d22f.tar.gz pianobar-0728b6a89de607e211bbc075b34f08495ac0d22f.tar.bz2 pianobar-0728b6a89de607e211bbc075b34f08495ac0d22f.zip |
Added toggle to quickmix menu
Closes #141
Diffstat (limited to 'src/ui.c')
-rw-r--r-- | src/ui.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -330,9 +330,11 @@ static PianoStation_t **BarSortedStations (PianoStation_t *unsortedStations, /* let user pick one station * @param app handle * @param prompt string + * @param called if input was not a number * @return pointer to selected station or NULL */ -PianoStation_t *BarUiSelectStation (BarApp_t *app, const char *prompt) { +PianoStation_t *BarUiSelectStation (BarApp_t *app, const char *prompt, + BarUiSelectStationCallback_t callback) { PianoStation_t **sortedStations = NULL, *retStation = NULL; size_t stationCount, i; char buf[100]; @@ -351,6 +353,7 @@ PianoStation_t *BarUiSelectStation (BarApp_t *app, const char *prompt) { do { for (i = 0; i < stationCount; i++) { const PianoStation_t *currStation = sortedStations[i]; + /* filter stations */ if (BarStrCaseStr (currStation->name, buf) != NULL) { BarUiMsg (&app->settings, MSG_LIST, "%2i) %c%c%c %s\n", i, currStation->useQuickMix ? 'q' : ' ', @@ -373,6 +376,11 @@ PianoStation_t *BarUiSelectStation (BarApp_t *app, const char *prompt) { retStation = sortedStations[selected]; } } + + /* hand over buffer to external function if it was not a station number */ + if (retStation == NULL && callback != NULL) { + callback (app, buf); + } } while (retStation == NULL); free (sortedStations); |