X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fscreen_song.c;h=be8a7c02a7b377b624dac3bf034ffabb240fb588;hb=634bed2e83799f604a60bfef62d5e240ea02511c;hp=cf7fd606b394b4ed50364243e054aa8b6b553e60;hpb=f3849aa2b3eb49ca6a903e6627f97540c1a383f1;p=ncmpc.git diff --git a/src/screen_song.c b/src/screen_song.c index cf7fd60..be8a7c0 100644 --- a/src/screen_song.c +++ b/src/screen_song.c @@ -16,19 +16,14 @@ * */ -#include #include "i18n.h" -#include "options.h" -#include "mpdclient.h" -#include "command.h" #include "screen.h" #include "screen_utils.h" -#include "strfsong.h" #include "charset.h" static list_window_t *lw; -struct { +static struct { struct mpd_song *song; GPtrArray *lines; } current; @@ -40,6 +35,11 @@ screen_song_clear(void) g_free(g_ptr_array_index(current.lines, i)); g_ptr_array_set_size(current.lines, 0); + + if (current.song != NULL) { + mpd_freeSong(current.song); + current.song = NULL; + } } static void @@ -56,7 +56,7 @@ screen_song_repaint(void) } static const char * -screen_song_list_callback(unsigned idx, G_GNUC_UNUSED int *highlight, +screen_song_list_callback(unsigned idx, G_GNUC_UNUSED bool *highlight, G_GNUC_UNUSED void *data) { static char buffer[256]; @@ -78,7 +78,7 @@ screen_song_init(WINDOW *w, int cols, int rows) { current.lines = g_ptr_array_new(); lw = list_window_init(w, cols, rows); - lw->flags = LW_HIDE_CURSOR; + lw->hide_cursor = true; } static void @@ -128,6 +128,16 @@ screen_song_cmd(mpdclient_t *c, command_t cmd) return false; +#ifdef ENABLE_LYRICS_SCREEN + case CMD_SCREEN_LYRICS: + if (current.song != NULL) { + screen_lyrics_switch(c, current.song); + return true; + } + + return false; +#endif + default: break; }