summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 85ef40f)
raw | patch | inline | side by side (parent: 85ef40f)
author | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 19:09:21 +0000 (21:09 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 19:09:21 +0000 (21:09 +0200) |
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.
code, the "artist" screen was disabled. This patch applies all API
changes and fixes all warnings.
src/screen_artist.c | patch | blob | history |
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 71f48514b53cb3d72bb5eb27f1b7a20abc3924c3..fb10afc3ca4fe7b0fdbe7edbcc58f335be1ca683 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
#include "screen.h"
#include "screen_utils.h"
#include "screen_browse.h"
+#include "gcc.h"
#include <ctype.h>
#include <stdlib.h>
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;
}
/* 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);
/* 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;
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;
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++;
/* 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:
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;
}
static void
-paint(screen_t *screen, mpdclient_t *c)
+paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
lw->clear = 1;
wnoutrefresh(lw->w);
}
-static char *
+static const char *
get_title(char *str, size_t size)
{
char *s1 = artist ? utf8_to_locale(artist) : NULL;
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);
}
}
case CMD_GO_PARENT_DIRECTORY:
switch (mode) {
+ case LIST_ARTISTS:
+ break;
+
case LIST_ALBUMS:
update_metalist(c, NULL, NULL);
list_window_reset(lw);
case CMD_GO_ROOT_DIRECTORY:
switch (mode) {
+ case LIST_ARTISTS:
+ break;
+
case LIST_ALBUMS:
case LIST_SONGS:
update_metalist(c, NULL, NULL);
.paint = paint,
.update = update,
.cmd = artist_cmd,
- .get_lw = get_filelist_window,
.get_title = get_title,
};