summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b9374ac)
raw | patch | inline | side by side (parent: b9374ac)
author | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 18:16:00 +0000 (20:16 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 18:16:00 +0000 (20:16 +0200) |
src/screen_artist.c | patch | blob | history |
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 03d7155b4366aa5ee7b671496d5ed057a9613257..c6173d0b3cd5c241ed5c1fa9ee54499000cdea54 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
wrefresh(browser.lw->w);
}
-static void
-artist_repaint_if_active(void)
-{
- if (screen_is_visible(&screen_artist))
- artist_repaint();
-}
-
-#ifndef NCMPC_MINI
-/* the playlist has been updated -> fix highlights */
-static void
-playlist_changed_callback(struct mpdclient *c, int event, gpointer data)
-{
- browser_playlist_changed(&browser, c, event, data);
-
- artist_repaint_if_active();
-}
-#endif
-
static GPtrArray *
g_list_to_ptr_array(GList *in)
{
}
if (browser.filelist) {
-#ifndef NCMPC_MINI
- if (c != NULL)
- mpdclient_remove_playlist_callback(c, playlist_changed_callback);
-#endif
filelist_free(browser.filelist);
browser.filelist = NULL;
}
filelist_prepend(browser.filelist, NULL);
#ifndef NCMPC_MINI
- /* install playlist callback and fix highlights */
+ /* fix highlights */
sync_highlights(c, browser.filelist);
- mpdclient_install_playlist_callback(c, playlist_changed_callback);
#endif
}
}
}
-/* db updated */
-static void
-browse_callback(struct mpdclient *c, int event, G_GNUC_UNUSED gpointer data)
-{
- switch(event) {
- case BROWSE_DB_UPDATED:
- reload_lists(c);
- break;
- default:
- break;
- }
-
- artist_repaint_if_active();
-}
-
static void
init(WINDOW *w, int cols, int rows)
{
static void
open(struct mpdclient *c)
{
- static gboolean callback_installed = FALSE;
-
if (artist_list == NULL && album_list == NULL &&
browser.filelist == NULL)
reload_lists(c);
- if (!callback_installed) {
- mpdclient_install_browse_callback(c, browse_callback);
- callback_installed = TRUE;
- }
}
static void
return str;
}
+static void
+screen_artist_update(struct mpdclient *c)
+{
+ if (browser.filelist == NULL)
+ return;
+
+ if (c->events & MPD_IDLE_DATABASE)
+ /* the db has changed -> update the list */
+ reload_lists(c);
+
+#ifndef NCMPC_MINI
+ if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_PLAYLIST))
+ sync_highlights(c, browser.filelist);
+#endif
+
+ if (c->events & (MPD_IDLE_DATABASE
+#ifndef NCMPC_MINI
+ | MPD_IDLE_PLAYLIST
+#endif
+ ))
+ artist_repaint();
+}
+
static void
add_query(struct mpdclient *c, enum mpd_tag_type table, char *_filter)
{
.open = open,
.resize = resize,
.paint = paint,
+ .update = screen_artist_update,
.cmd = artist_cmd,
.get_title = get_title,
};