summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6e7ec3a)
raw | patch | inline | side by side (parent: 6e7ec3a)
author | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 18:26:30 +0000 (20:26 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 18:26:30 +0000 (20:26 +0200) |
src/screen_search.c | patch | blob | history |
diff --git a/src/screen_search.c b/src/screen_search.c
index 5c7cdeafd0edd2668ed3bd15b5ea2b23889372a4..6dbbb1e0851574e56e1e907e5ec6450d8e16e6ee 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
wrefresh(browser.lw->w);
}
-static void
-search_repaint_if_active(void)
-{
- if (screen_is_visible(&screen_search))
- search_repaint();
-}
-
-/* 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);
- search_repaint_if_active();
-}
-
/* sanity check search mode value */
static void
search_check_mode(void)
}
static void
-search_clear(struct mpdclient *c,
- gboolean clear_pattern)
+search_clear(bool clear_pattern)
{
if (browser.filelist) {
- mpdclient_remove_playlist_callback(c, playlist_changed_callback);
filelist_free(browser.filelist);
browser.filelist = filelist_new();
}
if (c->connection == NULL)
return;
- search_clear(c, TRUE);
+ search_clear(true);
g_free(pattern);
pattern = screen_readln(_("Search"),
browser.filelist = filelist_new();
sync_highlights(c, browser.filelist);
- mpdclient_install_playlist_callback(c, playlist_changed_callback);
list_window_check_selected(browser.lw, filelist_length(browser.filelist));
}
return str;
}
+static void
+screen_search_update(struct mpdclient *c)
+{
+ if (browser.filelist != NULL && c->events & MPD_IDLE_PLAYLIST) {
+ sync_highlights(c, browser.filelist);
+ search_repaint();
+ }
+}
+
static bool
search_cmd(struct mpdclient *c, command_t cmd)
{
/* continue and update... */
case CMD_SCREEN_UPDATE:
if (pattern) {
- search_clear(c, FALSE);
+ search_clear(false);
browser.filelist = filelist_search(c,
FALSE,
mode[options.search_mode].table,
return true;
case CMD_CLEAR:
- search_clear(c, TRUE);
+ search_clear(true);
list_window_reset(browser.lw);
search_repaint();
return true;
.open = open,
.resize = resize,
.paint = paint,
+ .update = screen_search_update,
.cmd = search_cmd,
.get_title = get_title,
};