In Glade:
- What I needed to do was add a new column of type
GtkTreeModel
to the model of myTreeView
. UnfortunatelyGtkTreeModel
is not part of the drop-down list that Glade provides when you create a column, so I manually typedGtkTreemodel
to the type column. - Then, I edited the
CellRendererCombo
that represents the products and defined as a model the column that I just created.
In the source code:
When I load the data to the model of the
TreeView
, I create for each row a newListStore
and store a reference to it in theTreeView
model.gtk_list_store_set (GTK_LIST_STORE(data->liststore_analysis), &iter, COLUMN_MODEL, GTK_LIST_STORE(data->liststore_products), -1);
When I change the value of the
CellRendererCombo
that represents the brands, I update the rows in the model for the otherCellRendererCombo
.GtkListStore * list = GTK_LIST_STORE(data->liststore_products); GtkTreeIter iter; const char * openmoko[] = {"Neo 1973","Neo FreeRunner","Dash Express","3D7K","WikiReader"}; int i, openmokoModels = sizeof (openmoko) / sizeof (*openmoko); for (i = 0; i < openmokoModels; i++){ gtk_list_store_append(list, &iter); gtk_list_store_set(list, &iter, 0, openmoko[i], -1); }
Thank you guys for your help! :)