Code

i18n: don't use locale.h
[ncmpc.git] / src / screen_song.c
index cf7fd606b394b4ed50364243e054aa8b6b553e60..be8a7c02a7b377b624dac3bf034ffabb240fb588 100644 (file)
  *
  */
 
-#include <sys/stat.h>
 #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;
        }