Code

screen_browser: pass playlist object to sync_highlights()
authorMax Kellermann <max@duempel.org>
Wed, 30 Sep 2009 20:02:35 +0000 (22:02 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 30 Sep 2009 20:02:35 +0000 (22:02 +0200)
And add the screen_browser_ prefix to the function name.

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

index 905566d4849d1368a4df97a63ff537df49e911ff..d3c182233c9c0ef95b67fb74981c5e25b5ba7d88 100644 (file)
@@ -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
index 7658cf3cc4f0d08308f0b9ef41648378f1311d94..3c94746cacd738b9b4cf1a6fc3179460199438e2 100644 (file)
@@ -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
index 54e94de86ace670ea6fe92386e644492dc1dbb1f..57a575bca2d192ae671c8b33ef2720f1aa8938e8 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdbool.h>
 
 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
 
index 3aaade12a03896d727d92e34cbc8062c40dc7f6f..53997a5ed8109196827f163a8f3efe560627361d 100644 (file)
@@ -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));
index 43f6ea9e23b1daa22e9b889cc1a856c13255bfed..66b05b54b6b8e94b48df4a9894c17536a011598d 100644 (file)
@@ -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;