diff --git a/gui/sidebar.c b/gui/sidebar.c index 64fa19dc..37ab0ee8 100644 --- a/gui/sidebar.c +++ b/gui/sidebar.c @@ -362,3 +362,14 @@ gboolean gui_sidebar_iter_find(GtkTreeIter *iter, const gchar *name, return FALSE; } + +gboolean gui_sidebar_iter_from_string(const gchar *path, GtkTreeIter *child) +{ + GtkTreeModel *model = GTK_TREE_MODEL(gui_sidebar_filter()); + GtkTreeIter iter; + + if (!gtk_tree_model_get_iter_from_string(model, &iter, path)) + return FALSE; + __gui_sidebar_filter_iter_convert(&iter, child); + return TRUE; +} diff --git a/include/gui/sidebar.h b/include/gui/sidebar.h index eda4bd22..870bb288 100644 --- a/include/gui/sidebar.h +++ b/include/gui/sidebar.h @@ -64,6 +64,9 @@ void gui_sidebar_filter_row_expanded(GtkTreeIter *, bool); gboolean gui_sidebar_iter_find(GtkTreeIter *, const gchar *, enum playlist_type_t); +/* Called to set the a GtkTreeIter to the row at path string */ +gboolean gui_sidebar_iter_from_string(const gchar *, GtkTreeIter *); + /* Called to get the sidebar widget. */ static inline GtkPaned *gui_sidebar() {