Browse Source

gui/sidebar: Add a function for setting an iterator from string

The GtkTreeView editing callbacks give me a path string that I'll need
to convert into an iterator to find the edited playlist.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
next
Anna 5 years ago
parent
commit
3f9372051f
  1. 11
      gui/sidebar.c
  2. 3
      include/gui/sidebar.h

11
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;
}

3
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()
{

Loading…
Cancel
Save