From 2cfccb8177aa6d8e3a8e841c4ddfc04f50c83a5b Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Sat, 1 Oct 2016 11:38:27 -0400 Subject: [PATCH] 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 --- gui/sidebar.c | 9 +++++++-- include/gui/sidebar.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gui/sidebar.c b/gui/sidebar.c index 5af9f87a..64fa19dc 100644 --- a/gui/sidebar.c +++ b/gui/sidebar.c @@ -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; diff --git a/include/gui/sidebar.h b/include/gui/sidebar.h index e77cd3f8..eda4bd22 100644 --- a/include/gui/sidebar.h +++ b/include/gui/sidebar.h @@ -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. */