Browse Source

gui: Refilter playlists when adding tracks

I was running into a situation where new tracks added to a playlist were
showing up even if they didn't match the current filter text.  Let's fix
this by refiltering the current playlist when new tracks are added to
it.

Fixes #114: New tracks added to filtered view
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
next
Anna 3 years ago
parent
commit
45d2422be3
3 changed files with 10 additions and 0 deletions
  1. +6
    -0
      gui/filter.c
  2. +1
    -0
      gui/playlist.c
  3. +3
    -0
      include/gui/filter.h

+ 6
- 0
gui/filter.c View File

@ -134,3 +134,9 @@ GtkTreePath *gui_filter_path_from_index(unsigned int index)
gtk_tree_path_free(real);
return path;
}
void gui_filter_refilter(struct playlist *playlist)
{
if (!playlist || playlist == gui_model_get_playlist())
gtk_tree_model_filter_refilter(gui_filter_get());
}

+ 1
- 0
gui/playlist.c View File

@ -37,6 +37,7 @@ static void __gui_playlist_alloc(struct playlist *playlist)
static void __gui_playlist_added(struct playlist *playlist, struct track *track)
{
gui_model_add(playlist, track);
gui_filter_refilter(playlist);
__gui_playlist_update_size(playlist);
}


+ 3
- 0
include/gui/filter.h View File

@ -38,6 +38,9 @@ unsigned int gui_filter_path_get_index(GtkTreePath *);
/* Called to convert a playlist iterator index into a path. */
GtkTreePath *gui_filter_path_from_index(unsigned int);
/* Called to refilter a playlist. Pass NULL to refilter the current playlist */
void gui_filter_refilter(struct playlist *);
/* Called to access the filter search-entry. */
static inline GtkSearchEntry *gui_filter_search(void)
{


Loading…
Cancel
Save