From: Jonathan Neuschäfer Date: Sat, 17 Dec 2011 14:54:47 +0000 (+0100) Subject: screen_lyrics: put code for reloading in a function X-Git-Tag: release-0.20~44 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c64c37477b87ec545365b8923d6f9ff745469617;p=ncmpc.git screen_lyrics: put code for reloading in a function --- diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 6de59d5..a8c7210 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -246,6 +246,17 @@ screen_lyrics_load(const struct mpd_song *song) } } +static void +screen_lyrics_reload(void) +{ + if (current.loader == NULL && current.artist != NULL && + current.title != NULL) { + current.loader = lyrics_load(current.artist, current.title, + screen_lyrics_callback, NULL); + screen_text_repaint(&text); + } +} + static void lyrics_screen_init(WINDOW *w, int cols, int rows) { @@ -369,12 +380,7 @@ lyrics_cmd(struct mpdclient *c, command_t cmd) } return true; case CMD_SELECT: - if (current.loader == NULL && current.artist != NULL && - current.title != NULL) { - current.loader = lyrics_load(current.artist, current.title, - screen_lyrics_callback, NULL); - screen_text_repaint(&text); - } + screen_lyrics_reload(); return true; #ifdef ENABLE_SONG_SCREEN