Code

screen_lyrics: put code for reloading in a function
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Sat, 17 Dec 2011 14:54:47 +0000 (15:54 +0100)
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>
Sat, 17 Dec 2011 16:46:47 +0000 (17:46 +0100)
src/screen_lyrics.c

index 6de59d5ef073869bb109728e91d36cdd524f6987..a8c721068542563a57713d8c1503733b0e07fac5 100644 (file)
@@ -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