diff options
author | Max Kellermann <max@duempel.org> | 2008-09-17 21:09:21 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-17 21:09:21 +0200 |
commit | 260eb4ea969988190695386f7f7d6cc237c2b17d (patch) | |
tree | f565ff8aa6d6672bca88b663c1727280d39c81a9 /src | |
parent | 85ef40fa57fd6b4b931394e82edbd2878966e3fd (diff) | |
download | mpd-260eb4ea969988190695386f7f7d6cc237c2b17d.tar.gz mpd-260eb4ea969988190695386f7f7d6cc237c2b17d.tar.xz mpd-260eb4ea969988190695386f7f7d6cc237c2b17d.zip |
screen_artist: fix compilation errors
Unfortunately when I fixed the GCC warnings and refactored lots of the
code, the "artist" screen was disabled. This patch applies all API
changes and fixes all warnings.
Diffstat (limited to 'src')
-rw-r--r-- | src/screen_artist.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/src/screen_artist.c b/src/screen_artist.c index 71f48514b..fb10afc3c 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -31,6 +31,7 @@ #include "screen.h" #include "screen_utils.h" #include "screen_browse.h" +#include "gcc.h" #include <ctype.h> #include <stdlib.h> @@ -47,7 +48,7 @@ static char *artist = NULL; static char *album = NULL; static list_window_t *lw = NULL; static mpdclient_filelist_t *filelist = NULL; -static int metalist_length = 0; +static unsigned metalist_length = 0; static GList *metalist = NULL; static list_window_state_t *lw_state = NULL; @@ -66,13 +67,13 @@ compare_utf8(gconstpointer s1, gconstpointer s2) } /* list_window callback */ -static char * -artist_lw_callback(int index, int *highlight, void *data) +static const char * +artist_lw_callback(unsigned idx, mpd_unused int *highlight, mpd_unused void *data) { static char buf[BUFSIZE]; char *str, *str_utf8; - if ((str_utf8=(char *) g_list_nth_data(metalist,index)) == NULL) + if ((str_utf8 = (char *)g_list_nth_data(metalist, idx)) == NULL) return NULL; str = utf8_to_locale(str_utf8); @@ -84,7 +85,7 @@ artist_lw_callback(int index, int *highlight, void *data) /* the playlist have been updated -> fix highlights */ static void -playlist_changed_callback(mpdclient_t *c, int event, gpointer data) +playlist_changed_callback(mpdclient_t *c, int event, mpd_unused gpointer data) { if (filelist == NULL) return; @@ -113,10 +114,13 @@ update_metalist(mpdclient_t *c, char *m_artist, char *m_album) metalist = string_list_free(metalist); if (filelist) { mpdclient_remove_playlist_callback(c, playlist_changed_callback); - filelist = mpdclient_filelist_free(filelist); + mpdclient_filelist_free(filelist); + filelist = NULL; } + if (m_album) { /* retreive songs... */ + filelist_entry_t *entry; artist = m_artist; album = m_album; @@ -132,7 +136,7 @@ update_metalist(mpdclient_t *c, char *m_artist, char *m_album) MPD_TABLE_ALBUM, album); /* add a dummy entry for ".." */ - filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t)); + entry = g_malloc0(sizeof(filelist_entry_t)); entry->entity = NULL; filelist->list = g_list_insert(filelist->list, entry, 0); filelist->length++; @@ -166,7 +170,7 @@ update_metalist(mpdclient_t *c, char *m_artist, char *m_album) /* db updated */ static void -browse_callback(mpdclient_t *c, int event, gpointer data) +browse_callback(mpdclient_t *c, int event, mpd_unused gpointer data) { switch(event) { case BROWSE_DB_UPDATED: @@ -193,19 +197,19 @@ static void quit(void) { if (filelist) - filelist = mpdclient_filelist_free(filelist); + mpdclient_filelist_free(filelist); if (metalist) - metalist = string_list_free(metalist); + string_list_free(metalist); g_free(artist); g_free(album); artist = NULL; album = NULL; - lw = list_window_free(lw); - lw_state = list_window_free_state(lw_state); + list_window_free(lw); + list_window_free_state(lw_state); } static void -open(screen_t *screen, mpdclient_t *c) +open(mpd_unused screen_t *screen, mpdclient_t *c) { static gboolean callback_installed = FALSE; @@ -230,7 +234,7 @@ close(void) } static void -paint(screen_t *screen, mpdclient_t *c) +paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { lw->clear = 1; @@ -259,7 +263,7 @@ update(screen_t *screen, mpdclient_t *c) wnoutrefresh(lw->w); } -static char * +static const char * get_title(char *str, size_t size) { char *s1 = artist ? utf8_to_locale(artist) : NULL; @@ -281,29 +285,23 @@ get_title(char *str, size_t size) return str; } -static list_window_t * -get_filelist_window() -{ - return lw; -} - static void -add_query(mpdclient_t *c, int table, char *filter) +add_query(mpdclient_t *c, int table, char *_filter) { char *str; mpdclient_filelist_t *addlist; - str = utf8_to_locale(filter); + str = utf8_to_locale(_filter); if (table== MPD_TABLE_ALBUM) screen_status_printf("Adding album %s...", str); else screen_status_printf("Adding %s...", str); g_free(str); - addlist = mpdclient_filelist_search_utf8(c, TRUE, table, filter); + addlist = mpdclient_filelist_search_utf8(c, TRUE, table, _filter); if (addlist) { mpdclient_filelist_add_all(c, addlist); - addlist = mpdclient_filelist_free(addlist); + mpdclient_filelist_free(addlist); } } @@ -360,6 +358,9 @@ artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) case CMD_GO_PARENT_DIRECTORY: switch (mode) { + case LIST_ARTISTS: + break; + case LIST_ALBUMS: update_metalist(c, NULL, NULL); list_window_reset(lw); @@ -378,6 +379,9 @@ artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) case CMD_GO_ROOT_DIRECTORY: switch (mode) { + case LIST_ARTISTS: + break; + case LIST_ALBUMS: case LIST_SONGS: update_metalist(c, NULL, NULL); @@ -462,7 +466,6 @@ const struct screen_functions screen_artist = { .paint = paint, .update = update, .cmd = artist_cmd, - .get_lw = get_filelist_window, .get_title = get_title, }; |