ocarina/gui/collection.c

45 lines
1.1 KiB
C

/*
* Copyright 2015 (c) Anna Schumaker.
*/
#include <gui/builder.h>
#include <gui/collection.h>
enum collection_sidebar_columns {
C_SB_IMAGE,
C_SB_IMAGE_SZ,
C_SB_ENABLED,
C_SB_SHOW_ENABLED,
C_SB_PATH,
C_SB_LIBRARY,
};
static GtkTreeModel *c_model;
static gboolean __collection_select(GtkTreeSelection *selection,
GtkTreeModel *model, GtkTreePath *path,
gboolean selected, gpointer data)
{
return gtk_tree_path_get_depth(path) != 1;
}
void gui_collection_init()
{
GtkTreeView *treeview;
GtkTreeIter parent;
c_model = GTK_TREE_MODEL(gui_builder_object("o_collection_store"));
/* Add "Collection" header. */
gtk_tree_store_insert(GTK_TREE_STORE(c_model), &parent, NULL, -1);
gtk_tree_store_set(GTK_TREE_STORE(c_model), &parent,
C_SB_IMAGE, "system-file-manager",
C_SB_IMAGE_SZ, GTK_ICON_SIZE_LARGE_TOOLBAR,
C_SB_PATH, "<span size='large'>Collection</span>",
-1);
treeview = GTK_TREE_VIEW(gui_builder_widget("o_collection_view"));
gtk_tree_selection_set_select_function(
gtk_tree_view_get_selection(treeview),
__collection_select, NULL, NULL);
}