gui/sidebar: Add a playlist update function that takes a playlist

Once we change the name of a playlist, we won't be able to find it in
the sidebar model.  So let's add a way to update an iterator by passing
the playlist to use for updating.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-10-01 11:38:27 -04:00
parent e773ae6f82
commit 2cfccb8177
2 changed files with 8 additions and 2 deletions

View File

@ -281,9 +281,9 @@ void gui_sidebar_iter_append_child(GtkTreeIter *iter, struct playlist *playlist,
__gui_sidebar_set_playlist(&new, playlist, image);
}
void gui_sidebar_iter_update(GtkTreeIter *iter)
void gui_sidebar_iter_update_playlist(GtkTreeIter *iter,
struct playlist *playlist)
{
struct playlist *playlist = gui_sidebar_iter_playlist(iter);
gchar *text;
if (!playlist)
@ -294,6 +294,11 @@ void gui_sidebar_iter_update(GtkTreeIter *iter)
g_free(text);
}
void gui_sidebar_iter_update(GtkTreeIter *iter)
{
gui_sidebar_iter_update_playlist(iter, gui_sidebar_iter_playlist(iter));
}
void gui_sidebar_iter_select(GtkTreeIter *iter)
{
GtkTreeSelection *selection;

View File

@ -42,6 +42,7 @@ void gui_sidebar_iter_append_child(GtkTreeIter *, struct playlist *,
const gchar *);
/* Called to update the playlist at the current iterator. */
void gui_sidebar_iter_update_playlist(GtkTreeIter *, struct playlist *);
void gui_sidebar_iter_update(GtkTreeIter *);
/* Called to select the row at the current iterator. */