aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_lyrics.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-02 15:20:19 +0200
committerMax Kellermann <max@duempel.org>2008-10-02 15:20:19 +0200
commitb1a8ff5269e42088b1530ccacb52a55b60754578 (patch)
treefcac2d8606a6cd2d456160c5d6bcbae1ed8dd6de /src/screen_lyrics.c
parenta220d744b2c2ba89c9037caae055247953b72ac9 (diff)
downloadmpd-b1a8ff5269e42088b1530ccacb52a55b60754578.tar.gz
mpd-b1a8ff5269e42088b1530ccacb52a55b60754578.tar.xz
mpd-b1a8ff5269e42088b1530ccacb52a55b60754578.zip
screen_lyrics: add screen_lyrics_switch()
screen_lyrics_switch() opens the lyrics screen and displays the lyrics of the specified song. This way, the user may view the lyrics of any song in the database browser.
Diffstat (limited to 'src/screen_lyrics.c')
-rw-r--r--src/screen_lyrics.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index dbfe4ea6f..83bffdf8d 100644
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
@@ -38,6 +38,8 @@
static list_window_t *lw = NULL;
+static const struct mpd_song *next_song;
+
static struct {
const struct mpd_song *song;
@@ -256,8 +258,13 @@ lyrics_exit(void)
static void
lyrics_open(mpd_unused screen_t *screen, mpdclient_t *c)
{
- if (c->song != NULL && c->song != current.song)
- screen_lyrics_load(c->song);
+ if (next_song == NULL)
+ next_song = c->song;
+
+ if (next_song != NULL && next_song != current.song)
+ screen_lyrics_load(next_song);
+
+ next_song = NULL;
}
@@ -334,3 +341,12 @@ const struct screen_functions screen_lyrics = {
.cmd = lyrics_cmd,
.get_title = lyrics_title,
};
+
+void
+screen_lyrics_switch(struct mpdclient *c, const struct mpd_song *song)
+{
+ assert(song != NULL);
+
+ next_song = song;
+ screen_switch(&screen_lyrics, c);
+}