summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e40362)
raw | patch | inline | side by side (parent: 3e40362)
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_file.c | patch | blob | history |
diff --git a/src/screen_file.c b/src/screen_file.c
index 31af84d8a3f6349571741a636079699d2cc0da73..7fe55876c321b1d8795eb65f062c20f428df6f8f 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
wrefresh(browser.lw->w);
}
-static void
-file_repaint_if_active(void)
-{
- if (screen_is_visible(&screen_browse))
- file_repaint();
-}
-
static void
file_reload(struct mpdclient *c)
{
filelist_prepend(browser.filelist, NULL);
}
-/* the db has changed -> update the filelist */
-static void
-file_changed_callback(struct mpdclient *c, G_GNUC_UNUSED int event,
- G_GNUC_UNUSED gpointer data)
-{
- file_reload(c);
-
-#ifndef NCMPC_MINI
- sync_highlights(c, browser.filelist);
-#endif
- list_window_check_selected(browser.lw, filelist_length(browser.filelist));
-
- file_repaint_if_active();
-}
-
-#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);
-
- file_repaint_if_active();
-}
-#endif
-
/**
* Change to the specified absolute directory.
*/
}
static void
-browse_open(G_GNUC_UNUSED struct mpdclient *c)
+browse_open(struct mpdclient *c)
{
- if (browser.filelist == NULL) {
- file_reload(c);
-
-#ifndef NCMPC_MINI
- mpdclient_install_playlist_callback(c, playlist_changed_callback);
-#endif
- mpdclient_install_browse_callback(c, file_changed_callback);
- }
+ file_reload(c);
}
static const char *
list_window_paint(browser.lw, browser_lw_callback, browser.filelist);
}
+static void
+screen_file_update(struct mpdclient *c)
+{
+ if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_STORED_PLAYLIST)) {
+ /* the db has changed -> update the filelist */
+ file_reload(c);
+ list_window_check_selected(browser.lw,
+ filelist_length(browser.filelist));
+ }
+
+#ifndef NCMPC_MINI
+ if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_STORED_PLAYLIST |
+ MPD_IDLE_PLAYLIST))
+ sync_highlights(c, browser.filelist);
+#endif
+
+ if (c->events & (MPD_IDLE_DATABASE | MPD_IDLE_STORED_PLAYLIST
+#ifndef NCMPC_MINI
+ | MPD_IDLE_PLAYLIST
+#endif
+ ))
+ file_repaint();
+}
+
static bool
browse_cmd(struct mpdclient *c, command_t cmd)
{
.open = browse_open,
.resize = browse_resize,
.paint = browse_paint,
+ .update = screen_file_update,
.cmd = browse_cmd,
.get_title = browse_title,
};