Code

screen_browse: make screen_browser_sync_highlights an empty inline function
authorThomas Jansen <mithi@mithi.net>
Wed, 28 Oct 2009 11:17:04 +0000 (12:17 +0100)
committerThomas Jansen <mithi@mithi.net>
Wed, 28 Oct 2009 11:17:04 +0000 (12:17 +0100)
This improves readability, as no #ifdefs are required in the *.c files around
the screen_browser_sync_highlights calls anymore.

src/screen_artist.c
src/screen_browser.h
src/screen_file.c

index 892587bcf03ee25f32c3d4fe736e5e76ae1bd474..9bd1b3e0df6a7b85c1359adb05dd31c7002e8430 100644 (file)
@@ -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
index c3a47de16b0a9c7ba0888556c6c0613c8ad20f9d..8589e75f6855ee502d7f6185b0a2c76ab2220560 100644 (file)
@@ -43,6 +43,15 @@ void
 screen_browser_sync_highlights(struct filelist *fl,
                               const struct mpdclient_playlist *playlist);
 
+#else
+
+#include <glib.h>
+static inline void
+screen_browser_sync_highlights(G_GNUC_UNUSED struct filelist *fl,
+                              G_GNUC_UNUSED const struct mpdclient_playlist *playlist)
+{
+}
+
 #endif
 
 void
index 86df8c7c0dae30bb9a97f3e163bb927df6310a1a..25a86d1bb8f0c0ca8d75f5746818fe361b9d8d4a 100644 (file)
@@ -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;