From e25477105dc2cff39d54b270e6b732e2145daa0f Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Wed, 28 Oct 2009 12:17:04 +0100 Subject: [PATCH] screen_browse: make screen_browser_sync_highlights an empty inline function This improves readability, as no #ifdefs are required in the *.c files around the screen_browser_sync_highlights calls anymore. --- src/screen_artist.c | 4 ---- src/screen_browser.h | 9 +++++++++ src/screen_file.c | 16 +++------------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/screen_artist.c b/src/screen_artist.c index 892587b..9bd1b3e 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -234,10 +234,8 @@ load_song_list(struct mpdclient *c) mpdclient_handle_error(c); } -#ifndef NCMPC_MINI /* fix highlights */ screen_browser_sync_highlights(browser.filelist, &c->playlist); -#endif list_window_set_length(browser.lw, filelist_length(browser.filelist)); } @@ -396,10 +394,8 @@ screen_artist_update(struct mpdclient *c) /* the db has changed -> update the list */ reload_lists(c); -#ifndef NCMPC_MINI if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_PLAYLIST)) screen_browser_sync_highlights(browser.filelist, &c->playlist); -#endif if (c->events & (MPD_IDLE_DATABASE #ifndef NCMPC_MINI diff --git a/src/screen_browser.h b/src/screen_browser.h index c3a47de..8589e75 100644 --- a/src/screen_browser.h +++ b/src/screen_browser.h @@ -43,6 +43,15 @@ void screen_browser_sync_highlights(struct filelist *fl, const struct mpdclient_playlist *playlist); +#else + +#include +static inline void +screen_browser_sync_highlights(G_GNUC_UNUSED struct filelist *fl, + G_GNUC_UNUSED const struct mpdclient_playlist *playlist) +{ +} + #endif void diff --git a/src/screen_file.c b/src/screen_file.c index 86df8c7..25a86d1 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -97,9 +97,7 @@ change_directory(struct mpdclient *c, const char *new_path) screen_file_reload(c); -#ifndef NCMPC_MINI screen_browser_sync_highlights(browser.filelist, &c->playlist); -#endif list_window_reset(browser.lw); @@ -282,9 +280,7 @@ static void screen_file_open(struct mpdclient *c) { screen_file_reload(c); -#ifndef NCMPC_MINI screen_browser_sync_highlights(browser.filelist, &c->playlist); -#endif } static const char * @@ -325,18 +321,14 @@ screen_file_update(struct mpdclient *c) screen_file_reload(c); } -#ifndef NCMPC_MINI - if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_STORED_PLAYLIST | - MPD_IDLE_PLAYLIST)) - screen_browser_sync_highlights(browser.filelist, &c->playlist); -#endif - if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_STORED_PLAYLIST #ifndef NCMPC_MINI | MPD_IDLE_PLAYLIST #endif - )) + )) { + screen_browser_sync_highlights(browser.filelist, &c->playlist); screen_file_repaint(); + } } static bool @@ -368,9 +360,7 @@ screen_file_cmd(struct mpdclient *c, command_t cmd) case CMD_SCREEN_UPDATE: screen_file_reload(c); -#ifndef NCMPC_MINI screen_browser_sync_highlights(browser.filelist, &c->playlist); -#endif screen_file_repaint(); return false; -- 2.30.2