add a checkbox -- which apparently won't interact until I "implement

the 'activate' virtual method".
This commit is contained in:
Eric House 2013-01-08 06:32:43 -08:00
parent 1cb959c86d
commit 5e2bfd20da

View file

@ -50,9 +50,8 @@ gameIsOpen( GTKGamesGlobals* gg, sqlite3_int64 rowid )
return found; return found;
} }
enum { ROW_ITEM, NAME_ITEM, N_ITEMS }; enum { CHECK_ITEM, ROW_ITEM, NAME_ITEM, N_ITEMS };
/* Prototype for selection handler callback */
static void static void
tree_selection_changed_cb( GtkTreeSelection* selection, gpointer data ) tree_selection_changed_cb( GtkTreeSelection* selection, gpointer data )
{ {
@ -70,8 +69,19 @@ static GtkWidget*
init_games_list( GTKGamesGlobals* gg ) init_games_list( GTKGamesGlobals* gg )
{ {
GtkWidget* list = gtk_tree_view_new(); GtkWidget* list = gtk_tree_view_new();
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer;
GtkTreeViewColumn* column = GtkTreeViewColumn* column;
renderer = gtk_cell_renderer_toggle_new();
/* gtk_cell_renderer_toggle_set_activatable( GTK_CELL_RENDERER_TOGGLE(renderer), */
/* TRUE ); */
column =
gtk_tree_view_column_new_with_attributes( "<sel>", renderer, "active",
CHECK_ITEM, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW(list), column );
renderer = gtk_cell_renderer_text_new();
column =
gtk_tree_view_column_new_with_attributes( "Row", renderer, "text", gtk_tree_view_column_new_with_attributes( "Row", renderer, "text",
ROW_ITEM, NULL ); ROW_ITEM, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW(list), column ); gtk_tree_view_append_column( GTK_TREE_VIEW(list), column );
@ -81,7 +91,7 @@ init_games_list( GTKGamesGlobals* gg )
NAME_ITEM, NULL ); NAME_ITEM, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW(list), column ); gtk_tree_view_append_column( GTK_TREE_VIEW(list), column );
GtkListStore* store = gtk_list_store_new( N_ITEMS, G_TYPE_INT64, GtkListStore* store = gtk_list_store_new( N_ITEMS, G_TYPE_BOOLEAN, G_TYPE_INT64,
G_TYPE_STRING ); G_TYPE_STRING );
gtk_tree_view_set_model( GTK_TREE_VIEW(list), GTK_TREE_MODEL(store) ); gtk_tree_view_set_model( GTK_TREE_VIEW(list), GTK_TREE_MODEL(store) );
g_object_unref( store ); g_object_unref( store );