From cd851b39c3fbc5cf1c8ccc23be4807d1da09a8aa Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 30 Sep 2009 22:02:35 +0200 Subject: [PATCH] screen_browser: pass playlist object to sync_highlights() And add the screen_browser_ prefix to the function name. --- src/screen_artist.c | 4 ++-- src/screen_browser.c | 5 +++-- src/screen_browser.h | 4 +++- src/screen_file.c | 6 +++--- src/screen_search.c | 7 ++++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/screen_artist.c b/src/screen_artist.c index 905566d..d3c1822 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -214,7 +214,7 @@ load_song_list(struct mpdclient *c) #ifndef NCMPC_MINI /* fix highlights */ - sync_highlights(c, browser.filelist); + screen_browser_sync_highlights(browser.filelist, &c->playlist); #endif } @@ -377,7 +377,7 @@ screen_artist_update(struct mpdclient *c) #ifndef NCMPC_MINI if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_PLAYLIST)) - sync_highlights(c, browser.filelist); + screen_browser_sync_highlights(browser.filelist, &c->playlist); #endif if (c->events & (MPD_IDLE_DATABASE diff --git a/src/screen_browser.c b/src/screen_browser.c index 7658cf3..3c94746 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -43,7 +43,8 @@ static const char playlist_format[] = "*%s*"; /* sync highlight flags with playlist */ void -sync_highlights(struct mpdclient *c, struct filelist *fl) +screen_browser_sync_highlights(struct filelist *fl, + const struct mpdclient_playlist *playlist) { guint i; @@ -55,7 +56,7 @@ sync_highlights(struct mpdclient *c, struct filelist *fl) const struct mpd_song *song = mpd_entity_get_song(entity); - if (playlist_get_index_from_same_song(&c->playlist, + if (playlist_get_index_from_same_song(playlist, song) >= 0) entry->flags |= HIGHLIGHT; else diff --git a/src/screen_browser.h b/src/screen_browser.h index 54e94de..57a575b 100644 --- a/src/screen_browser.h +++ b/src/screen_browser.h @@ -26,6 +26,7 @@ #include struct mpdclient; +struct mpdclient_playlist; struct filelist; struct list_window; struct list_window_state; @@ -39,7 +40,8 @@ struct screen_browser { #ifndef NCMPC_MINI void -sync_highlights(struct mpdclient *c, struct filelist *fl); +screen_browser_sync_highlights(struct filelist *fl, + const struct mpdclient_playlist *playlist); #endif diff --git a/src/screen_file.c b/src/screen_file.c index 3aaade1..53997a5 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -78,7 +78,7 @@ change_directory(struct mpdclient *c, const char *new_path) screen_file_reload(c); #ifndef NCMPC_MINI - sync_highlights(c, browser.filelist); + screen_browser_sync_highlights(browser.filelist, &c->playlist); #endif list_window_reset(browser.lw); @@ -308,7 +308,7 @@ screen_file_update(struct mpdclient *c) #ifndef NCMPC_MINI if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_STORED_PLAYLIST | MPD_IDLE_PLAYLIST)) - sync_highlights(c, browser.filelist); + screen_browser_sync_highlights(browser.filelist, &c->playlist); #endif if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_STORED_PLAYLIST @@ -356,7 +356,7 @@ screen_file_cmd(struct mpdclient *c, command_t cmd) case CMD_SCREEN_UPDATE: screen_file_reload(c); #ifndef NCMPC_MINI - sync_highlights(c, browser.filelist); + screen_browser_sync_highlights(browser.filelist, &c->playlist); #endif list_window_check_selected(browser.lw, filelist_length(browser.filelist)); diff --git a/src/screen_search.c b/src/screen_search.c index 43f6ea9..66b05b5 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -332,7 +332,7 @@ search_new(struct mpdclient *c) if (browser.filelist == NULL) browser.filelist = filelist_new(); - sync_highlights(c, browser.filelist); + screen_browser_sync_highlights(browser.filelist, &c->playlist); list_window_check_selected(browser.lw, filelist_length(browser.filelist)); } @@ -409,7 +409,7 @@ static void screen_search_update(struct mpdclient *c) { if (browser.filelist != NULL && c->events & MPD_IDLE_PLAYLIST) { - sync_highlights(c, browser.filelist); + screen_browser_sync_highlights(browser.filelist, &c->playlist); search_repaint(); } } @@ -432,7 +432,8 @@ screen_search_cmd(struct mpdclient *c, command_t cmd) FALSE, mode[options.search_mode].table, pattern); - sync_highlights(c, browser.filelist); + screen_browser_sync_highlights(browser.filelist, + &c->playlist); } search_repaint(); return true; -- 2.30.2