gui/treeview: Add a function for accessing the tree selection
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
a41652ab28
commit
fc5e6eb043
|
@ -218,26 +218,22 @@ void gui_treeview_scroll()
|
|||
|
||||
void gui_treeview_select_path_at_pos(unsigned int x, unsigned int y)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreePath *path;
|
||||
|
||||
selection = gtk_tree_view_get_selection(gui_treeview());
|
||||
if (gtk_tree_view_get_path_at_pos(gui_treeview(), x, y,
|
||||
&path, NULL, NULL, NULL))
|
||||
{
|
||||
gtk_tree_selection_select_path(selection, path);
|
||||
gtk_tree_selection_select_path(gui_treeview_selection(), path);
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
}
|
||||
|
||||
GList *gui_treeview_list_selected_tracks(void)
|
||||
{
|
||||
GList *rows, *cur, *list = NULL;
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
selection = gtk_tree_view_get_selection(gui_treeview());
|
||||
rows = gtk_tree_selection_get_selected_rows(selection, NULL);
|
||||
cur = g_list_first(rows);
|
||||
GtkTreeSelection *selection = gui_treeview_selection();
|
||||
GList *rows = gtk_tree_selection_get_selected_rows(selection, NULL);
|
||||
GList *cur = g_list_first(rows);
|
||||
GList *list = NULL;
|
||||
|
||||
while (cur) {
|
||||
list = g_list_append(list, gui_filter_path_get_track(cur->data));
|
||||
|
|
|
@ -32,6 +32,12 @@ static inline GtkTreeView *gui_treeview()
|
|||
return GTK_TREE_VIEW(gui_builder_widget("treeview"));
|
||||
}
|
||||
|
||||
/* Called to access the treview selection. */
|
||||
static inline GtkTreeSelection *gui_treeview_selection()
|
||||
{
|
||||
return gtk_tree_view_get_selection(gui_treeview());
|
||||
}
|
||||
|
||||
/* Called to access the sorting display widget. */
|
||||
static inline GtkLabel *gui_sorting()
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ void test_treeview_select()
|
|||
GList *list;
|
||||
unsigned int i;
|
||||
|
||||
selection = gtk_tree_view_get_selection(gui_treeview());
|
||||
selection = gui_treeview_selection();
|
||||
|
||||
gui_treeview_set_playlist(playlist_lookup(PL_SYSTEM, "Collection"));
|
||||
g_assert(gui_model_get_playlist() ==
|
||||
|
|
Loading…
Reference in New Issue
Block a user