ocarina/include/gui/sidebar.h
Anna Schumaker 831a5379e5 gui/sidebar: Add a function for finding playlists
This function scans through the treestore at the current level, without
descending into children.  This is because we frequently know what
category playlists are under when searching for a child, so it makes
sense to find that first.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-03-31 13:45:55 -04:00

68 lines
1.9 KiB
C

/*
* Copyright 2015 (c) Anna Schumaker.
*/
#ifndef OCARINA_GUI_SIDEBAR_H
#define OCARINA_GUI_SIDEBAR_H
#include <core/playlist.h>
#include <gui/builder.h>
/* Called to initialize the sidebar. */
void gui_sidebar_init();
/* Called to set an iterator to the first playlist. */
gboolean gui_sidebar_iter_first(GtkTreeIter *);
/* Called to advance the iterator to the next playlist. */
gboolean gui_sidebar_iter_next(GtkTreeIter *);
/*
* Called to find the name of the playlist at the given iterator.
* NOTE: This function returns a new string that must be freed with g_free().
*/
gchar *gui_sidebar_iter_name(GtkTreeIter *);
/* Called to find the type of the playlist at the given iterator. */
enum playlist_type_t gui_sidebar_iter_type(GtkTreeIter *);
/* Called to add a playlist at the current iterator. */
void gui_sidebar_iter_add(GtkTreeIter *, struct playlist *, const gchar *);
/*
* Called to find a playlist with the given name and type,
* starting from the current iterator position.
*/
gboolean gui_sidebar_iter_find(GtkTreeIter *, const gchar *,
enum playlist_type_t);
/* Called to get the sidebar widget. */
static inline GtkPaned *gui_sidebar()
{
return GTK_PANED(gui_builder_widget("sidebar"));
}
/* Called to get the sidebar treestore. */
static inline GtkTreeStore *gui_sidebar_store()
{
return GTK_TREE_STORE(gui_builder_object("sidebar_store"));
}
/* Called to get the sidebar treemodel. */
static inline GtkTreeModel *gui_sidebar_model()
{
return GTK_TREE_MODEL(gui_builder_object("sidebar_store"));
}
/* Called to get the sidebar filter model. */
static inline GtkTreeModelFilter *gui_sidebar_filter()
{
return GTK_TREE_MODEL_FILTER(gui_builder_object("sidebar_filter"));
}
/* Called to get the sidebar treeview. */
static inline GtkTreeView *gui_sidebar_treeview()
{
return GTK_TREE_VIEW(gui_builder_widget("sidebar_treeview"));
}
#endif /* OCARINA_GUI_SIDEBAR_H */