summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eaf6040)
raw | patch | inline | side by side (parent: eaf6040)
author | Max Kellermann <max@duempel.org> | |
Wed, 1 Oct 2008 07:38:25 +0000 (09:38 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 1 Oct 2008 07:38:25 +0000 (09:38 +0200) |
Some callers of update_metalist() want to reload the list contents.
Add an optimized function reload_lists() which does not modify the
global variables "mode", "artist", "album".
Add an optimized function reload_lists() which does not modify the
global variables "mode", "artist", "album".
src/screen_artist.c | patch | blob | history |
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 5dbb2c03b55f960837e72c5c082d902d30d057fc..340d8f22a3f698a6f0c7e4f460323d122145cbd0 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
}
}
+static void
+reload_lists(struct mpdclient *c)
+{
+ free_lists(c);
+
+ switch (mode) {
+ case LIST_ARTISTS:
+ load_artist_list(c);
+ break;
+
+ case LIST_ALBUMS:
+ load_album_list(c);
+ break;
+
+ case LIST_SONGS:
+ load_song_list(c);
+ break;
+ }
+}
+
/* db updated */
static void
browse_callback(mpdclient_t *c, int event, mpd_unused gpointer data)
switch(event) {
case BROWSE_DB_UPDATED:
D("screen_artist.c> browse_callback() [BROWSE_DB_UPDATED]\n");
- update_metalist(c, g_strdup(artist), g_strdup(album));
+ reload_lists(c);
break;
default:
break;
static gboolean callback_installed = FALSE;
if (metalist == NULL && browser.filelist == NULL)
- update_metalist(c, NULL, NULL);
+ reload_lists(c);
if (!callback_installed) {
mpdclient_install_browse_callback(c, browse_callback);
callback_installed = TRUE;
/* continue and update... */
case CMD_SCREEN_UPDATE:
- update_metalist(c, g_strdup(artist), g_strdup(album));
+ reload_lists(c);
screen_status_printf(_("Screen updated!"));
return 0;