42 lines
1.0 KiB
C
42 lines
1.0 KiB
C
/*
|
|
* Copyright 2016 (c) Anna Schumaker.
|
|
*/
|
|
#include <gui/builder.h>
|
|
#include <gui/playlist.h>
|
|
|
|
enum playlist_sidebar_columns {
|
|
P_SB_IMAGE,
|
|
P_SB_IMAGE_SZ,
|
|
P_SB_NAME,
|
|
};
|
|
|
|
static GtkTreeModel *p_model;
|
|
|
|
static gboolean __playlist_select(GtkTreeSelection *selection,
|
|
GtkTreeModel *model, GtkTreePath *path,
|
|
gboolean selected, gpointer data)
|
|
{
|
|
return gtk_tree_path_get_depth(path) != 1;
|
|
}
|
|
|
|
void gui_playlist_init()
|
|
{
|
|
GtkTreeView *treeview;
|
|
GtkTreeIter iter;
|
|
|
|
p_model = GTK_TREE_MODEL(gui_builder_object("o_playlist_store"));
|
|
|
|
/* Add "Playlist" header. */
|
|
gtk_tree_store_insert(GTK_TREE_STORE(p_model), &iter, NULL, -1);
|
|
gtk_tree_store_set(GTK_TREE_STORE(p_model), &iter,
|
|
P_SB_IMAGE, "emblem-documents",
|
|
P_SB_IMAGE_SZ, GTK_ICON_SIZE_LARGE_TOOLBAR,
|
|
P_SB_NAME, "<span size='large'>Playlists</span>",
|
|
-1);
|
|
|
|
treeview = GTK_TREE_VIEW(gui_builder_widget("o_playlist_view"));
|
|
gtk_tree_selection_set_select_function(
|
|
gtk_tree_view_get_selection(treeview),
|
|
__playlist_select, NULL, NULL);
|
|
}
|