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>
This commit is contained in:
parent
54138d8814
commit
45d2422be3
|
@ -134,3 +134,9 @@ GtkTreePath *gui_filter_path_from_index(unsigned int index)
|
||||||
gtk_tree_path_free(real);
|
gtk_tree_path_free(real);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gui_filter_refilter(struct playlist *playlist)
|
||||||
|
{
|
||||||
|
if (!playlist || playlist == gui_model_get_playlist())
|
||||||
|
gtk_tree_model_filter_refilter(gui_filter_get());
|
||||||
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ static void __gui_playlist_alloc(struct playlist *playlist)
|
||||||
static void __gui_playlist_added(struct playlist *playlist, struct track *track)
|
static void __gui_playlist_added(struct playlist *playlist, struct track *track)
|
||||||
{
|
{
|
||||||
gui_model_add(playlist, track);
|
gui_model_add(playlist, track);
|
||||||
|
gui_filter_refilter(playlist);
|
||||||
__gui_playlist_update_size(playlist);
|
__gui_playlist_update_size(playlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ unsigned int gui_filter_path_get_index(GtkTreePath *);
|
||||||
/* Called to convert a playlist iterator index into a path. */
|
/* Called to convert a playlist iterator index into a path. */
|
||||||
GtkTreePath *gui_filter_path_from_index(unsigned int);
|
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. */
|
/* Called to access the filter search-entry. */
|
||||||
static inline GtkSearchEntry *gui_filter_search(void)
|
static inline GtkSearchEntry *gui_filter_search(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue